@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #ec4899;
    --bg: #f4f5fb;
    --surface: #ffffff;
    --border: #e7e8ef;
    --text: #1e2230;
    --text-muted: #8a8fa3;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(30, 34, 48, 0.05);
    --shadow: 0 4px 16px rgba(30, 34, 48, 0.06);
    --shadow-hover: 0 12px 28px rgba(99, 102, 241, 0.14);
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

* {
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

h4 {
    font-size: 1.05rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
h4 i {
    color: var(--primary);
}

a {
    color: var(--primary);
    transition: color 0.15s ease;
}

/* ---------------- Scrollbar ---------------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d6d9ee;
    border-radius: 8px;
    border: 2px solid transparent;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ---------------- Empty states ---------------- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.empty-state i {
    font-size: 2.2rem;
    color: var(--primary-light);
    display: block;
    margin-bottom: 0.5rem;
}
.empty-state p {
    margin: 0;
    font-size: 0.92rem;
}

/* ---------------- Impersonation banner ---------------- */
.impersonation-banner {
    background: var(--gradient);
    color: #fff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ---------------- Topbar ---------------- */
.app-navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}
.app-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}
.app-navbar .navbar-brand .brand-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
}
.app-navbar .btn-outline-light {
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.app-navbar .btn-outline-light:hover {
    background: var(--bg) !important;
    color: var(--text) !important;
}
.app-navbar .btn-light {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.app-navbar .btn-light:hover {
    background: #fff5f7;
    color: #dc3545;
    border-color: #f8d7da;
}

/* ---------------- Sidebar ---------------- */
.app-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}
.app-sidebar h6 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--text-muted) !important;
}
.app-sidebar .list-group-item {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 2px;
    transition: background 0.15s ease;
}
.app-sidebar .list-group-item:hover {
    background: var(--bg);
}
.app-sidebar .list-group-item.active,
.app-sidebar .list-group-item.active a {
    background: var(--gradient) !important;
    color: #fff !important;
    box-shadow: var(--shadow);
}
.app-sidebar .list-group-item.active a .folder-icon {
    color: #fff !important;
}
.folder-icon {
    color: #f4b740;
    font-size: 1.1rem;
    vertical-align: middle;
}
.folder-link {
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
}
.folder-link.active, .app-sidebar .list-group-item.active .folder-link {
    color: #fff !important;
}
.folder-link:hover {
    text-decoration: none;
    color: var(--primary);
}
.app-sidebar .list-group-item.active .folder-link:hover {
    color: #fff;
}

.btn-new-dropdown > .btn {
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.6rem 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-new-dropdown > .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

/* ---------------- Dropdown menus ---------------- */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    padding: 0.4rem;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.92rem;
    transition: background 0.12s ease, color 0.12s ease;
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--bg);
    color: var(--primary);
}
.dropdown-item.active, .dropdown-item:active {
    background: var(--gradient);
    color: #fff;
}

/* ---------------- Buttons ---------------- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.btn-primary {
    background: var(--gradient);
    border: none;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent) 100%);
    box-shadow: var(--shadow);
}
.btn-sm {
    border-radius: var(--radius-sm);
}
.file-card-actions .btn {
    min-width: 32px;
    padding: 3px 0.5rem;
    border-radius: 8px;
}

/* ---------------- Breadcrumb ---------------- */
.breadcrumb {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    box-shadow: var(--shadow-sm);
}
.breadcrumb .active {
    font-weight: 600;
    color: var(--text);
}

/* ---------------- Cards ---------------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: #dfe1ff;
}
.card.border-info {
    border-color: var(--border) !important;
}
.card.is-hidden-item {
    opacity: 0.6;
    border-style: dashed;
}
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border);
}

.file-preview {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    max-width: 60px;
    max-height: 60px;
}
.file-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef0ff 0%, #fdeefb 100%);
    color: var(--primary) !important;
    font-size: 1.4rem !important;
}
.file-card-icon i {
    color: var(--primary) !important;
}
.file-card-icon img, .file-card-icon embed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}
.card:hover .file-card-icon {
    transform: scale(1.06);
}
.file-card-icon {
    transition: transform 0.15s ease;
}

/* ---------------- Badges ---------------- */
.badge {
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.02em;
}
.badge.bg-info {
    background: linear-gradient(135deg, #818cf8 0%, #ec4899 100%) !important;
    color: #fff !important;
}

/* ---------------- Alerts ---------------- */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
.alert-info {
    background: #eef2ff;
    color: #4338ca;
}
.alert-success {
    background: #ecfdf5;
    color: #047857;
}
.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
}
.alert-secondary {
    background: var(--bg);
    color: var(--text-muted);
}

