/* ClouDrive Rich Folder View - Design System */

:root,
html[data-theme="dark"],
body[data-theme="dark"],
[data-theme="dark"],
[data-bs-theme="dark"] {
    color-scheme: dark;
    --drive-bg: #0b0f19;
    --drive-surface: #111827;
    --drive-surface-subtle: #162032;
    --drive-surface-hover: #1f293d;
    --drive-border: rgba(255, 255, 255, 0.08);
    --drive-border-hover: rgba(99, 102, 241, 0.4);
    --drive-border-active: #6366f1;
    --drive-text-main: #f8fafc;
    --drive-text-muted: #94a3b8;
    --drive-text-faint: #64748b;
    --drive-header-bg: rgba(11, 15, 25, 0.85);
    --drive-footer-bg: rgba(11, 15, 25, 0.9);
    --drive-card-bg: rgba(17, 24, 39, 0.7);
    --drive-card-preview-bg: rgba(15, 23, 42, 0.85);
    --drive-primary: #6366f1;
    --drive-primary-hover: #4f46e5;
    --drive-primary-glow: rgba(99, 102, 241, 0.35);
    --drive-accent: #06b6d4;
    --drive-accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --drive-glass-backdrop: blur(16px);
    --drive-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --drive-modal-bg: #111827;
    --bs-body-bg: #0b0f19;
    --bs-body-color: #f8fafc;
}

html[data-theme="light"],
body[data-theme="light"],
[data-theme="light"],
[data-bs-theme="light"] {
    color-scheme: light;
    --drive-bg: #f8fafc;
    --drive-surface: #ffffff;
    --drive-surface-subtle: #f1f5f9;
    --drive-surface-hover: #e2e8f0;
    --drive-border: rgba(0, 0, 0, 0.08);
    --drive-border-hover: rgba(99, 102, 241, 0.4);
    --drive-border-active: #6366f1;
    --drive-text-main: #0f172a;
    --drive-text-muted: #64748b;
    --drive-text-faint: #94a3b8;
    --drive-header-bg: rgba(248, 250, 252, 0.88);
    --drive-footer-bg: rgba(248, 250, 252, 0.92);
    --drive-card-bg: #ffffff;
    --drive-card-preview-bg: #f1f5f9;
    --drive-primary: #4f46e5;
    --drive-primary-hover: #4338ca;
    --drive-primary-glow: rgba(79, 70, 229, 0.25);
    --drive-accent: #0284c7;
    --drive-accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0284c7 100%);
    --drive-glass-backdrop: blur(16px);
    --drive-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --drive-modal-bg: #ffffff;
    --bs-body-bg: #f8fafc;
    --bs-body-color: #0f172a;
}

/* Base Viewport & Shell */
.drive-viewport {
    height: 100vh;
    max-height: 100vh;
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--drive-bg);
    color: var(--drive-text-main);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background-color 0.25s ease, color 0.25s ease;
    position: relative;
}

/* Top Bar */
.drive-topbar {
    position: relative;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0rem;
    background: var(--drive-header-bg);
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    border-bottom: 1px solid var(--drive-border);
    z-index: 40;
    user-select: none;
}

/* Left Section: Biscuit Menu + Breadcrumbs */
.drive-topbar-left {
    display: flex;
    align-items: center;
    gap: 0 rem;
}

/* Classic Biscuit / Menu Button */
.drive-biscuit-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--drive-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drive-biscuit-btn:hover {
    background: var(--drive-surface-subtle);
    border-color: var(--drive-border-hover);
    color: var(--drive-primary);
    transform: translateY(-1px);
}

.drive-biscuit-btn:active {
    transform: translateY(0);
}

.drive-brand-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.drive-brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--drive-accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.drive-path-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--drive-text-muted);
}

.drive-path-breadcrumb .active-crumb {
    color: var(--drive-text-main);
    font-weight: 600;
}

/* Right Section: Icon Row */
.drive-topbar-right {
    display: flex;
    align-items: center;
    gap: 0rem;
}

.drive-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--drive-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.drive-icon-btn:hover {
    color: var(--drive-text-main);
    background: var(--drive-surface-subtle);
    border-color: var(--drive-border);
    transform: translateY(-1px);
}

.drive-icon-btn:active {
    transform: translateY(0);
}

.drive-icon-btn.active {
    color: var(--drive-primary);
    background: var(--drive-surface-subtle);
    border-color: var(--drive-border-hover);
}

/* User Avatar Icon Button */
.drive-user-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--drive-border);
    background: var(--drive-accent-gradient);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--drive-primary-glow);
}

.drive-user-btn:hover {
    border-color: var(--drive-primary);
    transform: scale(1.05);
}

