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

:root {
    --primary: #906833;
    --primary-dark: #6e4f26;
    --primary-light: #b98f52;
    --primary-soft: rgba(144, 104, 51, 0.12);
    --secondary: #6c757d;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --light-bg: #f4f5f8;
    --dark-text: #343a40;

    --sidebar-bg: #1c1c26;
    --sidebar-bg-active: #262633;
    --sidebar-text: #9a9aab;
    --sidebar-text-active: #ffffff;

    --font-heading: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-primary.bg-opacity-10 {
    background-color: var(--primary-soft) !important;
}

body {
    font-family: var(--font-body);
    background-color: var(--light-bg);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

select,
.form-select {
    background-color: #fff !important;
    color: var(--dark-text) !important;
}

select option {
    background-color: #fff;
    color: var(--dark-text);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

.admin-badge {
    background-color: var(--warning);
    color: var(--dark-text);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 10px;
}

/* ============ Sidebar ============ */
.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed {
    width: 70px;
}

/* Slim, modern scrollbar for the sidebar */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.sidebar .brand {
    padding: 1rem;
    font-size: 1.2rem;
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: center;
    color: var(--sidebar-text-active);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand img {
    height: 46px;
    background: white;
    border-radius: 50%;
    padding: 2px;
    transition: all 0.3s ease;
}

.sidebar.collapsed .brand img {
    height: 38px;
}

.sidebar ul {
    list-style: none;
    padding: 0.75rem 0.5rem;
    margin: 0;
}

.sidebar ul li a {
    color: var(--sidebar-text);
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    border-radius: 8px;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
    font-size: 0.92rem;
}

.sidebar ul li a:hover {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
}

.sidebar ul li a.active {
    background: var(--sidebar-bg-active);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

.sidebar ul li a.active i {
    color: var(--primary-light);
}

.sidebar ul li a i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
    color: var(--sidebar-text);
}

.sidebar ul li a:hover i,
.sidebar ul li a.active i {
    color: inherit;
}

.sidebar.collapsed ul li a span {
    display: none;
}

.sidebar.collapsed ul li a i {
    margin-right: 0;
}

/* Submenu styles */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-top: 2px;
}

.sidebar-submenu li a {
    padding-left: 3rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.sidebar-submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

/* Dropdown arrow icon */
.sidebar ul li a .dropdown-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.sidebar ul li a[aria-expanded="true"] .dropdown-icon {
    transform: rotate(90deg);
}

/* ============ Main content / Topbar ============ */
#main-content {
    margin-left: 250px;
    transition: all 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px);
}

#main-content.collapsed {
    margin-left: 70px;
    width: calc(100% - 70px);
}

.topbar {
    height: 66px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 999;
    gap: 1rem;
}

.topbar #sidebarToggle {
    color: var(--dark-text);
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: background 0.2s;
}

.topbar #sidebarToggle:hover {
    background: var(--light-bg);
}

.topbar-title {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--dark-text);
    font-size: 1.05rem;
}

.topbar .ms-auto {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--dark-text);
    padding: 0.35rem 0.6rem 0.35rem 0.35rem;
    border-radius: 30px;
    transition: background 0.2s;
}

.topbar-user:hover {
    background: var(--light-bg);
    color: var(--dark-text);
}

.topbar-user::after {
    display: none;
}

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

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background-color: var(--primary-soft);
    color: var(--primary-dark);
}

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--light-bg);
}

/* ============ Cards ============ */
.card {
    border: 1px solid #edeef2;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.card-header {
    border-bottom: 1px solid #edeef2;
    border-radius: 14px 14px 0 0 !important;
    background-color: #fff;
}

.card-footer {
    border-top: 1px solid #edeef2;
    border-radius: 0 0 14px 14px !important;
}

/* Stat cards (icon-badge style, replaces gradient stat cards) */
.stat-card {
    border: 1px solid #edeef2;
    border-radius: 14px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.stat-card .card-body {
    padding: 1.35rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon-badge {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-icon-badge.badge-primary { background: var(--primary-soft); color: var(--primary); }
.stat-icon-badge.badge-success { background: rgba(40, 167, 69, 0.12); color: var(--success); }
.stat-icon-badge.badge-info { background: rgba(23, 162, 184, 0.12); color: var(--info); }
.stat-icon-badge.badge-warning { background: rgba(255, 193, 7, 0.15); color: #b8860b; }
.stat-icon-badge.badge-danger { background: rgba(220, 53, 69, 0.12); color: var(--danger); }

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--secondary);
    margin-bottom: 0.15rem;
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark-text);
    line-height: 1.2;
}

.stat-card .stat-meta {
    font-size: 0.78rem;
    color: var(--secondary);
}

.quick-stat {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.alert-item {
    border-radius: 10px;
    margin-bottom: 10px;
}

/* ============ Page header (non-dashboard pages) ============ */
.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header .page-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--dark-text);
    margin: 0;
}

.page-header .page-subtitle {
    color: var(--secondary);
    font-size: 0.88rem;
    margin-top: 0.25rem;
}

.page-header .page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============ Buttons ============ */
.btn {
    border-radius: 8px;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* ============ Tables ============ */
.table thead th {
    background: var(--light-bg);
    color: var(--dark-text);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #edeef2;
    white-space: nowrap;
}

.table td, .table th {
    vertical-align: middle;
}

.table-card {
    border: 1px solid #edeef2;
    border-radius: 14px;
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.footer {
    text-align: center;
    padding: 1rem;
    background: white;
    font-size: 0.9rem;
    color: var(--secondary);
    border-top: 1px solid #edeef2;
}

/* Chart styles */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

@media (max-width: 768px) {
    #main-content.collapsed {
        margin-left: 0px !important;
        width: 100% !important;
    }

    .sidebar {
        left: -250px;
    }

    .sidebar.show {
        left: 0;
    }

    #main-content {
        margin-left: 0;
        width: 100%;
    }

    #main-content.show-sidebar {
        margin-left: 250px;
        width: calc(100% - 250px);
    }

    .topbar {
        position: fixed;
        width: 100%;
    }

    .content-wrapper {
        padding-top: 80px;
    }

    .topbar-title {
        display: none;
    }
}

/* Circular progress indicator styles */
.progress-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.progress-circle-svg {
    width: 100%;
    height: 100%;
}

.progress-circle-track {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 8;
}

.progress-circle-bar {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-circle-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ============ Auth / Login split layout ============ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
}

.auth-panel {
    flex: 1;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-panel::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
    top: -120px;
    right: -120px;
}

.auth-panel::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    border: 1px solid rgba(144, 104, 51, 0.25);
    bottom: -100px;
    left: -80px;
}

.auth-panel img {
    height: 84px;
    background: white;
    border-radius: 50%;
    padding: 6px;
    position: relative;
    z-index: 1;
}

.auth-panel h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

.auth-panel p {
    color: rgba(255, 255, 255, 0.6);
    max-width: 320px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-form-side {
    width: 460px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
}

.auth-form-card {
    width: 100%;
    max-width: 360px;
}

.auth-form-card h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 0.25rem;
}

.auth-form-card .subtitle {
    color: var(--secondary);
    margin-bottom: 2rem;
}

.auth-form-card .form-label {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.9rem;
}

.auth-form-card .form-control {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    border: 1px solid #d9dbe1;
}

.auth-form-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem var(--primary-soft);
}

.auth-form-card .btn-primary {
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
}

.auth-form-card .auth-footer-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-form-card .auth-footer-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-form-card .auth-footer-link a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .auth-panel {
        display: none;
    }

    .auth-form-side {
        width: 100%;
    }
}
