/* 
 * responsive.css
 * Responsive design utilities and media queries
 * Mobile-first approach
 */

/* ========================================
   BREAKPOINTS
   ======================================== */

/*
   xs: < 576px  (Mobile phones)
   sm: 576px-768px  (Small devices)
   md: 768px-1199px  (Tablets)
   lg: 1200px+  (Desktop)
*/

/* ========================================
   MOBILE FIRST - BASE STYLES
   ======================================== */

body {
    font-size: 14px;
}

.page-content {
    padding: 2px;
    margin-top: 5px;
}

.main-container {
    margin-top: 5px;
}

.navbar {
    height: 56px;
}

/* ========================================
   SMALL DEVICES (576px - 767px)
   ======================================== */

@media (min-width: 576px) {
    body {
        font-size: 14px;
    }
    
    .page-content {
        padding: 16px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .form-control,
    .form-select {
        font-size: 14px;
    }
}

/* ========================================
   TABLETS (768px - 1199px)
   ======================================== */

@media (min-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .page-content {
        padding: 20px;
        margin-top: 6px;
    }
    
    .main-container {
        margin-top: 6px;
    }
    
    .navbar {
        height: 60px;
    }
    
    .navbar-logo {
        height: 40px;
    }
    
    .btn {
        padding: 10px 24px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Show sidebar on tablet */
    body.sidebar-visible .main-container {
        margin-left: 0px;
    }
    
    body.sidebar-collapsed .main-container {
        margin-left: 0px;
    }
    
    .sidebar {
        width: 200px;
    }
    
    .sidebar.collapsed {
        width: 80px;
    }
    
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
}

/* ========================================
   DESKTOP (1200px+)
   ======================================== */

@media (min-width: 1200px) {
    body {
        font-size: 14px;
    }
    
    .page-content {
        padding: 24px;
    }
    
    .btn {
        padding: 10px 24px;
        font-size: 14px;
    }
    
    .navbar-nav {
        gap: 30px;
    }
    
    /* Show full sidebar on desktop */
    body.sidebar-visible .main-container {
        margin-left: 0px;
    }
    
    body.sidebar-collapsed .main-container {
        margin-left: 0px;
    }
    
    .sidebar {
        width: 250px;
    }
    
    .sidebar.collapsed {
        width: 80px;
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   LARGE DESKTOP (1400px+)
   ======================================== */

@media (min-width: 1400px) {
    .container-fluid {
        max-width: 1400px;
    }
    
    .grid-5 {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .grid-6 {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ========================================
   MOBILE NAVIGATION (< 768px)
   ======================================== */

/*@media (max-width: 767px) {*/
    /* Hide desktop navbar elements */
    /*.navbar-nav {
        display: none !important;
    }
    
    .navbar-right {
        display: none !important;
    }*/
    
    /* Show hamburger menu */
    /*.navbar-toggler {
        display: block !important;
    }*/
    
    /* Mobile navbar */
    /*.navbar {
        padding: 10px 16px;
    }
    
    .navbar-logo {
        height: 36px;
    }*/
    
    /* Mobile menu styling */
    /*.mobile-menu {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 56px);
        background-color: var(--primary-darker);
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 20px 0;
    }
    
    .mobile-menu.show {
        left: 0;
    }
    
    .mobile-menu-item {
        display: block;
        padding: 16px 20px;
        color: var(--text-white);
        text-decoration: none;
        border-bottom: 1px solid var(--border-color);
        transition: all 0.3s ease;
    }
    
    .mobile-menu-item:hover {
        background-color: var(--primary-light);
        color: var(--accent-cyan);
    }
    
    .mobile-menu-item.active {
        background-color: rgba(0, 212, 255, 0.1);
        color: var(--accent-cyan);
        border-left: 3px solid var(--accent-cyan);
        padding-left: 17px;
    }*/
    
    /* Hide sidebar on mobile */
    /*.sidebar {
        display: none !important;
    }
    
    body.sidebar-visible .main-container,
    body.sidebar-collapsed .main-container {
        margin-left: 0;
    }
}*/

/* ========================================
   MOBILE LAYOUT (< 576px)
   ======================================== */

@media (max-width: 575px) {
    .page-content {
        padding: 10px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
        width: 100%;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .card-body,
    .card-header,
    .card-footer {
        padding: 12px;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents auto-zoom on iOS */
    }
    
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    h4 { font-size: 14px; }
    
    /* Stack layouts vertically */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5,
    .grid-6 {
        grid-template-columns: 1fr !important;
    }
    
    .hstack {
        flex-direction: column !important;
    }
    
    .hstack > * + * {
        margin-left: 0;
        margin-top: var(--spacing-md);
    }
    
    /* Tables - horizontal scroll on mobile */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 500px;
        margin-bottom: 0;
    }
    
    /* Modal - full width on mobile */
    .modal-content {
        width: 95%;
        max-width: 100%;
    }
    
    /* Footer - single column */
    .footer-section {
        margin-bottom: 20px;
        text-align: center;
    }
    
    .footer-links {
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    /* Pagination - reduced spacing */
    .pagination {
        gap: 2px;
    }
    
    .page-link {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    /* Dropdown menu - full width */
    .dropdown-menu {
        position: fixed;
        left: 10px;
        right: 10px;
        width: auto;
    }
    
    /* List groups - full width items */
    .list-group-item {
        padding: 12px;
        font-size: 13px;
    }
    
    /* Alert - full width */
    .alert {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        padding: 12px;
    }
    
    /* Badge - adjusted sizing */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* ========================================
   MEDIUM TABLETS (768px - 991px)
   ======================================== */

@media (min-width: 768px) and (max-width: 991px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-5,
    .grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 { font-size: 26px; }
    h2 { font-size: 22px; }
    h3 { font-size: 18px; }
}

/* ========================================
   LARGE TABLETS / SMALL DESKTOP (992px - 1199px)
   ======================================== */

@media (min-width: 992px) and (max-width: 1199px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-5,
    .grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATION
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets on mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    .sidebar-link,
    .page-link,
    .list-group-item,
    a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover,
    a:hover {
        box-shadow: none;
        transform: none;
    }
    
    /* Increase spacing for touch */
    .page-content {
        padding: 16px;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */

@media (max-height: 600px) and (orientation: landscape) {
    .navbar {
        height: 48px;
    }
    
    .page-content {
        min-height: auto;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ========================================
   HIGH DPI DISPLAYS (Retina)
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Thinner borders for high DPI */
    .border,
    .card,
    .alert,
    .form-control {
        border-width: 0.5px;
    }
    
    /* Smoother animations on high DPI */
    .transition-all,
    .transition-fast,
    .transition-slow {
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    img {
        max-width: 100% !important;
    }
    
    @page {
        margin: 0.5cm;
    }
    
    .no-print,
    .navbar,
    .sidebar,
    .footer,
    .modal,
    .btn {
        display: none !important;
    }
    
    .page-content {
        margin: 0;
        padding: 0;
    }
}

/* ========================================
   DARK MODE / COLOR SCHEME PREFERENCE
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Already dark theme, no changes needed */
}

@media (prefers-color-scheme: light) {
    /* Optional: Support light mode if needed */
    /* Color scheme preferences can be respected here */
}

/* ========================================
   REDUCED MOTION PREFERENCE
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   RESPONSIVE CONTAINER QUERIES (Future)
   ======================================== */

@supports (container-type: inline-size) {
    .responsive-container {
        container-type: inline-size;
    }
    
    @container (min-width: 400px) {
        .container-item {
            display: grid;
            grid-template-columns: 1fr 1fr;
        }
    }
}
/* ========================================
   MOBILE NAVIGATION (< 768px)
   ======================================== */

@media (max-width: 991px) {
    /* Let Bootstrap handle the collapse behavior naturally */
    .navbar-collapse {
        background-color: var(--primary-darker);
        padding: 20px;
        margin-top: 10px;
        border-radius: var(--border-radius-md);
        border: 1px solid var(--border-color);
    }

    .navbar-nav {
        flex-direction: column;
        gap: 0 !important;
    }

    .nav-item {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-link {
        padding: 12px 16px;
        margin: 0;
        width: 100%;
    }

    .navbar-right {
        flex-direction: column;
        width: 100%;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid var(--border-color);
    }

    /* Dropdown submenu adjustments for mobile */
    .dropdown-submenu {
        position: static !important;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--accent-cyan);
        margin-left: 20px;
        margin-top: 10px;
        background-color: rgba(0, 212, 255, 0.05);
    }

    /* Hide sidebar on mobile */
    .sidebar {
        display: none !important;
    }

    body.sidebar-visible .main-container,
    body.sidebar-collapsed .main-container {
        margin-left: 0;
    }
}