/**
 * Responsive Styles
 * Project Management System
 */

/* Large devices (desktops, less than 1200px) */
@media (max-width: 1199.98px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium devices (tablets, less than 992px) */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .header-search {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* Small devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
    :root {
        --header-height: 60px;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .user-name {
        display: none;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .stat-content h3 {
        font-size: 24px;
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .page-title h1 {
        font-size: 20px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
    
    .toast {
        min-width: auto;
        max-width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
    }
    
    .toast-container {
        left: 20px;
        right: 20px;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .sidebar-brand {
        padding: 16px;
    }
    
    .sidebar-brand h2 {
        font-size: 16px;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .header-icon {
        padding: 6px;
    }
    
    .header-icon i {
        font-size: 18px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .table-container {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .login-header {
        padding: 30px 24px;
    }
    
    .login-body {
        padding: 24px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .page-header .btn span {
        display: none;
    }
    
    .action-buttons {
        display: flex;
        gap: 4px;
    }
    
    .action-buttons .btn {
        padding: 6px;
    }
    
    .action-buttons .btn i {
        margin: 0;
    }
}

/* Very small devices */
@media (max-width: 360px) {
    .login-box {
        border-radius: 0;
    }
    
    .modal {
        margin: 8px;
        border-radius: 8px;
    }
    
    .stat-content h3 {
        font-size: 20px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .header,
    .no-print,
    .btn,
    .modal-overlay,
    .toast-container {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .content-wrapper {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    
    body {
        background: white;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sidebar-brand img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Dark mode support (optional future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Uncomment for dark mode
    :root {
        --dark-color: #f3f4f6;
        --light-color: #374151;
    }
    
    body {
        background-color: #111827;
        color: #f3f4f6;
    }
    
    .card {
        background: #1f2937;
    }
    
    .data-table tbody tr:hover {
        background: #374151;
    }
    */
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
    
    .login-page {
        padding: 10px;
    }
    
    .login-box {
        max-height: 95vh;
        overflow-y: auto;
    }
}

/* Large screens optimization */
@media (min-width: 1400px) {
    .content-wrapper {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .data-table tbody tr:hover {
        transform: none;
    }
}
