/*==================================================
=            ACDO Responsive Design System          =
=            Mobile-First Responsive Styles         =
==================================================*/

/*==========  Base Mobile Styles (320px+) ==========*/
@media only screen and (min-width : 320px) {
    /* Typography scaling for mobile */
    body {
        font-size: 14px;
        line-height: 1.6;
    }
    
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    h5 { font-size: 14px; }
    h6 { font-size: 13px; }
    
    /* Container padding */
    .container { padding-left: 15px; padding-right: 15px; }
    
    /* Button sizing for touch */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    /* Form inputs for touch */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/*==========  Phones Landscape (480px+) ==========*/
@media only screen and (min-width : 480px) {
    h1 { font-size: 28px; }
    h2 { font-size: 22px; }
    h3 { font-size: 20px; }
}

/*==========  Tablets Portrait (768px+) ==========*/
@media only screen and (min-width : 768px) {
    body { font-size: 15px; }
    
    h1 { font-size: 32px; }
    h2 { font-size: 26px; }
    h3 { font-size: 22px; }
    h4 { font-size: 18px; }
}

/*==========  Desktops (992px+) ==========*/
@media only screen and (min-width : 992px) {
    body { font-size: 16px; }
    
    h1 { font-size: 36px; }
    h2 { font-size: 30px; }
    h3 { font-size: 24px; }
}

/*==========  Large Screens (1200px+) ==========*/
@media only screen and (min-width : 1200px) {
    h1 { font-size: 42px; }
    h2 { font-size: 32px; }
}


/*==========  MOBILE OVERRIDES (Max-Width) ==========*/

/*==========  Desktop Down (< 1200px) ==========*/
@media only screen and (max-width : 1199px) {
    /* Container adjustments */
    .container { max-width: 100%; }
    
    /* Reduce padding on larger elements */
    section { padding: 50px 0; }
}

/*==========  Tablets & Below (< 992px) ==========*/
@media only screen and (max-width : 991px) {
    /* Navigation adjustments */
    .menuzord-menu {
        display: none; /* Hide desktop menu */
    }
    
    .menuzord-menu.menuzord-indented {
        display: block; /* Show mobile menu */
    }
    
    /* Reduce section padding */
    section { padding: 40px 0; }
    
    /* Stack columns earlier */
    .col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-9 {
        margin-bottom: 30px;
    }
    
    /* Admin panel sidebar */
    .sidebar {
        width: 100%;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/*==========  Mobile Devices (< 768px) ==========*/
@media only screen and (max-width : 767px) {
    /* Hide desktop navigation elements */
    .header-top {
        display: none;
    }
    
    /* Logo sizing */
    .logo img {
        max-height: 50px;
    }
    
    /* Section spacing */
    section {
        padding: 30px 0;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Typography adjustments */
    p {
        font-size: 14px;
        line-height: 1.6;
    }
    
    /* Button adjustments */
    .btn-lg {
        font-size: 16px;
        padding: 14px 24px;
    }
    
    .btn-sm {
        font-size: 12px;
        padding: 8px 16px;
        min-height: 36px;
    }
    
    /* Card spacing */
    .card {
        margin-bottom: 20px;
    }
    
    /* Table responsiveness */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Form layouts */
    .form-group {
        margin-bottom: 20px;
    }
    
    label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-lg {
        max-width: 100%;
    }
    
    /* Remove negative margins that break layouts */
    [style*="margin-top: -"] {
        margin-top: 0 !important;
    }
    
    /* Fix gallery layouts */
    .gallery-item {
        width: 50%;
        margin-bottom: 15px;
    }
    
    /* Dropdown menus */
    .dropdown-menu {
        position: relative !important;
        float: none;
        width: 100%;
    }
    
    /* Statistics cards */
    .stat-card {
        margin-bottom: 20px;
        text-align: center;
    }
    
    /* Social media icons */
    .social-icons li {
        display: inline-block;
        margin: 5px;
    }
    
    .social-icons a {
        width: 44px;
        height: 44px;
        line-height: 44px;
        font-size: 18px;
    }
    
    /* Navigation menu items */
    .menu-item {
        display: block;
        width: 100%;
        padding: 12px 15px;
        border-bottom: 1px solid #eee;
    }
    
    /* Breadcrumbs */
    .breadcrumb {
        font-size: 12px;
        padding: 10px 15px;
    }
    
    /* Footer adjustments */
    footer .col-md-3,
    footer .col-md-4,
    footer .col-md-6 {
        margin-bottom: 30px;
        text-align: center;
    }
    
    /* Sidebar widgets */
    .sidebar .widget {
        margin-bottom: 30px;
    }
}

/*==========  Small Phones (< 480px) ==========*/
@media only screen and (max-width : 479px) {
    /* Even smaller typography */
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    
    /* Tighter spacing */
    section { padding: 20px 0; }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Single column galleries */
    .gallery-item {
        width: 100%;
    }
    
    /* Full width buttons */
    .btn-block-mobile {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Smaller modals */
    .modal-body {
        padding: 15px;
    }
    
    /* Compact tables */
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 5px;
    }
    
    /* Compact admin cards */
    .admin-card {
        padding: 15px;
    }
    
    .admin-card h4 {
        font-size: 16px;
    }
}

/*==========  Extra Small Phones (< 360px) ==========*/
@media only screen and (max-width : 360px) {
    /* Minimum safe sizing */
    h1 { font-size: 20px; }
    h2 { font-size: 17px; }
    
    body { font-size: 13px; }
    
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    /* Tighter container */
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/*==========  iPhone SE / Very Small (< 320px) ==========*/
@media only screen and (max-width : 319px) {
    /* Absolute minimum sizing */
    * {
        box-sizing: border-box;
    }
    
    body { font-size: 12px; }
    h1 { font-size: 18px; }
    h2 { font-size: 16px; }
    
    .container {
        padding-left: 5px;
        padding-right: 5px;
    }
}

/*==========  PRINT STYLES ==========*/
@media print {
    /* Hide navigation and footers */
    header, footer, .sidebar, .btn, .social-icons {
        display: none !important;
    }
    
    /* Optimize for printing */
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    /* Remove shadows and borders */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100% !important;
    }
}

/*==========  HIGH DPI DISPLAYS (Retina) ==========*/
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Use 2x images where available */
    .logo-retina {
        background-image: url('../image/logo@2x.png');
        background-size: contain;
    }
}

/*==========  LANDSCAPE ORIENTATION ==========*/
@media (max-width: 767px) and (orientation: landscape) {
    /* Optimize for landscape mobile */
    .header {
        min-height: 50vh;
    }
    
    section {
        padding: 30px 0;
    }
}

/*==========  DARK MODE SUPPORT ==========*/
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles here if needed */
    /* Commented out by default, uncomment to enable */
    /*
    body {
        background: #1a1d21;
        color: #f8f9fa;
    }
    
    .card {
        background: #2F2F4F;
        color: #f8f9fa;
    }
    */
}

/*==========  REDUCED MOTION ==========*/
@media (prefers-reduced-motion: reduce) {
    /* Respect user's motion preferences */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/*==========  BOOTSTRAP 4 GRID FIXES ==========*/

/* Ensure columns stack properly on mobile */
@media (max-width: 767px) {
    [class*="col-"] {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Ensure proper spacing between stacked columns */
    .row > [class*="col-"] {
        margin-bottom: var(--spacing-4, 1rem);
    }
    
    .row > [class*="col-"]:last-child {
        margin-bottom: 0;
    }
}

/* Boxed layout responsive adjustments */
@media (max-width: 991px) {
    .boxed-layout #wrapper {
        margin: 0;
        width: 100%;
    }
    
    .boxed-layout {
        padding: 0 !important;
    }
}

/* Fix for col-12 col-md-* pattern */
.col-12 {
    width: 100%;
}

@media (min-width: 768px) {
    .col-md-1 { width: 8.333333%; }
    .col-md-2 { width: 16.666667%; }
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.333333%; }
    .col-md-5 { width: 41.666667%; }
    .col-md-6 { width: 50%; }
    .col-md-7 { width: 58.333333%; }
    .col-md-8 { width: 66.666667%; }
    .col-md-9 { width: 75%; }
    .col-md-10 { width: 83.333333%; }
    .col-md-11 { width: 91.666667%; }
    .col-md-12 { width: 100%; }
}