.drive-user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* User Dropdown Menu */
.drive-user-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: transparent;
}

.drive-user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 999;
    padding: 0.5rem 0;
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    animation: scaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.drive-user-dropdown-header {
    padding: 0.65rem 1rem 0.5rem;
    font-size: 0.85rem;
}

.drive-user-dropdown-divider {
    height: 1px;
    background: var(--drive-border);
    margin: 0.35rem 0;
}

.drive-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    color: var(--drive-text-main);
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.drive-user-dropdown-item:hover {
    background: var(--drive-surface-hover);
    color: var(--drive-primary);
}

.drive-user-dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444 !important;
}

/* Language Dropdown Menu */
.drive-lang-menu-wrapper {
    position: relative;
}

.drive-badge-lang {
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    padding: 1.5px 3.5px;
    border-radius: 4px;
    background: var(--drive-primary);
    color: #ffffff;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.drive-lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 210px;
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 14px;
    box-shadow: var(--drive-shadow);
    z-index: 999;
    padding: 0.4rem;
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    animation: scaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.drive-tasks-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 330px;
    max-width: 90vw;
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 14px;
    box-shadow: var(--drive-shadow);
    z-index: 999;
    padding: 0.6rem;
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    animation: scaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.drive-tasks-dropdown-header {
    padding: 0.35rem 0.6rem 0.5rem;
    border-bottom: 1px solid var(--drive-border);
    margin-bottom: 0.5rem;
    color: var(--drive-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.drive-tasks-dropdown-list {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.drive-lang-dropdown-header {
    padding: 0.4rem 0.6rem 0.45rem;
    border-bottom: 1px solid var(--drive-border);
    margin-bottom: 0.3rem;
    color: var(--drive-text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.drive-lang-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--drive-text-main);
    text-align: left;
    transition: all 0.15s ease;
    cursor: pointer;
    font-size: 0.85rem;
}

.drive-lang-dropdown-item:hover {
    background: var(--drive-surface-hover);
    color: var(--drive-primary);
}

.drive-lang-dropdown-item.active {
    background: var(--drive-surface-subtle);
    font-weight: 600;
}

.drive-lang-flag {
    font-size: 1.15rem;
    line-height: 1;
}

.drive-lang-info {
    display: flex;
    flex-direction: column;
}

.drive-lang-name {
    font-size: 0.85rem;
    line-height: 1.2;
}

.drive-lang-native {
    font-size: 0.72rem;
    color: var(--drive-text-muted);
}

/* Quick Search Input Popover in Topbar */
.drive-search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.drive-search-input-box {
    display: flex;
    align-items: center;
    background: var(--drive-surface-subtle);
    border: 1px solid var(--drive-border);
    border-radius: 8px;
    padding: 0.25rem 0.65rem;
    width: 180px;
    transition: all 0.2s ease;
}

.drive-search-input-box:focus-within {
    width: 240px;
    border-color: var(--drive-primary);
    box-shadow: 0 0 0 2px var(--drive-primary-glow);
}

.drive-search-input-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--drive-text-main);
    font-size: 0.825rem;
    width: 100%;
    margin-left: 0.4rem;
}

.drive-search-input-box input::placeholder {
    color: var(--drive-text-faint);
}

/* Sub-bar (Row 2): Contextual Action & Filter Bar */
.drive-subbar {
    position: relative;
    min-height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 1rem;
    background: var(--drive-surface-subtle);
    border-bottom: 1px solid var(--drive-border);
    z-index: 35;
    animation: subbarSlideDown 0.18s ease-out;
}

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

.drive-subbar-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.drive-subbar-chip {
    font-size: 0.78rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.drive-subbar-search {
    display: flex;
    align-items: center;
    background: var(--drive-surface);
    border: 1.5px solid var(--drive-primary);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    gap: 0.45rem;
    width: 320px;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 2px var(--drive-primary-glow);
    transition: all 0.2s ease;
    margin-left: auto;
}

.drive-subbar-search:focus-within {
    border-color: var(--drive-primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12), 0 0 0 3px var(--drive-primary-glow);
}

.drive-subbar-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--drive-text-main);
    font-size: 0.85rem;
    width: 100%;
    flex-grow: 1;
}

.drive-subbar-search-input::placeholder {
    color: var(--drive-text-faint);
}

@media (max-width: 768px) {
    .drive-subbar {
        flex-wrap: nowrap;
        padding: 0.35rem 0.6rem;
        gap: 0.5rem;
        min-height: 40px;
    }

    .drive-subbar-filters {
        flex-shrink: 0;
        width: auto;
    }

    .drive-subbar-search {
        flex: 1;
        min-width: 0;
        width: auto;
        margin-left: 0;
    }

    .drive-subbar-chip {
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    .drive-subbar {
        flex-wrap: nowrap;
        padding: 0.25rem 0.4rem;
        gap: 0.35rem;
        min-height: 38px;
    }

    .drive-subbar-filters {
        flex-shrink: 0;
        width: auto;
    }

    .drive-subbar-search {
        flex: 1;
        min-width: 0;
        width: auto;
        margin-left: 0;
        padding: 0.2rem 0.45rem;
        gap: 0.3rem;
    }

    .drive-subbar-chip {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem !important;
        white-space: nowrap;
    }

    .drive-subbar-search-input {
        font-size: 0.8rem;
    }
}

/* Main Area - Folder Rich Grid */
.drive-main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--drive-border-hover) transparent;
}

