/* Nosaya Responsive Design */

/* Desktop (Default) - Already handled in global.css */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
    .container {
        padding: 0 var(--spacing-md);
    }

    /* Sidebar */
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar-link span {
        display: none;
    }

    .sidebar-link .icon {
        margin-right: 0;
    }

    /* Cards */
    .card {
        padding: var(--spacing-md);
    }

    /* Typography */
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
}

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
    /* Layout */
    .container {
        padding: 0 var(--spacing-sm);
    }

    /* Sidebar - Convert to bottom navigation */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: var(--bottom-nav-height);
        flex-direction: row;
        justify-content: space-around;
        padding: var(--spacing-xs);
        border-top: 1px solid var(--border);
        border-right: none;
        z-index: var(--z-fixed);
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
    }

    .sidebar-link {
        flex-direction: column;
        padding: var(--spacing-xs);
        gap: 2px;
    }

    .sidebar-link span {
        display: block;
        font-size: var(--text-xs);
    }

    .sidebar-link .icon {
        margin-right: 0;
        font-size: var(--text-lg);
    }

    .sidebar-footer {
        display: none;
    }

    /* Main Content */
    .main-content {
        padding-bottom: var(--bottom-nav-height);
    }

    /* Header */
    .header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .header-title {
        font-size: var(--text-lg);
    }

    /* Cards */
    .card {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }

    .card-header {
        padding-bottom: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }

    .card-title {
        font-size: var(--text-lg);
    }

    /* Buttons */
    .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--text-sm);
    }

    .btn-lg {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: var(--text-base);
    }

    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: var(--spacing-sm);
        font-size: var(--text-base);
    }

    /* Modal */
    .modal {
        margin: var(--spacing-sm);
        max-height: calc(100vh - var(--spacing-lg));
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--spacing-md);
    }

    /* Toast */
    .toast-container {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
        left: var(--spacing-sm);
    }

    .toast {
        min-width: auto;
    }

    /* Typography */
    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }
    h3 { font-size: var(--text-lg); }
    h4 { font-size: var(--text-base); }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Grid */
    .grid {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-4 {
        grid-template-columns: 1fr;
    }

    /* Stats Cards */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Calendar */
    .calendar-view {
        font-size: var(--text-sm);
    }

    .calendar-day {
        min-height: 60px;
    }

    /* Task List */
    .task-item {
        padding: var(--spacing-sm);
    }

    /* Focus Timer */
    .focus-timer {
        font-size: var(--text-4xl);
    }

    /* Charts */
    .chart-container {
        height: 200px;
    }
}

/* Small Mobile (320px - 374px) */
@media (max-width: 374px) {
    .container {
        padding: 0 var(--spacing-xs);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .sidebar {
        width: 280px;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .header,
    .btn,
    .modal-backdrop,
    .toast-container {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border);
    }

    body {
        background-color: white;
        color: black;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .card-interactive:hover,
    .tab:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .card-interactive:active {
        transform: scale(0.98);
    }

    /* Larger touch targets */
    .btn,
    .sidebar-link,
    .tab {
        min-height: 44px;
        min-width: 44px;
    }

    .form-checkbox,
    .form-radio {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Retina-specific adjustments if needed */
}

/* Landscape Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .modal {
        max-height: 90vh;
    }

    .focus-timer {
        font-size: var(--text-3xl);
    }
}

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

/* Dark Mode Auto-switch */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #0f172a;
        --surface: #1e293b;
        --surface-alt: #334155;
        --border: #475569;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-tertiary: #64748b;
        --text-inverse: #0f172a;
    }
}
