:root {
    /* Color Palette */
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-glow: rgba(37, 99, 235, 0.15);
    --bg-gradient: #F8FAFC;
    --card-bg: #FFFFFF;
    --card-border: #E5E7EB;
    --text-color: #111827;
    --text-muted: #6B7280;
    
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;

    --sidebar-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --transition-speed: 250ms;
    --content-bg: #FFFFFF;
    --folder-bg: #F8FAFC;
    --folder-border: #E5E7EB;
    --folder-icon-color: #F59E0B; /* Yellow Gradient inspiration */
    --file-card-bg: #FFFFFF;
    --file-card-border: #E5E7EB;
}

[data-bs-theme="dark"] {
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-glow: rgba(37, 99, 235, 0.25);
    --bg-gradient: #0F172A;
    --card-bg: #1E293B;
    --card-border: #334155;
    --text-color: #F8FAFC;
    --text-muted: #94A3B8;
    --sidebar-bg: #1E293B;
    --border-color: #334155;
    --content-bg: #1E293B;
    --folder-bg: #0F172A;
    --folder-border: #334155;
    --folder-icon-color: #F59E0B;
    --file-card-bg: #1E293B;
    --file-card-border: #334155;
}

body {
    font-family: 'Inter', Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    transition: background var(--transition-speed) ease-in-out, color var(--transition-speed) ease-in-out;
    overflow-x: hidden;
}

h1 { font-size: 32px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 600; }
h3 { font-size: 20px; font-weight: 600; }
body, p { font-size: 16px; }
small, .small { font-size: 14px; }

/* Custom Buttons matching DESIGN.md */
.btn {
    border-radius: 14px !important;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    padding: 0 20px;
    transition: all var(--transition-speed) ease-in-out;
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #FFFFFF !important;
}

.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.btn-outline-secondary {
    border: 1px solid var(--border-color) !important;
    background: transparent !important;
    color: var(--text-color) !important;
}

.btn-outline-secondary:hover {
    background-color: rgba(107, 114, 128, 0.08) !important;
    border-color: var(--text-muted) !important;
}

.btn-danger {
    background-color: var(--danger-color) !important;
    border-color: var(--danger-color) !important;
    color: #FFFFFF !important;
}

.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-ghost {
    background: transparent !important;
    border: none !important;
    color: var(--text-muted) !important;
}

.btn-ghost:hover {
    background-color: rgba(107, 114, 128, 0.08) !important;
    color: var(--text-color) !important;
}

/* Glassmorphism Container */
.glass-container {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed) ease-in-out;
}

.glass-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

/* Auth Pages Styling */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
}