/* ---------------- Dropzone ---------------- */
.dz-success-mark, .dz-error-mark { display: none; }
.dropzone {
    border: 2px dashed #c7caf5;
    border-radius: var(--radius);
    background: #fafaff;
    min-height: 100px;
    padding: 20px;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover {
    border-color: var(--primary-light);
    background: #f6f6ff;
}
.dropzone.dz-started .dz-message { display: block !important; }

/* ---------------- Forms ---------------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}
#file-search {
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238a8fa3' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 0.85rem center;
    background-size: 16px 16px;
    padding-left: 2.5rem;
}

/* ---------------- Modals ---------------- */
.modal-content {
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow-hover);
}
.modal-header {
    border-bottom: 1px solid var(--border);
}
.modal-footer {
    border-top: 1px solid var(--border);
}
/* ---------------- Fullscreen preview ---------------- */
.modal-content:fullscreen {
    border-radius: 0;
    height: 100vh;
    background: var(--surface);
}
.modal-content:fullscreen .modal-body {
    height: calc(100vh - 130px);
    overflow: auto;
}
.modal-content:fullscreen .modal-body img,
.modal-content:fullscreen .modal-body embed,
.modal-content:fullscreen .modal-body video,
.modal-content:fullscreen .modal-body iframe {
    max-height: calc(100vh - 130px) !important;
    height: calc(100vh - 130px);
}
#viewer-content:fullscreen {
    background: var(--bg);
    overflow: auto;
    padding: 1.5rem;
}

.modal.fade .modal-dialog {
    transform: translateY(-30px) scale(0.98);
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
    opacity: 0;
}
.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ---------------- Auth pages ---------------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    padding: 2rem 1rem;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    border: none;
    padding: 0.5rem;
}
.auth-card .brand-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.7rem;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow);
}

/* ---------------- Auth split layout ---------------- */
.auth-split {
    max-width: 860px;
    display: flex;
    padding: 0;
    overflow: hidden;
}
.auth-side {
    flex: 1 1 45%;
    background: var(--gradient);
    color: #fff;
    padding: 3rem 2.5rem;
    align-items: center;
}
.auth-side-content .brand-badge {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: none;
    margin: 0 0 1.25rem;
}
.auth-side-content h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}
.auth-side-content p {
    opacity: 0.92;
    margin-bottom: 0;
}
.auth-features {
    list-style: none;
    padding: 0;
    margin: 1.75rem 0 0;
}
.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
}
.auth-features li i {
    font-size: 1.1rem;
}
.auth-form-side {
    flex: 1 1 55%;
    padding: 3rem 2.5rem;
}
.auth-form-side .brand-badge {
    margin: 0 auto 1rem;
}
.auth-form-side .input-group-text {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-muted);
}
.auth-form-side .input-group .form-control {
    border-color: var(--border);
}
.auth-form-side .input-group:focus-within .input-group-text {
    border-color: var(--primary-light);
    color: var(--primary);
}
@media (max-width: 767.98px) {
    .auth-split {
        flex-direction: column;
    }
    .auth-form-side {
        padding: 2rem 1.5rem;
    }
}

/* ---------------- Tables ---------------- */
.table {
    border-radius: var(--radius);
    overflow: hidden;
}
.table thead th {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}
.table tbody tr {
    transition: background 0.12s ease;
}
.table tbody tr:hover {
    background: var(--bg);
}

/* ---------------- Outline buttons ---------------- */
.btn-outline-primary, .btn-outline-secondary, .btn-outline-info,
.btn-outline-success, .btn-outline-danger, .btn-outline-warning {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-outline-info:hover,
.btn-outline-success:hover, .btn-outline-danger:hover, .btn-outline-warning:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---------------- Misc ---------------- */
@media (max-width: 767.98px) {
    .file-card-body-flex { flex-direction: column !important; align-items: flex-start !important; }
    .file-preview, .file-card-icon { margin-bottom: 8px; }
}
@media (min-width: 768px) {
    .file-card-body-flex { flex-direction: row !important; align-items: center !important; }
}
.text-white {
    --bs-text-opacity: 1;
    color: #dc3545 !important;
}