.drive-main-content::-webkit-scrollbar {
    width: 6px;
}

.drive-main-content::-webkit-scrollbar-track {
    background: transparent;
}

.drive-main-content::-webkit-scrollbar-thumb {
    background: var(--drive-border);
    border-radius: 4px;
}

.drive-main-content::-webkit-scrollbar-thumb:hover {
    background: var(--drive-border-hover);
}

/* Responsive Grid System:
   - Big screens: 4 columns (yielding 3 rows of 4 elements = 12 elements per page)
   - Medium screens: 3 columns
   - Small screens (mobile): 1 column */
.drive-folder-grid {
    display: grid;
    gap: 1.15rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
}

@media (max-width: 991.98px) {
    .drive-folder-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .drive-folder-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.85rem;
    }
}

/* File Card - Mac/PC Folder Gallery Look */
.drive-card {
    background: var(--drive-card-bg);
    border: 1px solid var(--drive-border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 220px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .drive-card {
        transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
    }
    .drive-card:hover {
        transform: translateY(-4px);
        border-color: var(--drive-border-hover);
        box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--drive-border-hover);
    }
}

.drive-card.selected {
    /* Rimosso bordo blu / glow su selezione */
    border-color: var(--drive-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.drive-card:focus,
.drive-card:focus-visible,
.drive-card:active {
    outline: none !important;
}

/* Card Visual / Thumbnail Section */
.drive-card-preview {
    flex: 1;
    background: var(--drive-card-preview-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
    position: relative;
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.drive-card-preview img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .drive-card-preview img {
        transition: transform 0.3s ease;
    }
    .drive-card:hover .drive-card-preview img {
        transform: scale(1.04);
    }
}

/* Video Play Overlay */
.drive-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.2s ease;
    pointer-events: none;
}

.drive-card:hover .drive-video-overlay {
    background: rgba(0, 0, 0, 0.15);
}

.drive-play-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    transition: background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .drive-play-badge {
        transition: transform 0.2s ease, background 0.2s ease;
    }
    .drive-card:hover .drive-play-badge {
        transform: scale(1.1);
        background: var(--drive-primary);
    }
}

.drive-duration-pill {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    backdrop-filter: blur(4px);
}

/* Non-Graphic Files: Big Expressive Icon Layout */
.drive-file-icon-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.drive-file-icon-symbol {
    font-size: 3.2rem;
    line-height: 1;
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .drive-file-icon-symbol {
        transition: transform 0.25s ease;
    }
    .drive-card:hover .drive-file-icon-symbol {
        transform: scale(1.08);
    }
}

.drive-file-type-pill {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 6px;
}

/* File type thematic colors */
.color-pdf {
    color: #ef4444;
}
.pill-pdf {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.color-word {
    color: #3b82f6;
}
.pill-word {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.color-excel {
    color: #10b981;
}
.pill-excel {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.color-audio {
    color: #a855f7;
}
.pill-audio {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.color-archive {
    color: #f59e0b;
}
.pill-archive {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.color-code {
    color: #06b6d4;
}
.pill-code {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Card Bottom Info Section */
.drive-card-bottom {
    padding: 0.35rem 0.65rem 0.25rem;
    background: var(--drive-surface);
    border-top: 1px solid var(--drive-border);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0.18rem;
    height: 54px;
    min-height: 54px;
    max-height: 54px;
    overflow: hidden;
    position: relative;
}

.drive-card-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--drive-text-main);
    line-height: 1.25;
    margin: 0;
    padding: 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile: full title overlay (shown by tapping the title, closed by tapping outside) */
.drive-card-title-overlay {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: calc(100% + 4px);
    padding: 6px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--drive-text-main);
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    word-break: break-word;
    white-space: normal;
    z-index: 999;
    animation: driveDropdownFade 0.15s ease-out;
}

.drive-card-title-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: transparent;
}

.drive-card.title-open {
    z-index: 100 !important;
    overflow: visible !important;
}

.drive-card.title-open .drive-card-bottom {
    overflow: visible;
}

.drive-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--drive-text-muted);
    line-height: 1.2;
    flex-shrink: 0;
}

.drive-card.menu-open {
    z-index: 100 !important;
    overflow: visible !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.drive-card.menu-open .drive-card-preview {
    overflow: hidden !important;
    border-top-left-radius: 13px;
    border-top-right-radius: 13px;
}

/* Card Menu Container & Button (Top Right) */
.drive-card-menu-container {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 40;
    pointer-events: auto;
}

.drive-card-menu-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    opacity: 0.85;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    pointer-events: auto;
}

.drive-card-menu-btn i {
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .drive-card:hover .drive-card-menu-btn,
    .drive-card-menu-btn.active {
        opacity: 1;
    }

    .drive-card-menu-btn:hover,
    .drive-card-menu-btn.active {
        background: var(--drive-primary);
        border-color: var(--drive-primary);
        color: #ffffff;
        opacity: 1;
    }
}

/* Card Menu Dropdown */
.drive-card-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 210px;
    width: max-content;
    max-width: 280px;
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 6px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: driveDropdownFade 0.15s ease-out;
}

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

.drive-card-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--drive-text-main);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.drive-card-dropdown-item:hover {
    background: var(--drive-surface-subtle);
}

