:root {
    --primary-color: #0943fe;
    --primary-color-hover: #0735ca;
    --white: #ffffff;
    --bg-light: #f8fafc;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-light: #0f172a;
    --white: #1e293b;
    --text-dark: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
    transition: var(--transition);
}

/* Logo */
.logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    overflow: hidden;
}

.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-container .logo-box {
    width: 150px;
    height: 50px;
    margin-bottom: 24px;
}

.admin-sidebar .logo-box {
    width: 150px;
    height: 40px;
}

/* Login Page */
.login-container {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background-color: var(--white);
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#interactive-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.login-content {
    position: relative;
    z-index: 2;
}

.login-left h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    line-height: 1.1;
}

.login-left p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.login-right {
    flex: 1;
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form-box {
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.login-form-box h2 {
    margin-bottom: 24px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Layout Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart Card */
.chart-container {
    height: 300px;
    position: relative;
    margin-top: 16px;
}

/* Top List Card */
.top-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.top-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.top-cover {
    width: 60px;
    height: 90px;
    /* 14:21 ratio roughly 60:90 */
    border-radius: 6px;
    object-fit: cover;
    background-color: var(--border-color);
}

.top-info {
    flex-grow: 1;
}

.top-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.top-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--white);
    color: var(--text-dark);
    transition: var(--transition);
    font-family: inherit;
}

.form-group textarea {
    min-height: 100px;
    line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(9, 67, 254, 0.1);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-color-hover);
}

.btn-outline-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Admin Layout */
.admin-wrapper {
    display: flex;
}

.admin-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    flex-shrink: 0;
}

.sidebar-menu {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link i,
.nav-link svg {
    margin-right: 10px;
    font-size: 1.2rem;
    width: 1.2rem;
    height: 1.2rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(9, 67, 254, 0.05);
    color: var(--primary-color);
}

.admin-main {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 16px;
    min-height: 100vh;
}

.card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Notification & Modal */
.alert-box {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: 500;
    min-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.alert-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.alert-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-content {
    background: var(--white);
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

/* Theme Switcher */
.theme-switch-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

/* Tabs Styling */
.tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-link {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab-link:hover {
    color: var(--primary-color);
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Helpers */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal.active {
    display: flex !important;
}

/* Hack to ensure modal centers when jQuery fadeIn/show sets display to block */
.modal[style*="display: block"],
.modal-overlay[style*="display: block"] {
    display: flex !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
}

/* Modal Body Detail Styling */
.modal-body-detail p {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-body-detail strong {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.modal-body-detail span {
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.btn-outline-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: transparent;
    color: #f59e0b;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline-warning:hover {
    background-color: #f59e0b;
    color: white;
}

/* Stats Grid & Info Boxes */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Info Box styling enhancement for the .card used in stats */
.stats-grid .card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
}

.data-empty {
    width: 100%;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
    grid-column: 1 / -1;
}

/* Error Page */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 20px 0 10px;
}

.error-desc {
    color: var(--text-muted);
    margin-bottom: 30px;
}