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

:root {
    --primary-color: #1a2b3c;
    /* Deep Navy from Logo */
    --secondary-color: #253545;
    /* Medium Navy */
    --accent-color: #b4975a;
    /* Gold/Bronze Accent from Logo */
    --text-color: #1e293b;
    /* Dark Slate for better contrast */
    --bg-color: #f8fafc;
    /* Soft light gray/white */
    --sidebar-width-collapsed: 80px;
    --sidebar-width-expanded: 280px;
    --topbar-height: 64px;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    padding-top: var(--topbar-height);
    /* For fixed topbar */
}

/* Top Bar Styles */
.topbar {
    height: var(--topbar-height);
    background: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1020;
    padding: 0;
}

.topbar .btn-icon {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.topbar .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-box {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    width: 250px;
    transition: width 0.3s;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.25);
    width: 300px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    width: 100%;
    margin-left: 8px;
    font-size: 0.9rem;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Sidebar Styles */
.sidebar {
    height: calc(100vh - var(--topbar-height));
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width-collapsed);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-x: hidden;
    white-space: nowrap;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

/* Expanded State (formerly hover) */
.sidebar.expanded {
    width: var(--sidebar-width-expanded);
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

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

.sidebar.expanded::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 4px 10px;
    position: relative;
    overflow: hidden;
    font-size: 0.95rem;
}

.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(5px);
}

.sidebar a.active {
    background: linear-gradient(90deg, rgba(180, 151, 90, 0.15) 0%, rgba(180, 151, 90, 0.05) 100%);
    color: var(--accent-color);
    font-weight: 600;
}

.sidebar a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background-color: var(--accent-color);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent-color);
    animation: indicatorPulse 2s infinite;
}

@keyframes indicatorPulse {
    0% {
        box-shadow: 0 0 5px var(--accent-color);
    }

    50% {
        box-shadow: 0 0 15px var(--accent-color);
    }

    100% {
        box-shadow: 0 0 5px var(--accent-color);
    }
}

.nav-links {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Firefox */
}

.nav-links::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Submenu layout */
.collapse a {
    margin: 2px 15px 2px 30px !important;
    font-size: 0.85rem;
    padding: 8px 15px !important;
    border-left: 1px solid rgba(180, 151, 90, 0.3);
    border-radius: 0 8px 8px 0 !important;
    background: rgba(0, 0, 0, 0.1);
}

.collapse a:hover {
    border-left: 2px solid var(--accent-color);
    background: rgba(180, 151, 90, 0.1) !important;
}

.sidebar a i {
    font-size: 1.3rem;
    min-width: 40px;
    text-align: center;
    transition: all 0.3s;
}

/* When expanded, icon margin */
.sidebar.expanded a i {
    margin-right: 15px;
}

/* Label visibility */
.sidebar a span {
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s;
    pointer-events: none;
    flex-grow: 1;
    font-size: 0.95rem;
}

.sidebar.expanded a span {
    opacity: 1;
    pointer-events: auto;
}

/* CSS Tooltips for Collapsed State */
/* Only apply when NOT expanded */
.sidebar:not(.expanded) a {
    justify-content: center;
    padding: 12px 0;
    margin: 4px 10px;
}

.sidebar:not(.expanded) a span {
    display: none;
}

.sidebar:not(.expanded) a i {
    margin-right: 0;
}

.sidebar:not(.expanded) a::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    margin-left: 15px;
    background: var(--primary-color);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    z-index: 1001;
    border: 1px solid rgba(180, 151, 90, 0.3);
}

.sidebar:not(.expanded) a:hover::after {
    opacity: 1;
    transform: translateX(5px);
}

/* Section Labels */
.nav-section-label {
    padding: 25px 20px 10px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent-color);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: none;
}

.sidebar.expanded .nav-section-label {
    display: block;
}

/* Badges */
.badge-count {
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 10px;
    opacity: 0;
    box-shadow: 0 0 10px rgba(180, 151, 90, 0.5);
}

.sidebar.expanded .badge-count {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 2px solid rgba(180, 151, 90, 0.1);
    background: rgba(0, 0, 0, 0.4);
    margin-top: auto;
}

.sidebar-profile {
    padding: 20px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.sidebar-profile:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-profile .profile-info {
    opacity: 0;
    transition: opacity 0.4s;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
}

.sidebar.expanded .sidebar-profile .profile-info {
    opacity: 1;
}

.sidebar-profile .name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.sidebar-profile .role {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-color);
    text-transform: capitalize;
    font-weight: 500;
}

.sidebar-profile .avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #d4c08a 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.sidebar-profile:hover .avatar {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px var(--accent-color);
}

.sidebar-footer a.logout-btn {
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    gap: 15px;
    transition: all 0.3s;
    overflow: hidden;
    margin: 5px 10px 15px;
    border-radius: 10px;
}

.sidebar-footer a.logout-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color) !important;
}

.sidebar-footer a span {
    opacity: 0;
    transition: opacity 0.4s;
}

.sidebar.expanded .sidebar-footer a span {
    opacity: 1;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width-collapsed);
    padding: 30px;
    transition: margin-left var(--transition-speed) ease;
    /* Optional: if we wanted to push */
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: var(--sidebar-width-expanded);
}

/* Card Styling */
.card {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 1.5rem;
}

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

.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #9a7f45;
    /* Darker Gold */
    border-color: #9a7f45;
}

/* Bootstrap Overrides to match theme */
.bg-primary {
    background-color: var(--primary-color) !important;
}

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

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

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

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

/* Tables */
.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table thead th {
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background-color: #f8fafc;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.625rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

.input-group .btn {
    z-index: 0;
}

.badge {
    padding: 0.5em 0.75em;
    border-radius: 6px;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        padding: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.expanded {
        width: var(--sidebar-width-expanded);
    }
}