.drive-card-dropdown-divider {
    height: 1px;
    background: var(--drive-border);
    margin: 3px 0;
}

.drive-card-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: transparent;
    cursor: pointer;
    touch-action: auto;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile-only elements (e.g. "Visualizza/esegui" menu item) */
.drive-mobile-only {
    display: none !important;
}

/* Mobile & Touch: keep in sync with MobileMediaQuery in Home.razor.cs */
@media (max-width: 991.98px), (hover: none), (pointer: coarse) {
    .drive-mobile-only {
        display: flex !important;
    }

    .drive-card-menu-container {
        top: 6px;
        right: 6px;
        z-index: 40;
    }

    /* 3-dots menu: always visible, generous direct touch size (38x38px), no backdrop-filter to prevent touch hit-test bugs over images on Android */
    .drive-card-menu-btn {
        opacity: 1 !important;
        width: 38px;
        height: 38px;
        border-radius: 8px;
        background: rgba(15, 23, 42, 0.88) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: 1px solid rgba(255, 255, 255, 0.35) !important;
        color: #ffffff !important;
        font-size: 1.15rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        pointer-events: auto !important;
        touch-action: manipulation;
    }

    .drive-card-menu-btn.active {
        background: var(--drive-primary) !important;
        border-color: var(--drive-primary) !important;
    }

    /* Rimosso categoricamente ogni bordo blu/selezione da tile su mobile */
    .drive-card.selected {
        border-color: var(--drive-border) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    }

    /* Blocco categorico di ogni animazione/zoom/movimento su card e preview */
    .drive-card,
    .drive-card:hover,
    .drive-card:active {
        transform: none !important;
    }

    .drive-card-preview img,
    .drive-card:hover .drive-card-preview img,
    .drive-card:active .drive-card-preview img {
        transform: none !important;
        transition: none !important;
    }

    .drive-file-icon-symbol,
    .drive-card:hover .drive-file-icon-symbol,
    .drive-card:active .drive-file-icon-symbol {
        transform: none !important;
        transition: none !important;
    }

    .drive-play-badge,
    .drive-card:hover .drive-play-badge,
    .drive-card:active .drive-play-badge {
        transform: none !important;
        transition: none !important;
    }

    .drive-card-title {
        cursor: pointer;
    }
}

/* Bottom Bar - Fixed Classic Record Scrolling */
.drive-bottombar {
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    flex-shrink: 0;
    background: var(--drive-footer-bg);
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    border-top: 1px solid var(--drive-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    position: relative;
    z-index: 40;
    user-select: none;
}

.drive-pager-container {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--drive-surface-subtle);
    border: 1px solid var(--drive-border);
    padding: 0.3rem 0.85rem;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.drive-pager-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--drive-border);
    background: var(--drive-surface);
    color: var(--drive-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drive-pager-btn:hover:not(:disabled) {
    background: var(--drive-primary);
    border-color: var(--drive-primary);
    color: #ffffff;
    transform: scale(1.08);
}

.drive-pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.drive-pager-label {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--drive-text-muted);
    padding: 0 0.5rem;
    white-space: nowrap;
}

.drive-pager-label strong {
    color: var(--drive-text-main);
    font-weight: 700;
}

