/* BizPass Dashboard - Main Styles (Neo-Tactile Design) */

:root {
    /* Neo-Tactile Color Palette - Warm Beige with Sage Accents */
    --color-primary: #858A6B;
    --color-primary-dark: #6B7055;
    --color-primary-light: #A3A88A;

    /* Accent Color - Sage Green for Actions */
    --color-accent: #858A6B;
    --color-accent-hover: #6B7055;
    --color-accent-light: #A3A88A;

    /* Neomorphic Backgrounds - Warm Beige Palette */
    --color-bg-main: #E8E4DF;
    --color-bg-sidebar: #2c3e50;
    --color-bg-card: #EDEAE5;
    --color-bg-hover: #E0DCD7;

    /* Text */
    --color-text-primary: #3D3D3D;
    --color-text-secondary: #6C6C6C;
    --color-text-muted: #9A9A9A;

    /* Accents */
    --color-accent-dark: #1a252f;
    --color-accent-green: #6B8A5E;
    --color-accent-tan: #C4B8A5;

    /* Status Colors */
    --color-success: #6B8A5E;
    --color-warning: #C9A55C;
    --color-error: #B85C5C;
    --color-info: #5B8FA3;

    /* Neo-Tactile Color Scale */
    --color-gray-50: #F2EFEB;
    --color-gray-100: #EDEAE5;
    --color-gray-200: #E8E4DF;
    --color-gray-300: #DCD8D3;
    --color-gray-400: #C4B8A5;
    --color-gray-500: #9A9A9A;
    --color-gray-600: #6C6C6C;
    --color-gray-700: #4A4A4A;
    --color-gray-800: #3D3D3D;
    --color-gray-900: #2D2D2D;

    /* Neomorphic Shadows - Warm Beige (matches homepage) */
    --neu-shadow-light: rgba(255, 255, 255, 0.8);
    --neu-shadow-dark: rgba(163, 157, 147, 0.5);
    --shadow-neu: 6px 6px 12px var(--neu-shadow-dark), -6px -6px 12px var(--neu-shadow-light);
    --shadow-neu-inset: inset 4px 4px 8px var(--neu-shadow-dark), inset -4px -4px 8px var(--neu-shadow-light);
    --shadow-neu-sm: 4px 4px 8px var(--neu-shadow-dark), -4px -4px 8px var(--neu-shadow-light);
    --shadow-neu-lg: 8px 8px 20px var(--neu-shadow-dark), -8px -8px 20px var(--neu-shadow-light);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 1.75rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(45, 45, 45, 0.04);
    --shadow: 0 2px 4px rgba(45, 45, 45, 0.06);
    --shadow-md: 0 4px 8px rgba(45, 45, 45, 0.08);
    --shadow-lg: 0 8px 16px rgba(45, 45, 45, 0.12);
    --shadow-xl: 0 16px 32px rgba(45, 45, 45, 0.16);
}

/* Dark Mode Theme - Neumorphic Dark */
[data-theme="dark"] {
    /* Primary Colors */
    --color-primary: #7c8cfc;
    --color-primary-dark: #667eea;
    --color-primary-light: #939cff;

    /* Dark Neumorphic Backgrounds */
    --color-bg-main: #2c3e50;
    --color-bg-sidebar: #1a252f;
    --color-bg-card: #2c3e50;
    --color-bg-hover: #34495e;

    /* Text */
    --color-text-primary: #ecf0f1;
    --color-text-secondary: #bdc3c7;
    --color-text-muted: #95a5a6;

    /* Accents */
    --color-accent-dark: #16213d;
    --color-accent-green: #10b981;
    --color-accent-light: #34495e;

    /* Status */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Dark Neumorphic Grays */
    --color-gray-50: #34495e;
    --color-gray-100: #2c3e50;
    --color-gray-200: #243342;
    --color-gray-300: #4D4D4D;
    --color-gray-400: #606060;
    --color-gray-500: #7A7A7A;
    --color-gray-600: #949494;
    --color-gray-700: #B8B8B8;
    --color-gray-800: #D1D1D1;
    --color-gray-900: #E8E8E8;

    /* Shadows - Darker for dark mode */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.7);
}

/* Smooth transitions for theme changes */
body,
.sidebar,
.main-content,
.card,
.card-preview,
.btn-primary,
.btn-secondary,
input,
select,
textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    /* Prevent Windows DPI scaling from causing layout jumps */
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg-main);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    /* Prevent content from shifting during font load */
    font-synthesis: none;
}

/* Loading container — on desktop pre-offset to match the sidebar so there's no positional jump */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .loading-container {
        padding-left: 280px; /* matches sidebar width so content appears in the same column */
    }
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-bg-main);
    align-items: stretch; /* stretch instead of center — prevents centering artifact */
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    /* Fade in when shown to smooth the loading→dashboard transition */
    opacity: 0;
    transition: opacity 0.18s ease-in;
}

