/* ===== Responsive Design ===== */

/* Tablet & Smaller (768px and below) */
@media (max-width: 768px) {
    /* ===== App Layout ===== */
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: var(--spacing-md);
        flex-wrap: wrap;
    }

    .sidebar.open {
        flex-direction: column;
        height: auto;
    }

    .sidebar-header {
        padding: 0;
        border-bottom: none;
        flex: 1;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar-nav {
        display: none;
        width: 100%;
        padding: var(--spacing-md) 0;
        order: 3;
    }

    .sidebar.open .sidebar-nav {
        display: flex;
        flex-direction: column;
    }

    .nav-link {
        width: 100%;
    }

    .sidebar-footer {
        width: 100%;
        order: 4;
        padding: var(--spacing-md) 0;
        border-top: 1px solid var(--border);
        border-bottom: none;
    }

    .main-content {
        grid-column: 1;
    }

    .top-bar {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }

    /* ===== Landing Page ===== */
    .landing-nav {
        padding: var(--spacing-md);
    }

    .nav-container {
        flex-direction: row;
        width: 100%;
    }

    .hero {
        grid-template-columns: 1fr;
        padding: 40px var(--spacing-md);
        gap: var(--spacing-lg);
        text-align: center;
    }

    .hero-content h1 {
        font-size: 32px;
    }

    .hero-content > p:first-of-type {
        font-size: 18px;
    }

    .fitness-icon {
        font-size: 80px;
    }

    .features {
        padding: 40px var(--spacing-md);
    }

    .features h2 {
        font-size: 28px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .cta-section {
        padding: 40px var(--spacing-md);
    }

    .cta-section h2 {
        font-size: 28px;
    }

    /* ===== Dashboard ===== */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        grid-template-columns: auto 1fr;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 32px;
    }

    .stat-number {
        font-size: 28px;
    }

    .action-buttons {
        flex-direction: column;
    }

    /* ===== Members Page ===== */
    .members-controls {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .filter-select {
        min-width: auto;
        width: 100%;
    }

    .filter-controls {
        flex-direction: column;
        width: 100%;
    }

    .filter-controls .btn-secondary {
        width: 100%;
    }

    .member-card {
        grid-template-columns: auto 1fr;
    }

    .member-actions {
        grid-column: 1 / -1;
        margin-top: var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .action-btn {
        flex: 1;
        padding: 10px var(--spacing-sm);
        font-size: 12px;
    }

    .member-details {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    /* ===== Modal ===== */
    .modal-content {
        width: 95%;
        max-width: 90vw;
    }

    .form-buttons {
        flex-direction: column;
    }

    .modal-buttons {
        flex-direction: column;
    }

    /* ===== Typography ===== */
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }

    /* ===== Buttons ===== */
    .btn-primary, .btn-secondary {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* ===== Toast ===== */
    .toast {
        left: var(--spacing-lg);
        right: var(--spacing-lg);
    }
}

/* Mobile (576px and below) */
@media (max-width: 576px) {
    :root {
        --spacing-md: 12px;
        --spacing-lg: 16px;
    }

    body {
        font-size: 14px;
    }

    /* ===== Landing Page ===== */
    .landing-page {
        min-height: auto;
    }

    .landing-nav {
        padding: var(--spacing-md);
    }

    .logo-text {
        font-size: 24px;
    }

    .hero {
        padding: 30px var(--spacing-md);
        gap: var(--spacing-md);
    }

    .hero-content h1 {
        font-size: 24px;
    }

    .hero-content > p:first-of-type {
        font-size: 16px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    .fitness-icon {
        font-size: 60px;
    }

    .features {
        padding: 30px var(--spacing-md);
    }

    .features h2 {
        font-size: 22px;
    }

    .feature-card {
        padding: var(--spacing-md);
    }

    .feature-icon {
        font-size: 36px;
    }

    .cta-section {
        padding: 30px var(--spacing-md);
    }

    .cta-section h2 {
        font-size: 22px;
    }

    /* ===== App Layout ===== */
    .sidebar {
        padding: var(--spacing-sm);
    }

    .sidebar-header {
        gap: var(--spacing-sm);
    }

    .logo-compact {
        width: 36px;
        height: 36px;
    }

    .logo-compact .logo-text {
        font-size: 18px;
    }

    .sidebar-footer {
        gap: var(--spacing-xs);
    }

    .theme-toggle,
    .logout-btn {
        padding: 8px;
        font-size: 14px;
    }

    .top-bar {
        padding: var(--spacing-md);
    }

    /* ===== Dashboard ===== */
    .dashboard-content {
        padding: var(--spacing-md);
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }

    .stat-number {
        font-size: 24px;
    }

    .stat-info h3 {
        font-size: 12px;
    }

    .stat-card {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }

    /* ===== Members Page ===== */
    .members-controls {
        padding: var(--spacing-md);
    }

    .member-card {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }

    .member-avatar {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .member-name {
        font-size: 15px;
    }

    .member-details {
        gap: var(--spacing-sm);
        font-size: 12px;
    }

    .detail-label {
        font-size: 10px;
    }

    .member-status {
        font-size: 11px;
    }

    .action-btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    /* ===== Modal ===== */
    .modal-content {
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: var(--spacing-md);
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .member-form {
        padding: var(--spacing-md);
    }

    .form-group {
        margin-bottom: var(--spacing-md);
    }

    .form-group label {
        font-size: 13px;
    }

    .form-buttons {
        gap: var(--spacing-sm);
    }

    /* ===== Typography ===== */
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    h4 { font-size: 15px; }
    h5 { font-size: 14px; }
    h6 { font-size: 13px; }

    /* ===== Buttons ===== */
    .btn-primary, .btn-secondary {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* ===== Inputs ===== */
    input, select, textarea {
        padding: 10px;
        font-size: 14px;
    }

    /* ===== Toast ===== */
    .toast {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
        padding: var(--spacing-md);
    }
}

/* Large Desktop (1200px and above) */
@media (min-width: 1200px) {
    .dashboard-content {
        max-width: 1400px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra Large Desktop (1400px and above) */
@media (min-width: 1400px) {
    :root {
        --spacing-lg: 32px;
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xl);
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .top-bar,
    .members-controls,
    .modal {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }

    .member-card {
        page-break-inside: avoid;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .stat-card {
        border-width: 0.5px;
    }

    .member-card {
        border-width: 0.5px;
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Preference */
@media (prefers-color-scheme: dark) {
    body {
        color-scheme: dark;
    }
}

/* Light Mode Preference */
@media (prefers-color-scheme: light) {
    body {
        color-scheme: light;
    }
}

/* Touch Device Specific */
@media (hover: none) and (pointer: coarse) {
    .stat-card:active {
        transform: scale(0.98);
    }

    .member-card:active {
        transform: scale(0.98);
    }

    button:active {
        transform: scale(0.95);
    }
}
