/* assets/css/style.css */
:root {
    /* Color Palette - Premium Dark Theme with Glassmorphism */
    --bg-primary: #0f172a;      /* Slate 900 */
    --bg-secondary: #1e293b;    /* Slate 800 */
    --bg-tertiary: rgba(30, 41, 59, 0.7); /* Glass */
    
    --accent-primary: #3b82f6;   /* Blue 500 */
    --accent-hover: #2563eb;     /* Blue 600 */
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --text-primary: #f8fafc;     /* Slate 50 */
    --text-secondary: #94a3b8;   /* Slate 400 */
    --text-muted: #64748b;       /* Slate 500 */
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    --success: #10b981;          /* Emerald 500 */
    --warning: #f59e0b;          /* Amber 500 */
    --danger: #ef4444;           /* Red 500 */
    
    /* Layout & Sizing */
    --sidebar-width: 280px;
    --topbar-height: 70px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Dynamic UI Theme mappings */
    --hover-bg: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(15, 23, 42, 0.5);
    --input-focus-bg: rgba(15, 23, 42, 0.8);
    --topbar-bg: rgba(15, 23, 42, 0.8);
    --btn-secondary-bg: rgba(255, 255, 255, 0.05);
    --btn-secondary-hover: rgba(255, 255, 255, 0.1);
    --table-row-hover: rgba(255, 255, 255, 0.02);
    --toast-bg: rgba(30, 41, 59, 0.9);
    
    --danger-text: #fca5a5;
    --danger-text-hover: #fecaca;
    --logout-bg: rgba(239, 68, 68, 0.12);
    --logout-hover-bg: rgba(239, 68, 68, 0.25);
    
    --alert-success-text: #34d399;
    --alert-success-bg: rgba(16, 185, 129, 0.1);
    --alert-success-border: rgba(16, 185, 129, 0.3);
    
    --alert-danger-text: #f87171;
    --alert-danger-bg: rgba(239, 68, 68, 0.1);
    --alert-danger-border: rgba(239, 68, 68, 0.3);

    /* Cover & Import Components background */
    --card-cover-bg: rgba(255, 255, 255, 0.02);
    --cover-preview-bg: rgba(15, 23, 42, 0.6);
    --xml-import-bg: rgba(30, 41, 59, 0.4);
    --xml-import-border: rgba(59, 130, 246, 0.35);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;      /* Slate 50 */
    --bg-secondary: #ffffff;    /* White */
    --bg-tertiary: rgba(255, 255, 255, 0.7); /* Light Glass */
    
    --accent-primary: #2563eb;   /* Blue 600 */
    --accent-hover: #1d4ed8;     /* Blue 700 */
    --accent-glow: rgba(37, 99, 235, 0.15);
    
    --text-primary: #0f172a;     /* Slate 900 */
    --text-secondary: #475569;   /* Slate 600 */
    --text-muted: #64748b;       /* Slate 500 */
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    
    --success: #10b981;          /* Emerald 500 */
    --warning: #d97706;          /* Amber 600 */
    --danger: #dc2626;           /* Red 600 */
    
    --hover-bg: rgba(0, 0, 0, 0.04);
    --input-bg: rgba(241, 245, 249, 0.8);
    --input-focus-bg: #ffffff;
    --topbar-bg: rgba(255, 255, 255, 0.8);
    --btn-secondary-bg: rgba(0, 0, 0, 0.04);
    --btn-secondary-hover: rgba(0, 0, 0, 0.08);
    --table-row-hover: rgba(0, 0, 0, 0.015);
    --toast-bg: rgba(255, 255, 255, 0.95);
    
    --danger-text: #dc2626;
    --danger-text-hover: #b91c1c;
    --logout-bg: rgba(220, 38, 38, 0.08);
    --logout-hover-bg: rgba(220, 38, 38, 0.15);
    
    --alert-success-text: #065f46;
    --alert-success-bg: rgba(16, 185, 129, 0.08);
    --alert-success-border: rgba(16, 185, 129, 0.25);
    
    --alert-danger-text: #991b1b;
    --alert-danger-bg: rgba(239, 68, 68, 0.08);
    --alert-danger-border: rgba(239, 68, 68, 0.25);
    
    --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08);

    /* Cover & Import Components background */
    --card-cover-bg: rgba(15, 23, 42, 0.02);
    --cover-preview-bg: rgba(15, 23, 42, 0.04);
    --xml-import-bg: rgba(37, 99, 235, 0.04);
    --xml-import-border: rgba(37, 99, 235, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-nav li a:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    transform: translateX(4px);
}