.dashboard-layout.visible {
    opacity: 1;
}

/* Top Header Bar with Hamburger Menu */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: 70px;
    background: var(--color-bg-card);
    box-shadow: var(--shadow-neu-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: 1000;
    box-sizing: border-box;
}

.hamburger-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--color-bg-card);
    box-shadow: 6px 6px 12px var(--neu-shadow-dark),
                -6px -6px 12px var(--neu-shadow-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Top highlight for 3D effect */
.hamburger-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

.hamburger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 8px 8px 16px var(--neu-shadow-dark),
                -8px -8px 16px var(--neu-shadow-light);
}

.hamburger-btn:active {
    transform: translateY(1px);
    box-shadow: inset 4px 4px 8px rgba(163, 157, 147, 0.25),
                inset -4px -4px 8px rgba(255, 255, 255, 0.7);
}

.hamburger-btn:active::before {
    background: linear-gradient(180deg, rgba(163, 157, 147, 0.1) 0%, rgba(74, 74, 74, 0) 100%);
}

.hamburger-icon {
    width: 24px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-icon span {
    display: block;
    height: 3px;
    background: var(--color-text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-icon span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}

.hamburger-btn.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-icon span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    /* Neomorphic debossed/pressed text effect */
    text-shadow:
        -1px -1px 2px var(--neu-shadow-light),
        1px 1px 2px var(--neu-shadow-dark),
        2px 2px 4px rgba(133, 138, 107, 0.3);
    position: relative;
}

/* Collapsible Sidebar - Neomorphic Style */
.sidebar {
    width: 280px;
    background: var(--color-bg-main);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 6px 0 20px rgba(163, 157, 147, 0.4),
                -2px 0 8px rgba(255, 255, 255, 0.3);
    border-right: 1px solid rgba(163, 157, 147, 0.15);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid rgba(163, 157, 147, 0.2);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text-primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow:
        1px 1px 2px rgba(255, 255, 255, 0.6),
        -1px -1px 2px rgba(163, 157, 147, 0.3);
    position: relative;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-5) var(--space-4);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-3);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: 16px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: var(--space-2);
    position: relative;
}

.nav-link:hover {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-neu-sm);
}

.nav-link.active {
    background: var(--color-bg-card);
    color: var(--color-accent);
    font-weight: 600;
    box-shadow: var(--shadow-neu-inset);
}

.nav-link.active svg {
    color: var(--color-accent);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
}

.nav-link:hover svg {
    color: var(--color-text-primary);
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(163, 157, 147, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-bg-card);
    border-radius: 16px;
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-neu-inset);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--color-primary-light), var(--color-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 3px 3px 6px var(--neu-shadow-dark),
                -3px -3px 6px var(--neu-shadow-light);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-email {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-signout {
    width: 100%;
    padding: var(--space-3);
    background: var(--color-bg-card);
    border: none;
    border-radius: 16px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-neu-sm);
    position: relative;
    overflow: hidden;
}

.btn-signout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 16px 16px 0 0;
    pointer-events: none;
}

.btn-signout:hover {
    color: var(--color-error);
    transform: translateY(-1px);
    box-shadow: var(--shadow-neu);
}

.btn-signout:active {
    transform: translateY(0);
    box-shadow: var(--shadow-neu-inset);
}