/* Floating Upload (+) Action Button & Speed-Dial Menu */
.drive-fab-upload {
    position: fixed;
    bottom: 4px;
    right: 10px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--drive-accent-gradient);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 25px -4px var(--drive-primary-glow), 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.drive-fab-upload:hover {
    transform: scale(1.12);
    box-shadow: 0 12px 30px -2px var(--drive-primary-glow), 0 6px 16px rgba(0, 0, 0, 0.4);
    color: #ffffff;
}

.drive-fab-upload:active {
    transform: scale(0.96);
}

.drive-fab-upload.active {
    background: var(--drive-surface-subtle);
    border-color: var(--drive-border);
    color: var(--drive-text-main);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.drive-fab-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: transparent;
}

.drive-fab-menu {
    position: fixed;
    bottom: 68px;
    right: 20px;
    width: 260px;
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
    padding: 0.5rem;
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: fabScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fabScaleIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.drive-fab-menu-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--drive-text-main);
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.drive-fab-menu-item:hover {
    background: var(--drive-surface-hover);
    transform: translateX(2px);
}

.drive-fab-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.drive-fab-menu-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.drive-fab-menu-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--drive-text-main);
    line-height: 1.2;
}

.drive-fab-menu-desc {
    font-size: 0.72rem;
    color: var(--drive-text-muted);
    line-height: 1.2;
    margin-top: 2px;
}

/* Research Panel (Slide-over Offcanvas Drawer) */
.drive-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.drive-panel-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.drive-research-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 420px;
    max-width: 92vw;
    background: var(--drive-surface);
    border-right: 1px solid var(--drive-border);
    box-shadow: none;
    visibility: hidden;
    pointer-events: none;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease, box-shadow 0.28s ease;
    display: flex;
    flex-direction: column;
}

.drive-research-panel.open {
    transform: translateX(0);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.4);
    visibility: visible;
    pointer-events: auto;
}

.drive-panel-header {
    height: 60px;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--drive-border);
    background: var(--drive-surface-subtle);
}

.drive-panel-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--drive-text-main);
    margin: 0;
}

.drive-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.drive-empty-panel-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--drive-text-muted);
    padding: 2rem 1rem;
}

.drive-empty-panel-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--drive-surface-subtle);
    border: 1px solid var(--drive-border);
    color: var(--drive-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.25rem;
}

/* Searchable Combo & Metadata Research Panel Styles */
.searchable-combo-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: transparent;
}

.searchable-combo-item {
    transition: background 0.15s ease, border-color 0.15s ease;
}

.searchable-combo-item:hover {
    background: var(--drive-surface-subtle) !important;
}

.searchable-combo-item.selected {
    background: var(--drive-primary-subtle, rgba(13, 110, 253, 0.12)) !important;
}

.drive-research-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--drive-text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.drive-research-field {
    margin-bottom: 0.85rem;
}

.drive-research-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--drive-text-main);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.drive-research-weight-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: var(--drive-surface-subtle);
    border: 1px solid var(--drive-border);
    color: var(--drive-text-muted);
    font-weight: 600;
    margin-left: auto;
}

/* Modals (Upload & Details) */
.drive-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    animation: fadeIn 0.2s ease;
    overflow-y: auto;
}

.drive-modal-box {
    background: var(--drive-modal-bg);
    color: var(--drive-text-main);
    border: 1px solid var(--drive-border);
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 2.5rem);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

.drive-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--drive-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--drive-surface-subtle);
    color: var(--drive-text-main);
    flex-shrink: 0;
}

.drive-modal-body {
    padding: 1.25rem;
    color: var(--drive-text-main);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--drive-border-hover) transparent;
}

.drive-modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--drive-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--drive-surface-subtle);
    color: var(--drive-text-main);
    flex-shrink: 0;
}

/* Close button theme styling */
[data-theme="dark"] .btn-close,
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%);
}

[data-theme="light"] .btn-close,
[data-bs-theme="light"] .btn-close {
    filter: none;
}

.drive-upload-dropzone {
    border: 2px dashed var(--drive-border-hover);
    border-radius: 12px;
    background: var(--drive-surface-subtle);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drive-upload-dropzone:hover {
    border-color: var(--drive-primary);
    background: var(--drive-surface-hover);
}

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

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Account Page Styles */
.drive-account-main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 2.25rem 1.25rem 4.5rem 1.25rem !important;
    min-height: 0;
    flex: 1;
}

.drive-account-card {
    background: var(--drive-card-bg);
    border: 1px solid var(--drive-border);
    border-radius: 20px;
    padding: 2.25rem;
    width: 100%;
    max-width: 680px;
    box-shadow: var(--drive-shadow);
    backdrop-filter: var(--drive-glass-backdrop);
    -webkit-backdrop-filter: var(--drive-glass-backdrop);
    margin: 0 auto;
}

.drive-account-card-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--drive-border);
}

