/* --- ArkivusNet Modern UI Design System --- */

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

:root {
    /* Color Palette */
    --bg-main: #0b0f19;
    --bg-sidebar: #0f172a;
    --bg-card: rgba(20, 28, 48, 0.65);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-focus: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary: #8b5cf6;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #0ea5e9;
    --info-bg: rgba(14, 165, 233, 0.12);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Dynamic Theme variables */
    --bg-hover: rgba(255, 255, 255, 0.03);
    --bg-profile-shortcut: rgba(255, 255, 255, 0.02);
    --bg-th: rgba(15, 23, 42, 0.4);
    --bg-modal: #0f172a;
    --bg-modal-footer: rgba(15, 23, 42, 0.4);
    --bg-dropzone: rgba(15, 23, 42, 0.3);
    --bg-form-control: rgba(15, 23, 42, 0.6);
    --bg-header: rgba(11, 15, 25, 0.8);
    --logo-text-gradient: linear-gradient(135deg, #fff, #cbd5e1);

    /* Layout Configurations */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    
    /* Typography */
    --font-primary: 'Outfit', sans-serif;
    
    /* Shadows & Blur */
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --glass-blur: blur(12px);
    --transition-speed: 0.3s;
}

/* --- Reset & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-primary);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Light Theme Class overrides */
.light-theme {
    --bg-main: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-focus: rgba(99, 102, 241, 0.6);
    
    --primary-glow: rgba(99, 102, 241, 0.08);
    
    --success-bg: rgba(16, 185, 129, 0.08);
    --warning-bg: rgba(245, 158, 11, 0.08);
    --danger-bg: rgba(239, 68, 68, 0.08);
    --info-bg: rgba(14, 165, 233, 0.08);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --bg-hover: rgba(15, 23, 42, 0.03);
    --bg-profile-shortcut: rgba(15, 23, 42, 0.03);
    --bg-th: #f8fafc;
    --bg-modal: #ffffff;
    --bg-modal-footer: #f8fafc;
    --bg-dropzone: #f8fafc;
    --bg-form-control: #ffffff;
    --bg-header: rgba(241, 245, 249, 0.8);
    --logo-text-gradient: linear-gradient(135deg, #0f172a, #475569);
    
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
}

.light-theme body {
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.03) 0%, transparent 40%);
}

.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

.light-theme .login-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(15, 23, 42, 0.08);
}

/* Ocean Blue Theme overrides */
.ocean-theme {
    --bg-main: #020617;
    --bg-sidebar: #0b1329;
    --bg-card: rgba(15, 23, 42, 0.65);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --border-color: rgba(14, 165, 233, 0.15);
    --border-focus: rgba(14, 165, 233, 0.5);
    
    --primary: #0ea5e9;
    --primary-glow: rgba(14, 165, 233, 0.15);
    --secondary: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #38bdf8;
    --text-muted: #64748b;
    
    --bg-hover: rgba(14, 165, 233, 0.05);
    --bg-th: rgba(15, 23, 42, 0.6);
    --bg-modal: #0b1329;
    --bg-modal-footer: rgba(15, 23, 42, 0.6);
    --bg-dropzone: rgba(15, 23, 42, 0.5);
    --bg-form-control: rgba(15, 23, 42, 0.8);
    --bg-header: rgba(2, 6, 23, 0.8);
    --logo-text-gradient: linear-gradient(135deg, #fff, #38bdf8);
}

.ocean-theme body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 40%);
}

.ocean-theme ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Emerald Forest Theme overrides */
.forest-theme {
    --bg-main: #060b08;
    --bg-sidebar: #0a140f;
    --bg-card: rgba(16, 28, 20, 0.65);
    --bg-card-hover: rgba(24, 43, 31, 0.8);
    --border-color: rgba(16, 185, 129, 0.15);
    --border-focus: rgba(16, 185, 129, 0.5);
    
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.15);
    --secondary: #059669;
    
    --text-primary: #f0fdf4;
    --text-secondary: #34d399;
    --text-muted: #64748b;
    
    --bg-hover: rgba(16, 185, 129, 0.05);
    --bg-th: rgba(16, 28, 20, 0.6);
    --bg-modal: #0a140f;
    --bg-modal-footer: rgba(16, 28, 20, 0.6);
    --bg-dropzone: rgba(16, 28, 20, 0.5);
    --bg-form-control: rgba(16, 28, 20, 0.8);
    --bg-header: rgba(6, 11, 8, 0.8);
    --logo-text-gradient: linear-gradient(135deg, #fff, #34d399);
}

.forest-theme body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(5, 150, 105, 0.1) 0%, transparent 40%);
}