/* Main Content - Centered with top padding for header */
.main-content {
    flex: 1;
    margin-left: auto;
    margin-right: auto;
    margin-top: 70px;
    padding: var(--space-8);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: calc(100vh - 70px);
    width: 100%;
    max-width: 1400px; /* Center content with max-width */
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header-content {
    flex: 1;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.03em;
}

.page-description {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.page-header-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.page-header-actions .btn-icon {
    flex: 0 0 auto; /* Don't grow or shrink */
    white-space: nowrap; /* Keep text on one line */
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    padding: var(--space-1);
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.tab-nav-item {
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.tab-nav-item:hover {
    color: var(--color-text-primary);
    background: var(--color-gray-100);
}

.tab-nav-item.active {
    background: var(--color-accent);
    color: white;
}

/* Cards - iOS-matched neomorphic raised effect */
.card {
    background: var(--color-bg-card);
    border-radius: 20px;
    padding: var(--space-6);
    box-shadow: 8px 8px 16px var(--neu-shadow-dark),
                -8px -8px 16px var(--neu-shadow-light);
    margin-bottom: var(--space-6);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Subtle top-left highlight for 3D effect */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 20px 20px 0 0;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 10px 10px 20px var(--neu-shadow-dark),
                -10px -10px 20px var(--neu-shadow-light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.card-body {
    color: var(--color-text-secondary);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Neumorphic Buttons - Pill-shaped design with iOS-matched 3D effect */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: 24px; /* More rounded, pill-shaped */
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

/* Highlight gradient overlay for 3D effect */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 24px 24px 0 0;
    pointer-events: none;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    box-shadow: 8px 8px 16px var(--neu-shadow-dark),
                -8px -8px 16px var(--neu-shadow-light);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 10px 10px 20px var(--neu-shadow-dark),
                -10px -10px 20px var(--neu-shadow-light);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: inset 6px 6px 12px rgba(50, 50, 50, 0.4),
                inset -6px -6px 12px rgba(130, 130, 130, 0.3);
}

.btn-primary:active::before {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
}

.btn-secondary {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    box-shadow: 8px 8px 16px var(--neu-shadow-dark),
                -8px -8px 16px var(--neu-shadow-light);
}

.btn-secondary::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
}

.btn-secondary:hover {
    box-shadow: 10px 10px 20px var(--neu-shadow-dark),
                -10px -10px 20px var(--neu-shadow-light);
    transform: translateY(-2px);
}

.btn-secondary:active {
    box-shadow: inset 6px 6px 12px rgba(163, 157, 147, 0.25),
                inset -6px -6px 12px rgba(255, 255, 255, 0.7);
    transform: translateY(1px);
}

.btn-secondary:active::before {
    background: linear-gradient(180deg, rgba(163, 157, 147, 0.1) 0%, rgba(74, 74, 74, 0) 100%);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg-main);
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-gray-300);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-gray-300);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 45, 45, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    position: relative;
}

/* Larger modal for card details */
.modal.modal-lg,
.modal:has(.card-detail-view) {
    max-width: 700px;
}

/* Neomorphic close button */
.modal-close-neo {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--color-bg-main);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-neu-sm);
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-neo:hover {
    box-shadow: var(--shadow-neu-inset);
    color: var(--color-text-primary);
}

.modal-close-neo:active {
    transform: scale(0.95);
}

.modal-header {
    text-align: center;
    margin-bottom: var(--space-6);
    padding-right: 50px; /* Space for neomorphic close button */
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.modal-description {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.modal-actions .btn {
    flex: 1;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(122, 130, 101, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(212, 165, 116, 0.15);
    color: var(--color-warning);
}

.badge-error {
    background: rgba(197, 119, 109, 0.15);
    color: var(--color-error);
}

.badge-info {
    background: rgba(107, 138, 157, 0.15);
    color: var(--color-info);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Responsive */
/* ==========================================
   RESPONSIVE DESIGN - Mobile First Approach
   ========================================== */

/* Large Desktop: 1440px+ (3-4 columns, spacious layout) */
@media (min-width: 1440px) {
    .main-content {
        padding: var(--space-8);
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
    }

    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cards-grid {
        gap: var(--space-8);
    }
}

/* Desktop & Tablet: 768px+ (sidebar always visible) */
@media (min-width: 768px) {
    .top-header {
        display: none;
    }

    .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
    }

    .main-content {
        margin-left: 280px;
        margin-right: 0;
        margin-top: 0;
        min-height: 100vh;
        max-width: none;
        width: auto;
    }
}

/* Desktop: 1024px - 1439px (2-3 columns) */
@media (min-width: 1024px) and (max-width: 1439px) {
    .main-content {
        padding: var(--space-6);
    }

    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet: 768px - 1023px (1-2 columns) */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-content {
        padding: var(--space-5);
    }

    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cards-grid {
        gap: var(--space-5);
    }

    .page-title {
        font-size: 1.75rem;
    }
}

/* Mobile: 768px and below (single column, hide sidebar) */
@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 24px rgba(163, 157, 147, 0.5),
                    -2px 0 8px rgba(255, 255, 255, 0.3);
    }

    .main-content {
        margin-left: 0;
        padding: var(--space-4);
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .top-header {
        padding: 0 var(--space-4);
    }

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

    .cards-grid {
        gap: var(--space-4);
    }

    .page-header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .page-header-actions {
        width: auto;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .page-header-actions .btn {
        width: auto;
    }

    .page-header-actions .btn-icon {
        width: auto;
    }
}

/* Small Mobile: 480px and below (compact layout) */
@media (max-width: 480px) {
    .main-content {
        padding: var(--space-3);
        max-width: 100vw;
    }

    .top-header {
        padding: 0 var(--space-3);
    }

    .header-title {
        font-size: 1.25rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .card {
        padding: var(--space-4);
        border-radius: var(--radius-md);
    }

    .modal {
        padding: var(--space-5);
        max-width: calc(100% - 2rem);
    }

    .stats-widget {
        padding: var(--space-4);
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
}

/* Theme Toggle Switch */
.theme-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
    flex-shrink: 0;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-gray-300);
    transition: 0.3s;
    border-radius: 34px;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle input:checked + .theme-toggle-slider {
    background-color: var(--color-primary);
}

.theme-toggle input:checked + .theme-toggle-slider:before {
    transform: translateX(28px);
}

.theme-toggle:hover .theme-toggle-slider {
    opacity: 0.9;
}

/* Dark mode specific adjustments */
[data-theme="dark"] .theme-toggle-slider:before {
    background-color: var(--color-gray-900);
}