.drive-account-avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.drive-account-avatar-circle {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--drive-accent-gradient);
    border: 3px solid var(--drive-border);
    box-shadow: 0 4px 15px var(--drive-primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
}

.drive-account-avatar-circle:hover {
    border-color: var(--drive-primary);
    transform: scale(1.03);
}

.drive-account-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drive-account-avatar-initials {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.05em;
}

.drive-account-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.drive-account-avatar-circle:hover .drive-account-avatar-overlay {
    opacity: 1;
}

.drive-input {
    background-color: var(--drive-surface-subtle) !important;
    border: 1px solid var(--drive-border) !important;
    color: var(--drive-text-main) !important;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.drive-input:focus {
    background-color: var(--drive-surface) !important;
    border-color: var(--drive-primary) !important;
    box-shadow: 0 0 0 3px var(--drive-primary-glow) !important;
    color: var(--drive-text-main) !important;
}

.drive-input::placeholder {
    color: var(--drive-text-faint) !important;
    opacity: 0.85;
}

.drive-input.disabled-email,
.drive-input:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    background-color: var(--drive-surface) !important;
}

select.drive-input option {
    background-color: var(--drive-surface);
    color: var(--drive-text-main);
}

.input-group > .btn-outline-secondary {
    border-color: var(--drive-border) !important;
    color: var(--drive-text-muted) !important;
    background-color: var(--drive-surface-subtle) !important;
}

.input-group > .btn-outline-secondary:hover {
    border-color: var(--drive-primary) !important;
    color: var(--drive-text-main) !important;
    background-color: var(--drive-surface-hover) !important;
}

/* Responsive Topbar & Small Screens Space Optimization */
@media (max-width: 768px) {
    .drive-topbar {
        padding: 0 0.75rem;
    }

    .drive-topbar-left {
        gap: 0.5rem;
    }

    .drive-topbar-right {
        gap: 0.2rem;
    }

    .drive-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 1.05rem;
    }

    .drive-user-btn {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }

    .drive-biscuit-btn {
        width: 34px;
        height: 34px;
        font-size: 1.05rem;
    }

    .drive-search-input-box {
        width: 130px;
        padding: 0.2rem 0.45rem;
    }

    .drive-search-input-box:focus-within {
        width: 160px;
    }

    .drive-account-main {
        padding: 1.25rem 0.75rem 3.5rem 0.75rem !important;
    }

    .drive-account-card {
        padding: 1.5rem 1.15rem;
        border-radius: 16px;
    }
}

@media (max-width: 576px) {
    .drive-topbar {
        height: 52px;
        min-height: 52px;
        max-height: 52px;
        padding: 0 0.35rem;
    }

    .drive-topbar-left {
        gap: 0.3rem;
    }

    .drive-brand-pill {
        gap: 0.35rem;
        font-size: 0.85rem;
    }

    .drive-brand-icon {
        width: 26px;
        height: 26px;
        font-size: 0.82rem;
        border-radius: 6px;
    }

    .drive-topbar-right {
        gap: 0.08rem;
    }

    .drive-icon-btn {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
        border-radius: 7px;
    }

    .drive-user-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .drive-biscuit-btn {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
        border-radius: 7px;
    }

    .drive-search-input-box {
        width: 100px;
        padding: 0.15rem 0.35rem;
    }

    .drive-search-input-box:focus-within {
        width: 120px;
    }

    .drive-search-input-box input {
        font-size: 0.75rem;
        margin-left: 0.25rem;
    }

    /* Bottom Bar optimization on small screens */
    .drive-bottombar {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        padding: 0 0.35rem;
    }

    .drive-pager-container {
        gap: 0.35rem;
        padding: 0.2rem 0.55rem;
    }

    .drive-pager-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .drive-pager-label {
        font-size: 0.72rem;
        padding: 0 0.2rem;
    }
}

@media (max-width: 380px) {
    .drive-topbar {
        padding: 0 0.2rem;
    }

    .drive-topbar-right {
        gap: 0.04rem;
    }

    .drive-icon-btn {
        width: 28px;
        height: 28px;
        font-size: 0.88rem;
    }

    .drive-user-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .drive-brand-pill span {
        display: none;
    }
}

/* ========================================================
   Post-it: Scheda Elemento (Sticky Note Modal)
   ======================================================== */
.drive-postit-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    animation: fadeIn 0.18s ease-out;
    overflow-y: auto;
}