.forest-theme ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Sunset Gold Theme overrides */
.sunset-theme {
    --bg-main: #120c09;
    --bg-sidebar: #1a110d;
    --bg-card: rgba(32, 22, 17, 0.65);
    --bg-card-hover: rgba(48, 33, 26, 0.8);
    --border-color: rgba(245, 158, 11, 0.15);
    --border-focus: rgba(245, 158, 11, 0.5);
    
    --primary: #f59e0b;
    --primary-glow: rgba(245, 158, 11, 0.15);
    --secondary: #d97706;
    
    --text-primary: #fffbeb;
    --text-secondary: #fbbf24;
    --text-muted: #78716c;
    
    --bg-hover: rgba(245, 158, 11, 0.05);
    --bg-th: rgba(32, 22, 17, 0.6);
    --bg-modal: #1a110d;
    --bg-modal-footer: rgba(32, 22, 17, 0.6);
    --bg-dropzone: rgba(32, 22, 17, 0.5);
    --bg-form-control: rgba(32, 22, 17, 0.8);
    --bg-header: rgba(18, 12, 9, 0.8);
    --logo-text-gradient: linear-gradient(135deg, #fff, #fbbf24);
}

.sunset-theme body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(245, 158, 11, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(217, 119, 6, 0.1) 0%, transparent 40%);
}

.sunset-theme ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- Layout Structure --- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* --- Sidebar Style --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--logo-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    transition: opacity 0.2s ease;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu-item {
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    gap: 16px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.sidebar-link i {
    font-size: 1.3rem;
    transition: transform 0.2s ease;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-link:hover i {
    transform: scale(1.1);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--primary), rgba(99, 102, 241, 0.8));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--border-color);
}

.user-profile-shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-profile-shortcut);
    padding: 12px;
    border-radius: 12px;
}

.user-avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.user-info-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.user-info-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout-sidebar {
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    transition: transform 0.2s ease;
}

.btn-logout-sidebar:hover {
    transform: scale(1.15);
}

/* --- Main Content Section --- */
.main-layout {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1),
                width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color var(--transition-speed);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.page-title-area h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Content Container */
.content-body {
    padding: 32px;
    flex-grow: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* --- Typography & Elements --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

p {
    color: var(--text-secondary);
}

/* Cards & Glassmorphism */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.8);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
}

/* --- Buttons Style --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* --- Forms Style --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: var(--bg-form-control);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s, background-color var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* --- Badges Style --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* --- Table UI --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background: var(--bg-th);
    padding: 16px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-speed);
}

.custom-table td {
    padding: 16px 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tbody tr {
    transition: background-color 0.2s;
}

.custom-table tbody tr:hover td {
    background: var(--bg-hover);
}

/* --- Grid & Flex Systems --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .document-details-grid > * { min-width: 0; }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Grid misto 2:1 para formulários responsivos */
.grid-mixed-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .grid-mixed-2-1 {
        grid-template-columns: 1fr;
    }
}


/* Layout Responsivo de Detalhes do Documento */
.document-details-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 24px;
    align-items: start;
}

.doc-meta-card {
    grid-column: 1;
    grid-row: 1;
}

.doc-preview-card {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: stretch; /* Stretch to occupy full height */
    display: flex;
    flex-direction: column;
}

.doc-versions-card {
    grid-column: 1;
    grid-row: 2;
}

.doc-audit-card {
    grid-column: 1;
    grid-row: 3;
}

@media (max-width: 992px) {
    .document-details-grid {
        grid-template-columns: 1fr;
    }
    
    .doc-meta-card,
    .doc-preview-card,
    .doc-versions-card,
    .doc-audit-card {
        grid-column: auto;
        grid-row: auto;
    }
}

/* Barra de Ações Responsiva (Página de Detalhes do Documento) */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.action-bar-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .action-bar > .btn {
        width: 100%;
        justify-content: center;
        display: flex;
    }
    
    .action-bar-group {
        width: 100%;
        gap: 8px !important;
    }
    
    .action-bar-group .btn {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        display: flex;
        font-size: 0.85rem;
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .action-bar-group .btn {
        flex: 1 1 100%;
    }
}


/* --- Metrics / Dashboard Cards --- */
.metric-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.metric-icon.primary { background: var(--primary-glow); color: var(--primary); }
.metric-icon.success { background: var(--success-bg); color: var(--success); }
.metric-icon.warning { background: var(--warning-bg); color: var(--warning); }
.metric-icon.danger { background: var(--danger-bg); color: var(--danger); }

.metric-info {
    flex-grow: 1;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Alert Messages --- */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* --- File Upload Area (Dropzone) --- */
.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-dropzone);
    transition: all 0.3s;
}

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