.sidebar-nav li.active a {
    background-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}

.user-info .details {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Background Decorative Glow */
.main-content::before {
    content: '';
    position: absolute;
    top: -150px;
    right: -150px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.page-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.search-bar-quick form {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-bar-quick form:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-bar-quick input {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 6px 8px;
    outline: none;
    font-size: 0.9rem;
    width: 200px;
}

.search-bar-quick i {
    color: var(--text-muted);
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    z-index: 1;
    position: relative;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-tertiary);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-glass);
    margin-bottom: 24px;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-details p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

/* Forms & Tabs */
.tabs-header {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

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

.tab-btn.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: block;
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    background-color: var(--input-focus-bg);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
    background-color: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.form-actions {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--table-row-hover);
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-primary, .badge-aluno, .badge-admin {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    border: none !important;
}

.badge-warning, .badge-professor, .badge-bibliotecario {
    background-color: #f59e0b !important;
    color: #ffffff !important;
    border: none !important;
}

.badge-success, .badge-funcionario {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
}

.badge-secondary, .badge-outro, .badge-consulta {
    background-color: #64748b !important;
    color: #ffffff !important;
    border: none !important;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-secondary-bg);
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--btn-secondary-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--btn-secondary-bg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.page-item:hover {
    background: var(--btn-secondary-hover);
    color: var(--text-primary);
}

.page-item.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background: var(--alert-success-bg);
    border: 1px solid var(--alert-success-border);
    color: var(--alert-success-text);
}

.alert-danger {
    background: var(--alert-danger-bg);
    border: 1px solid var(--alert-danger-border);
    color: var(--alert-danger-text);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100vh;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .search-bar-quick {
        display: none;
    }
}

/* XML Import Box & Drag-Drop Styles */
.xml-import-box {
    transition: var(--transition);
}
.xml-import-box:hover {
    border-color: var(--accent-primary) !important;
    background: rgba(59, 130, 246, 0.08) !important;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}
.xml-import-box.dragover {
    border-color: var(--success) !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

/* Pulse Animation for Imported Fields */
@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0px rgba(59, 130, 246, 0.7);
        border-color: var(--accent-primary);
        background-color: rgba(59, 130, 246, 0.12);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.25);
        border-color: var(--accent-primary);
        background-color: rgba(59, 130, 246, 0.18);
    }
    100% {
        box-shadow: 0 0 0 0px rgba(59, 130, 246, 0);
        border-color: var(--border-color);
        background-color: var(--input-bg);
    }
}
.highlight-pulse {
    animation: highlightPulse 2.5s ease-in-out forwards;
}

/* Bounce animation for drag and drop icon */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Floating Notification / Alert */
.import-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    background: var(--toast-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-glass);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    max-width: 400px;
}
.import-toast.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
    color: var(--alert-success-text);
}
.import-toast.danger {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
    color: var(--alert-danger-text);
}
.import-toast.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

@keyframes toastSlideIn {
    from { transform: translateY(100px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateY(0) scale(1); opacity: 1; }
    to { transform: translateY(100px) scale(0.9); opacity: 0; }
}

/* Logout button in sidebar */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--logout-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    color: var(--danger-text);
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
}
.logout-btn:hover {
    background: var(--logout-hover-bg);
    color: var(--danger-text-hover);
}

/* Theme Toggle Button in Header */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle-btn {
    background: var(--btn-secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.theme-toggle-btn i {
    font-size: 1.1rem;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
}

/* Switcher icons logic */
[data-theme="light"] .theme-toggle-btn .icon-light {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}
[data-theme="light"] .theme-toggle-btn .icon-dark {
    opacity: 1;
    transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle-btn .icon-light {
    opacity: 1;
    transform: rotate(0) scale(1);
}
[data-theme="dark"] .theme-toggle-btn .icon-dark {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

/* Floating theme toggle for Login page */
.login-theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 1000;
}

/* Custom Form Components with Theme Adaptability */
.cover-sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    padding: 20px;
    background: var(--card-cover-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.cover-preview-box {
    width: 150px;
    height: 210px;
    background: var(--cover-preview-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.xml-import-box {
    margin-bottom: 28px;
    padding: 20px;
    border: 2px dashed var(--xml-import-border);
    border-radius: var(--radius-md);
    background: var(--xml-import-bg);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