.drive-postit-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 2.5rem);
    background: linear-gradient(135deg, #fffbeb 0%, #fef08a 40%, #fde047 100%);
    color: #1e293b;
    border-radius: 4px 4px 22px 4px;
    box-shadow: 
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 8px 18px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: rotate(-0.75deg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: postitDrop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-bottom: 2px solid #eab308;
    border-right: 2px solid #ca8a04;
    margin: auto;
}

@keyframes postitDrop {
    0% {
        opacity: 0;
        transform: scale(0.85) rotate(-3deg) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(-0.75deg) translateY(0);
    }
}

.drive-postit-tape {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 22px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    border-left: 2px dashed rgba(0,0,0,0.08);
    border-right: 2px dashed rgba(0,0,0,0.08);
    z-index: 10;
}

.drive-postit-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset -1px -1px 2px rgba(0,0,0,0.4), inset 1px 1px 2px rgba(255,255,255,0.7);
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11;
}

.drive-postit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem 0.6rem 1.25rem;
    border-bottom: 1px dashed rgba(161, 98, 7, 0.3);
    user-select: none;
    flex-shrink: 0;
}

.drive-postit-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.05rem;
    color: #854d0e;
    letter-spacing: -0.01em;
}

.drive-postit-close-btn {
    background: transparent;
    border: none;
    color: #854d0e;
    font-size: 1.15rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.drive-postit-close-btn:hover {
    background: rgba(161, 98, 7, 0.15);
    color: #713f12;
}

.drive-postit-body {
    padding: 0.9rem 1.25rem 1.25rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(161, 98, 7, 0.4) transparent;
}

.drive-postit-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #92400e;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.drive-postit-info-table {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(161, 98, 7, 0.2);
}

.drive-postit-info-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drive-postit-info-item.full-width {
    grid-column: span 2;
}

.drive-postit-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #78350f;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.drive-postit-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1c1917;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drive-postit-media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.drive-postit-media-badge {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(161, 98, 7, 0.22);
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.drive-postit-media-icon {
    font-size: 1.15rem;
    color: #b45309;
    flex-shrink: 0;
}

.drive-postit-media-meta {
    overflow: hidden;
}

.drive-postit-media-meta-lbl {
    font-size: 0.65rem;
    color: #92400e;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1.1;
}

.drive-postit-media-meta-val {
    font-size: 0.82rem;
    font-weight: 800;
    color: #1c1917;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.drive-postit-non-media {
    background: rgba(255, 255, 255, 0.4);
    border: 1px dashed rgba(161, 98, 7, 0.25);
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    font-size: 0.78rem;
    color: #78350f;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drive-postit-preview-box {
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    max-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(161, 98, 7, 0.25);
}

.drive-postit-preview-box img {
    max-height: 140px;
    width: 100%;
    object-fit: cover;
}

.drive-postit-corner-fold {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, transparent 50%, rgba(180, 83, 9, 0.25) 50%, rgba(202, 138, 4, 0.45) 100%);
    pointer-events: none;
    border-top-left-radius: 4px;
}

/* Post Modal & Rich Editor Styles */
.drive-post-modal-box {
    max-width: 960px !important;
    width: 94vw !important;
    height: 88vh !important;
    max-height: 88vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.drive-post-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.drive-post-editor-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--drive-surface);
}

.drive-post-title-input {
    border: none;
    border-bottom: 1px solid var(--drive-border);
    border-radius: 0;
    padding: 0.75rem 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    background: transparent;
    color: var(--drive-text-main);
}

.drive-post-title-input:focus {
    background: transparent;
    color: var(--drive-text-main);
    border-bottom-color: var(--drive-primary);
    box-shadow: none;
}

/* Quill Styling Integration */
.drive-post-editor-area .ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--drive-border) !important;
    background: var(--drive-surface-subtle) !important;
    padding: 8px 12px !important;
    flex-shrink: 0;
}

.drive-post-editor-area .ql-container.ql-snow {
    border: none !important;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
    font-size: 1rem;
    color: var(--drive-text-main);
    background: var(--drive-surface);
}

.drive-post-editor-area .ql-editor {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    line-height: 1.6;
    color: var(--drive-text-main);
}

.drive-post-editor-area .ql-editor.ql-blank::before {
    color: var(--drive-text-faint) !important;
    font-style: normal;
    left: 1.25rem;
}

/* Quill Dark Theme overrides */
[data-theme="dark"] .drive-post-editor-area .ql-snow .ql-stroke,
[data-bs-theme="dark"] .drive-post-editor-area .ql-snow .ql-stroke {
    stroke: #94a3b8 !important;
}

[data-theme="dark"] .drive-post-editor-area .ql-snow .ql-fill,
[data-bs-theme="dark"] .drive-post-editor-area .ql-snow .ql-fill {
    fill: #94a3b8 !important;
}