.auth-brand {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(45deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-control-custom {
    background: var(--folder-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 14px;
    padding: 12px 16px;
    transition: all var(--transition-speed) ease-in-out;
}

.form-control-custom:focus {
    background: var(--card-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
    color: var(--text-color);
    outline: none;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-gradient);
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all var(--transition-speed) ease-in-out;
}

.sidebar .btn-upload-new {
    border-radius: 14px !important;
    height: 44px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    background-color: var(--bg-gradient);
}

.navbar-custom {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    height: 72px;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 14px;
    margin: 4px 16px;
    font-weight: 500;
    transition: all var(--transition-speed) ease-in-out;
}

.nav-link-custom i {
    font-size: 1.25rem;
    margin-right: 12px;
}

.nav-link-custom:hover {
    background-color: rgba(107, 114, 128, 0.05) !important;
    color: var(--text-color);
}

.nav-link-custom.active {
    background-color: rgba(37, 99, 235, 0.1) !important;
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* Google Drive Content Card & Containers */
.drive-content-card {
    background-color: var(--content-bg) !important;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-speed) ease-in-out;
}

.drive-scroll-container {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
}

/* Custom Dropdown Filters */
.btn-filter-dropdown {
    font-size: 0.85rem;
    height: 38px;
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    border-radius: 10px;
    font-weight: 500;
    transition: background-color var(--transition-speed) ease-in-out, border-color var(--transition-speed) ease-in-out, box-shadow var(--transition-speed) ease-in-out;
}
.btn-filter-dropdown:hover, .btn-filter-dropdown:focus {
    background-color: rgba(107, 114, 128, 0.04) !important;
    border-color: rgba(107, 114, 128, 0.2) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* Layout Switcher capsule */
.layout-toggle-capsule {
    background-color: var(--folder-bg);
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.btn-layout-capsule {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0;
    transition: all var(--transition-speed) ease-in-out;
}

.btn-layout-capsule.active {
    background-color: var(--primary-color) !important;
    color: #FFFFFF !important;
}

/* Quick Actions Cards */
.quick-action-card {
    height: 120px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all var(--transition-speed) ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.quick-action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

/* File / Folder grid view cards */
.file-card {
    transition: all var(--transition-speed) ease-in-out;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.file-card[data-type="folder"] {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.file-card[data-type="folder"]:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.file-card[data-type="file"] {
    background: var(--file-card-bg);
    border: 1px solid var(--file-card-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.file-card[data-type="file"]:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.file-card.selected {
    background-color: rgba(37, 99, 235, 0.08) !important;
    border-color: var(--primary-color) !important;
}

.card-checkbox {
    border-color: rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.card-checkbox:checked {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-card-options {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background-color var(--transition-speed) ease-in-out;
}
.btn-card-options:hover {
    background-color: rgba(107, 114, 128, 0.08);
    color: var(--text-color);
}

.file-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.file-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    padding: 8px 0;
    display: none;
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background var(--transition-speed) ease-in-out;
    cursor: pointer;
}

.context-menu-item:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
}

.context-menu-item i {
    margin-right: 12px;
    font-size: 1.1rem;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* Drag & Drop Overlay */
.drag-drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(37, 99, 235, 0.12);
    border: 4px dashed var(--primary-color);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease-in-out;
}

.drag-drop-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.drag-drop-box {
    background: var(--card-bg);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Starred state toggle button */
.star-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--text-muted);
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.15s ease, transform 0.15s ease;
    z-index: 5;
}

.star-btn:hover {
    transform: scale(1.2);
}

.star-btn.starred {
    color: var(--warning-color) !important;
}

/* Breadcrumbs customization */
.breadcrumb-custom {
    padding: 12px 24px;
    margin: 0;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 600;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--text-color);
}

/* Storage Card Widget */
.storage-card {
    background: var(--folder-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    margin: 16px;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    z-index: 999;
    align-items: center;
    justify-content: space-around;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 0;
    min-width: 48px;
    min-height: 48px;
    justify-content: center;
}

.mobile-nav-item i {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

/* Responsive sidebar & mobile modifications */
@media (max-width: 768px) {

    /* --- Sidebar: slide-in overlay behavior --- */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 64px;
        height: calc(100vh - 64px);
        z-index: 1050;
        transition: left var(--transition-speed) ease-in-out;
    }
    .sidebar.show {
        left: 0;
    }

    /* --- Sidebar backdrop overlay --- */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 1049;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-speed) ease-in-out;
    }
    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: all;
    }

    /* --- Main content: full width, extra bottom padding for bottom nav --- */
    .main-content {
        margin-left: 0 !important;
        padding: 8px !important;
        padding-bottom: 80px !important;
    }

    /* --- Drive content card: reduce padding on mobile --- */
    .drive-content-card {
        margin: 0 !important;
        padding: 16px 12px !important;
        border-radius: 16px !important;
    }

    /* --- Bottom nav visible --- */
    .mobile-bottom-nav {
        display: flex;
    }

    /* --- Navbar: compact --- */
    .navbar-custom {
        padding: 8px 10px !important;
        height: 60px;
        gap: 6px;
    }
    .search-input-group {
        height: 36px !important;
    }
    .search-input-group input {
        font-size: 0.85rem !important;
    }

    /* --- Filter row: wrap on mobile cleanly --- */
    .filter-row-wrapper {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    .filter-controls-group {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px !important;
    }
    .btn-filter-dropdown {
        height: 36px;
        padding: 0 12px !important;
        font-size: 0.82rem;
        flex: 1;
        min-width: 120px;
    }
    .layout-toggle-capsule {
        margin-left: auto;
    }

    /* --- Custom date range: full-width row on mobile --- */
    #customDateRangeContainer {
        display: flex !important;
        width: 100%;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
    }
    #customStartDate, #customEndDate {
        flex: 1;
        height: 36px;
        font-size: 0.82rem;
        min-width: 0;
    }

    /* --- File grid: 2-column layout on mobile --- */
    #filesGridContainer {
        gap: 10px !important;
    }
    #filesGridContainer .file-item-col {
        width: calc(50% - 5px) !important;
        min-height: auto !important;
        flex-shrink: 0;
    }

    /* --- Folders already use Bootstrap col-6 which is 2-col on mobile --- */

    /* --- List view table: hide less-important columns --- */
    #filesListContainer .hide-mobile {
        display: none !important;
    }
    #filesListContainer table {
        font-size: 0.82rem;
    }
    #filesListContainer .file-name-txt {
        max-width: 140px !important;
    }

    /* --- Breadcrumb on mobile --- */
    .breadcrumb-custom {
        font-size: 0.95rem;
        padding: 6px 0;
    }

    /* --- Bulk toolbar on mobile: smaller icons --- */
    .bulk-toolbar-floating {
        left: 8px;
        right: 8px;
        padding: 4px 0;
    }
    .btn-bulk-action {
        width: 36px !important;
        height: 36px !important;
    }

    /* --- Quick action cards: 2x2 grid --- */
    .quick-action-card {
        height: 100px;
        padding: 16px !important;
    }

    /* --- Overview cards: stack vertically --- */
    .overview-card {
        padding: 16px !important;
    }

    /* --- Home drag-drop zone: compact on mobile --- */
    #homeDragDropZone {
        padding: 20px 12px !important;
    }
}