.upload-dropzone i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-dropzone.dragover i {
    color: var(--primary);
    transform: translateY(-5px);
    transition: transform 0.2s;
}

/* --- Modal Style --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    transition: transform 0.3s ease, background-color var(--transition-speed);
    overflow: hidden;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-modal-footer);
    transition: background-color var(--transition-speed);
}

/* --- Responsive Layout for Mobile/Tablets --- */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar .logo-text,
    .sidebar .user-info-text,
    .sidebar .sidebar-link span {
        display: none;
    }
    
    .sidebar-header {
        justify-content: center;
        padding: 0;
    }
    
    .sidebar-menu {
        padding: 24px 8px;
    }
    
    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }
    
    .sidebar-footer {
        padding: 20px 8px;
    }
    
    .user-profile-shortcut {
        justify-content: center;
        padding: 8px;
    }
    
    .btn-logout-sidebar {
        display: none;
    }

    .main-layout {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }
}

/* Sidebar Toggle Overlay Active (For Mobile Drawer) */
@media (max-width: 768px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        width: var(--sidebar-width);
        transition: left var(--transition-speed) ease;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar .logo-text,
    .sidebar .user-info-text,
    .sidebar .sidebar-link span {
        display: block;
    }
    
    .sidebar-header {
        justify-content: flex-start;
        padding: 0 24px;
    }
    
    .sidebar-menu {
        padding: 24px 16px;
    }
    
    .sidebar-link {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    
    .sidebar-footer {
        padding: 20px 16px;
    }
    
    .user-profile-shortcut {
        justify-content: flex-start;
        padding: 12px;
    }
    
    .btn-logout-sidebar {
        display: block;
    }

    .main-layout {
        margin-left: 0;
        width: 100%;
    }
    
    .top-header {
        padding: 0 16px;
    }
    
    .content-body {
        padding: 16px;
    }
}

/* --- Login Page specific styles --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image: url('../login_bg.png') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    position: relative;
    z-index: 1;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 30, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: -1;
    transition: background-color 0.3s ease;
}

.light-theme .login-wrapper::before {
    background: rgba(255, 255, 255, 0.45);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    margin-bottom: 12px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-logo-icon:hover {
    transform: scale(1.05) rotate(2deg);
}

.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* --- Document Grid (Filter search details) --- */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-input {
    flex-grow: 1;
    min-width: 200px;
}

.filter-select {
    min-width: 160px;
}

.search-box-wrapper {
    position: relative;
    flex-grow: 2;
    min-width: 250px;
}

.search-box-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.search-box-wrapper input {
    padding-left: 48px;
}

/* Document Icon indicators */
.doc-icon-container {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.doc-icon-pdf { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.doc-icon-word { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.doc-icon-excel { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.doc-icon-cad { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.doc-icon-image { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.doc-icon-generic { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* --- Theme Selector Dropdown --- */
.theme-selector-container {
    position: relative;
    display: inline-block;
}

.theme-dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0;
    width: 220px;
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 4px;
    animation: slideDown 0.2s ease;
}

.theme-dropdown-menu.active {
    display: flex;
}

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

.theme-dropdown-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.theme-option-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 10px 12px;
    width: 100%;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-option-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-option-btn.active {
    background: var(--primary-glow);
    color: var(--primary);
    font-weight: 600;
}

.theme-color-preview {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.light-theme .theme-color-preview {
    border-color: rgba(0, 0, 0, 0.1);
}

/* --- Sidebar Collapsed State (Desktop Toggle) --- */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar .logo-text,
.sidebar-collapsed .sidebar .user-info-text,
.sidebar-collapsed .sidebar .sidebar-link span {
    display: none;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}

.sidebar-collapsed .sidebar-menu {
    padding: 24px 8px;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 12px;
}

.sidebar-collapsed .sidebar-footer {
    padding: 20px 8px;
}

.sidebar-collapsed .user-profile-shortcut {
    justify-content: center;
    padding: 8px;
}

.sidebar-collapsed .btn-logout-sidebar {
    display: none;
}

.sidebar-collapsed .main-layout {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* --- App Footer Style --- */
.app-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.15);
    margin-top: auto;
    width: 100%;
}

@media (max-width: 768px) {
    .app-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 16px;
    }
}

/* --- Clickable Tag Badge Hover Styles --- */
.tag-badge-hover {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.tag-badge-hover:hover {
    background: var(--primary, #6366f1) !important;
    color: #ffffff !important;
    border-color: var(--primary, #6366f1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

/* --- Pagination UI --- */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-list {
    display: flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-item {
    display: inline-block;
}

.pagination-item a, .pagination-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    box-sizing: border-box;
}

.pagination-item a:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-item.active span {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    cursor: default;
}

.pagination-item.disabled span {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}