[data-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker,
[data-bs-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker {
    color: #94a3b8 !important;
}

[data-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker-options,
[data-bs-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker-options {
    background-color: var(--drive-surface) !important;
    border-color: var(--drive-border) !important;
}

[data-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker-item:hover,
[data-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker-item.ql-selected,
[data-bs-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker-item:hover,
[data-bs-theme="dark"] .drive-post-editor-area .ql-snow .ql-picker-item.ql-selected {
    color: var(--drive-primary) !important;
}

/* Scrollable Bottom Metadata Panel */
.drive-post-meta-panel {
    max-height: 220px;
    min-height: 170px;
    overflow-y: auto;
    background: var(--drive-surface-subtle);
    border-top: 1px solid var(--drive-border);
    padding: 1rem 1.25rem;
    flex-shrink: 0;
}

.drive-post-meta-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--drive-text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Enhanced Preview Modal Styles */
.drive-preview-modal-wide {
    max-width: 860px !important;
    width: 92vw !important;
    max-height: calc(100vh - 2.5rem) !important;
    display: flex !important;
    flex-direction: column !important;
}

.drive-post-preview-box {
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 10px;
    padding: 0rem;
    max-height: 52vh;
    min-height: 150px;
    overflow-y: auto;
    line-height: 1.7;
    color: var(--drive-text-main);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.drive-post-preview-box h1,
.drive-post-preview-box h2,
.drive-post-preview-box h3,
.drive-post-preview-box h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--drive-text-main);
}

.drive-post-preview-box p {
    margin-bottom: 0.85rem;
}

.drive-post-preview-box blockquote {
    border-left: 4px solid var(--drive-primary);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    color: var(--drive-text-muted);
    background: var(--drive-surface-subtle);
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

.drive-post-preview-box pre {
    background: var(--drive-surface-subtle);
    border: 1px solid var(--drive-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
}

.drive-post-preview-box code {
    background: var(--drive-surface-subtle);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.drive-post-preview-box img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.drive-post-preview-box ul,
.drive-post-preview-box ol {
    padding-left: 1.5rem;
    margin-bottom: 0.85rem;
}

.drive-image-preview-container {
    background: #0b0f19;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 50vh;
    min-height: 200px;
    overflow: hidden;
    padding: 0.75rem;
}

.drive-video-preview-container {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 50vh;
    min-height: 200px;
    overflow: hidden;
}

/* Toast notification */
.drive-toast-notification {
    position: fixed;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--drive-surface);
    color: var(--drive-text-main);
    border: 1px solid var(--drive-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    padding: 10px 22px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    font-size: 0.88rem;
    font-weight: 600;
    animation: driveToastFadeIn 0.2s ease-out;
}

@keyframes driveToastFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 12px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ==========================================================================
   SERP (Search Engine Results Page) & Ghost Document Viewer
   ========================================================================== */
.drive-serp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding:0rem;
    animation: driveFadeIn 0.25s ease-out;
}

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

.drive-serp-header {
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.drive-serp-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(13, 110, 253, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.drive-serp-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drive-serp-item {
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.drive-serp-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    border-color: #0d6efd;
}

.drive-serp-item-top {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.drive-serp-type-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--drive-surface-subtle);
    border: 1px solid var(--drive-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    color: #0d6efd;
}

.drive-serp-doc-title {
    font-size: 1.05rem;
    color: var(--drive-text-main);
    line-height: 1.35;
}

.drive-serp-snippet {
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--drive-text-main);
    background: var(--drive-surface-subtle);
    border-radius: 8px;
    padding: 0.85rem 1.15rem;
    margin-bottom: 0.85rem;
    border-left: 3px solid #0d6efd;
    word-break: break-word;
}

.drive-serp-snippet mark,
.drive-serp-snippet mark.search-hit {
    background-color: #fde047 !important;
    color: #000000 !important;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.drive-serp-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--drive-border);
}

@media (max-width: 576px) {
    .drive-serp-container {
        padding: 0.75rem 0.5rem 3rem 0.5rem;
    }

    .drive-serp-header {
        padding: 1rem;
    }

    .drive-serp-item {
        padding: 1rem;
    }
}

/* Spinner and Animation Styles */
@keyframes driveSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    display: inline-block;
    animation: driveSpin 0.9s linear infinite;
}

.drive-toast-notification.toast-error {
    border-left: 4px solid #dc3545 !important;
    background: var(--drive-surface);
    color: var(--drive-text-main);
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.25);
}

/* SERP Toolbar & Grouped Directory View */
.drive-serp-toolbar {
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.drive-serp-group {
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.drive-serp-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.drive-serp-group-header {
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

.drive-serp-group-header:hover {
    background-color: var(--drive-surface-subtle, rgba(0, 0, 0, 0.02));
}

.drive-serp-child-item {
    background: var(--drive-surface);
    border: 1px solid var(--drive-border);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.drive-serp-child-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.08);
}


