/* 
 * Responsive Styles
 * Developer: BUILD MY WEBSITE - https://buildmywebsite.com.ng
 */

/* Base Mobile First */
.container {
    width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

/* Extra Small Devices (Phones, 0px to 575px) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 12px;
    }
    
    /* Typography */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    /* Header */
    .site-header {
        padding: 10px 0;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .site-branding {
        flex: 1;
        min-width: 150px;
    }
    
    .site-logo {
        max-height: 40px;
    }
    
    .header-actions {
        order: 2;
        width: 100%;
        justify-content: space-between;
    }
    
    .header-actions .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .mobile-menu-toggle {
        display: block !important;
        order: 1;
    }
    
    .main-navigation {
        display: none;
        order: 3;
        width: 100%;
        margin-top: 15px;
    }
    
    .main-navigation.active {
        display: block;
    }
    
    .primary-menu-container ul {
        flex-direction: column;
        gap: 0;
    }
    
    .primary-menu-container li {
        width: 100%;
    }
    
    .primary-menu-container a {
        display: block;
        padding: 12px 15px;
        border-bottom: 1px solid #eee;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 40px 0;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 1.8rem !important;
        margin-bottom: 15px;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 25px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .hero-buttons .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Features Grid */
    .features-grid,
    .services-grid,
    .clients-grid,
    .partners-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .feature-card,
    .service-card,
    .client-category {
        padding: 20px 15px;
    }
    
    /* Tracking Form */
    .tracking-input-group {
        flex-direction: column;
    }
    
    .tracking-input-group input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .tracking-input-group .btn {
        width: 100%;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .registration-container {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }
    
    .registration-sidebar {
        margin-top: 30px;
    }
    
    /* Dashboard */
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 1000;
        height: 100vh;
        transition: left 0.3s ease;
    }
    
    .dashboard-sidebar.active {
        left: 0;
    }
    
    .mobile-dashboard-toggle {
        display: block !important;
    }
    
    .dashboard-main {
        padding: 15px;
    }
    
    /* Tables */
    .shipments-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .shipments-table th,
    .shipments-table td {
        padding: 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    /* Modals */
    .modal-content {
        width: 95% !important;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Buttons */
    .btn-lg {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    /* Cards */
    .service-preview-card {
        flex-direction: column;
    }
    
    .service-preview-card .service-image {
        width: 100%;
        height: 200px;
    }
    
    .service-preview-card .service-content {
        width: 100%;
        padding: 20px;
    }
    
    /* Stats */
    .cta-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    /* Tracking Home */
    .tracking-home-wrapper {
        flex-direction: column;
        gap: 30px;
    }
    
    .tracking-image {
        display: none;
    }
    
    /* WhatsApp Float */
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 15px;
        font-size: 24px;
    }
    
    /* Back to Top */
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        left: 15px;
        font-size: 18px;
    }
}

/* Small Devices (Landscape phones, 576px to 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    /* Typography */
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    /* Grids */
    .features-grid,
    .services-grid,
    .clients-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .partners-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Hero */
    .hero-buttons {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .hero-buttons .btn {
        flex: 1;
        min-width: 200px;
    }
    
    /* Dashboard */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Service Preview */
    .services-preview-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Medium Devices (Tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }
    
    /* Header */
    .header-content {
        flex-wrap: wrap;
    }
    
    .main-navigation {
        order: 3;
        width: 100%;
        margin-top: 15px;
    }
    
    .primary-menu-container ul {
        justify-content: center;
        flex-wrap: wrap;
        gap: 20px;
    }
    
    /* Grids */
    .features-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .services-grid,
    .clients-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .partners-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* Dashboard */
    .dashboard-container {
        grid-template-columns: 220px 1fr;
    }
    
    .dashboard-sidebar {
        padding: 20px 15px;
    }
    
    .dashboard-main {
        padding: 20px;
    }
    
    /* Service Preview */
    .services-preview-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Tracking Home */
    .tracking-home-wrapper {
        flex-direction: column;
    }
    
    .tracking-image {
        display: none;
    }
}

/* Large Devices (Desktops, 992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    /* Dashboard */
    .dashboard-container {
        grid-template-columns: 250px 1fr;
    }
    
    /* Service Preview */
    .services-preview-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .service-preview-card {
        flex-direction: column;
        height: auto;
    }
    
    .service-preview-card .service-image {
        width: 100%;
        height: 200px;
    }
    
    .service-preview-card .service-content {
        width: 100%;
    }
}

/* Extra Large Devices (Large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .btn,
    .no-print,
    .whatsapp-float,
    .back-to-top,
    .mobile-menu-toggle,
    .header-actions {
        display: none !important;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    body {
        font-size: 12pt !important;
        line-height: 1.4 !important;
        color: #000 !important;
        background: #fff !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #000 !important;
        page-break-after: avoid;
    }
    
    .tracking-card,
    .invoice-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        page-break-inside: avoid;
    }
    
    .status-badge {
        border: 1px solid #000 !important;
        background: none !important;
        color: #000 !important;
        padding: 2px 8px !important;
    }
    
    .btn-action {
        display: none !important;
    }
    
    .tracking-timeline {
        page-break-inside: avoid;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #4a90e2;
        --secondary-color: #ff9500;
        --dark-color: #f5f5f5;
        --light-color: #1a1a1a;
        --white: #121212;
        --gray-light: #333;
        --gray: #999;
    }
    
    body {
        background-color: #121212;
        color: #f5f5f5;
    }
    
    .service-card,
    .tracking-card,
    .document-item,
    .feature-card,
    .client-category {
        background-color: #1a1a1a;
        border-color: #333;
        color: #f5f5f5;
    }
    
    .form-control {
        background-color: #1a1a1a;
        border-color: #333;
        color: #f5f5f5;
    }
    
    .form-control:focus {
        border-color: var(--primary-color);
        background-color: #1a1a1a;
        color: #f5f5f5;
    }
    
    select.form-control {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23f5f5f5' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    }
    
    .bg-light {
        background-color: #1a1a1a !important;
    }
    
    .btn-outline {
        border-color: #444;
        color: #f5f5f5;
    }
    
    .btn-outline:hover {
        background-color: var(--primary-color);
        color: #fff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #ff0000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid currentColor;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .btn-action,
    .menu-toggle,
    .tab-link,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    input,
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .dropdown:hover .dropdown-menu {
        display: none;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    /* Increase touch target size */
    .radio-label,
    .checkbox-label {
        padding: 12px;
    }
    
    .file-upload-label {
        padding: 30px 20px;
    }
}

/* Orientation Specific */
@media (orientation: portrait) {
    .hero-section {
        min-height: 70vh;
    }
    
    .tracking-home-wrapper {
        flex-direction: column;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 100vh;
        padding: 40px 0;
    }
    
    .site-header {
        position: static;
    }
    
    .hero-content h1 {
        font-size: 2rem !important;
    }
}

/* JavaScript Enhancement Classes */
.no-js .js-only {
    display: none;
}

.js .no-js-only {
    display: none;
}

/* Loading States */
.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes for Responsive */
.responsive-hidden {
    display: none !important;
}

.responsive-visible {
    display: block !important;
}

@media (max-width: 767.98px) {
    .hidden-mobile {
        display: none !important;
    }
    
    .visible-mobile {
        display: block !important;
    }
    
    .text-center-mobile {
        text-align: center !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .hidden-tablet {
        display: none !important;
    }
    
    .visible-tablet {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .hidden-desktop {
        display: none !important;
    }
    
    .visible-desktop {
        display: block !important;
    }
}

/* Flexbox Grid Responsive */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }

@media (max-width: 767.98px) {
    .col-6, .col-4, .col-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 20px;
    }
}

/* Responsive Images */
.responsive-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.background-cover {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (max-width: 767.98px) {
    .background-cover-mobile {
        background-attachment: scroll !important;
    }
}

/* Responsive Spacing */
.responsive-padding {
    padding: 40px 0;
}

@media (max-width: 767.98px) {
    .responsive-padding {
        padding: 30px 0;
    }
}

@media (max-width: 575.98px) {
    .responsive-padding {
        padding: 20px 0;
    }
}

/* Responsive Typography */
.responsive-text {
    font-size: 1rem;
    line-height: 1.6;
}

@media (max-width: 767.98px) {
    .responsive-text {
        font-size: 0.95rem;
        line-height: 1.5;
    }
}

@media (max-width: 575.98px) {
    .responsive-text {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}