.dashboard {
    display: flex;
    min-height: 100vh;
    background-color: var(--surface-dim);
}

.sidebar {
    width: 280px;
    background: var(--surface-dark);
    color: white;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.04);
}

[data-theme="dark"] .sidebar {
    background: #000000;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -0.02em;
    padding-left: 0.5rem;
}

.sidebar-nav {
    margin-top: 3.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    height: auto; /* Fixes index.css inheritance bug */
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.main-content {
    flex: 1;
    padding: 2.5rem 3.5rem;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
}

.top-bar h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--on-surface);
    margin-bottom: 0.25rem;
}

.top-bar p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--on-surface-variant);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--surface);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--outline-variant);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--outline-variant);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.stat-header span {
    font-size: 0.8rem;
    color: var(--on-surface-variant);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.stat-header i {
    color: var(--primary);
}

.usage-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--on-surface);
    line-height: 1;
    margin-bottom: 1.5rem;
}

.usage-text span {
    color: var(--primary);
}

.usage-bar {
    height: 8px;
    background: var(--outline-variant);
    border-radius: 4px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.usage-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-section {
    background: var(--surface);
    border: 2px dashed var(--outline);
    border-radius: 16px;
    padding: 4rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-section:hover, .upload-section.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-section h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    color: var(--on-surface);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.file-list {
    margin-top: 3rem;
}

.file-list h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    color: var(--on-surface);
    font-weight: 800;
}

.file-item {
    display: flex;
    align-items: center;
    background: var(--surface);
    padding: 1.25rem 1.75rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--outline-variant);
    box-shadow: var(--shadow-sm);
    gap: 1.5rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.file-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--outline);
    transform: translateY(-1px);
}

.file-preview {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface-alt);
    border: 1px solid var(--outline-variant);
}

.file-info {
    flex: 1;
}

.file-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--on-surface);
    display: block;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.85rem;
    color: var(--on-surface-variant);
    font-weight: 500;
}

.api-key-container {
    background: var(--surface-alt);
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--outline-variant);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.api-key {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: 0.05em;
}

.copy-btn {
    background: var(--surface);
    border: 1px solid var(--outline);
    color: var(--on-surface);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: rgba(37, 99, 235, 0.3);
}

.action-group {
    display: flex;
    gap: 0.5rem;
}

/* Modal CSS */
.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

/* Spin animation for upload loader */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin {
    animation: spin 1s linear infinite;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.status-badge.active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.status-badge.revoked {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Form input for modal */
.form-input {
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--outline);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
    background: var(--surface);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

thead tr {
    border-bottom: 2px solid var(--outline-variant);
    text-align: left;
    background: var(--surface-alt);
}

th {
    padding: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--outline-variant);
    color: var(--on-surface);
    font-weight: 500;
}

/* Folder Tabs */
.folder-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border: 1px solid #ebecf0;
    border-radius: 8px;
    overflow-x: auto;
}

.folder-tab {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #5e6c84;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.folder-tab:hover {
    background: #f4f5f7;
    color: #172b4d;
}

.folder-tab.active {
    background: rgba(51, 149, 255, 0.1);
    color: #3395ff;
}

.new-folder-btn {
    border: 1px dashed #c1c7d0;
    color: #3395ff;
}

.new-folder-btn:hover {
    border-color: #3395ff;
    background: rgba(51, 149, 255, 0.05);
}

/* Mobile Responsiveness */
.mobile-only-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 10000;
        width: 100%; /* Full screen overlay */
        max-width: 320px;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(10px);
    }

    .sidebar.mobile-active {
        left: 0;
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }

    .main-content {
        padding: 1.5rem;
    }

    .top-bar {
        flex-direction: row; /* Keep it row for better use of space */
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        margin-bottom: 2rem;
        padding: 0.5rem 0;
    }

    .top-bar h2 {
        font-size: 1.25rem;
    }

    .top-bar p {
        font-size: 0.85rem;
    }

    .btn-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        height: 40px;
        padding: 0 !important;
    }

    .top-bar h2 {
        font-size: 1.5rem;
    }

    .user-profile {
        width: 100%;
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }

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

    .stat-card {
        padding: 1.5rem;
    }

    .usage-text {
        font-size: 1.75rem;
    }

    .upload-section {
        padding: 2.5rem 1.5rem;
    }

    .upload-section h3 {
        font-size: 1.25rem;
    }
}

/* ===== BYOS / Storage Responsive ===== */
@media (max-width: 900px) {
    .byos-grid { grid-template-columns: 1fr !important; }
    .storage-how-grid { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 560px) {
    .storage-how-grid { grid-template-columns: 1fr !important; }
}

@keyframes ping {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.4); }
}

/* Upgrade Modal Styles */
.pro-modal-content {
    background: var(--surface) !important;
    width: 550px !important;
    max-width: 100%;
    margin: auto;
    padding: 0 !important;
    overflow: hidden;
    position: relative;
    border-radius: 20px;
}

.pro-banner {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    padding: 2.5rem 2rem;
    color: white;
    text-align: center;
    position: relative;
}

.pro-banner i.crown-bg {
    position: absolute;
    right: -20px;
    top: -20px;
    opacity: 0.1;
    transform: rotate(15deg);
}

.pro-features {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pro-feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    color: var(--on-surface);
    font-weight: 500;
}

.pro-feature-item i {
    color: #22c55e;
    flex-shrink: 0;
}

.pro-price-box {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface-alt);
    margin: 0 2rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--outline-variant);
}

.pro-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--on-surface);
    font-family: 'Space Grotesk', sans-serif;
}

.pro-price span {
    font-size: 1rem;
    color: var(--on-surface-variant);
    font-weight: 600;
}

.payment-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 2rem 2rem;
}

.btn-razorpay {
    background: #3395ff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-razorpay:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-test-payment {
    background: var(--surface-alt);
    color: var(--on-surface-variant);
    border: 1px solid var(--outline-variant);
    border-radius: 8px;
    padding: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-test-payment:hover {
    background: #f1f5f9;
}

/* Infrastructure Settings UI */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--outline-variant);
    transition: .4s;
    border-radius: 24px;
}

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

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

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

#infraCompression {
    accent-color: var(--primary);
}