/* Bulk actions floating operation toolbar */
.bulk-toolbar-floating {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    transition: all var(--transition-speed) ease-in-out;
}

[data-bs-theme="dark"] .bulk-toolbar-floating {
    background: rgba(30, 41, 59, 0.85);
    border-color: var(--card-border);
}

.btn-close-selection {
    color: var(--text-color);
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-close-selection:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.btn-close-selection:focus {
    box-shadow: none;
    outline: none;
}

.btn-bulk-action {
    transition: all 0.2s ease;
    color: var(--text-color);
}

.btn-bulk-action:hover {
    background-color: rgba(37, 99, 235, 0.08) !important;
    color: var(--primary-color) !important;
    transform: scale(1.05);
}

.btn-bulk-action.btn-outline-danger:hover {
    background-color: rgba(239, 68, 68, 0.08) !important;
    color: var(--danger-color) !important;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Redesign updates matching reference screenshot */
.quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.overview-card {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    padding: 24px 20px !important;
    box-shadow: none !important;
    transition: all var(--transition-speed) ease-in-out;
}

.overview-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.04) !important;
}

.overview-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.table-file-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Custom soft background helper colors */
.bg-primary-subtle {
    background-color: rgba(37, 99, 235, 0.08) !important;
}
[data-bs-theme="dark"] .bg-primary-subtle {
    background-color: rgba(37, 99, 235, 0.15) !important;
}

.bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.08) !important;
}
[data-bs-theme="dark"] .bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

.bg-purple-subtle {
    background-color: rgba(139, 92, 246, 0.08) !important;
}
[data-bs-theme="dark"] .bg-purple-subtle {
    background-color: rgba(139, 92, 246, 0.15) !important;
}
.text-purple {
    color: #8B5CF6 !important;
}

.search-input-group {
    border: 1px solid var(--border-color) !important;
    transition: border-color var(--transition-speed) ease-in-out, box-shadow var(--transition-speed) ease-in-out;
}

.search-input-group:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 4px var(--primary-glow) !important;
    background-color: var(--card-bg) !important;
}

/* Sidebar storage card modifications */
.storage-card {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    padding: 20px !important;
    margin: 20px 16px !important;
}

.sidebar .storage-card {
    border-radius: 16px !important;
    padding: 16px !important;
}

.btn-upgrade {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    height: 40px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 0.9rem !important;
    transition: all var(--transition-speed) ease-in-out;
}

.btn-upgrade:hover {
    background-color: rgba(107, 114, 128, 0.04) !important;
    border-color: var(--text-muted) !important;
}
