/* ===== Design Tokens ===== */
:root {
    --color-primary: #4f46e5;
    --color-primary-light: #6366f1;
    --color-primary-dark: #4338ca;
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;

    --color-bg: #d5b481;
    --color-surface: #142342;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.07);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.08);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* ===== Base ===== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    padding-top: 60px; /* Adjust this value based on the navbar height */
}

main { flex: 1; }

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.navbar-brand {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
}

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

/* ===== Navbar ===== */
.navbar {
    background: var(--color-surface) !important;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: .75rem 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; /* Ensure it stays above other elements */
}

.navbar .navbar-brand {
    color: var(--color-text) !important;
    font-weight: 700;
    font-size: 1.2rem;
    gap: .5rem;
    display: flex;
    align-items: center;
}

.navbar .navbar-brand i {
    color: var(--color-primary);
    font-size: 1.4rem;
}

.navbar-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.navbar .nav-link {
    color: var(--color-text-muted) !important;
    font-weight: 500;
    font-size: .9rem;
    padding: .5rem .85rem !important;
    border-radius: var(--radius-sm);
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--color-primary) !important;
    background: rgba(79, 70, 229, .06);
}

.navbar .badge {
    font-weight: 500;
    font-size: .7rem;
    padding: .25em .55em;
    background: var(--color-primary) !important;
    border-radius: 20px;
}

.navbar-toggler {
    border: 1px solid var(--color-border) !important;
    padding: .35rem .6rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.dropdown-menu {
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-sm);
    padding: .5rem;
}

.dropdown-item {
    border-radius: 6px;
    font-size: .9rem;
    padding: .45rem .75rem;
}

.dropdown-item:hover {
    background: rgba(79, 70, 229, .06);
    color: var(--color-primary);
}

/* ===== Cards ===== */
.card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--color-surface);
    overflow: hidden;
}

.card-header {
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
}

.card .card-body { padding: 1.25rem; }

.card-footer {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: 1rem 1.25rem;
}

/* ===== Category & Item Cards ===== */
.category-card,
.item-card {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.category-card:hover,
.item-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    transition: box-shadow .2s ease, transform .2s ease;
}

.category-card img,
.item-card img {
    height: 220px;
    object-fit: cover;
}

.category-card .card-body,
.item-card .card-body { padding: 1.25rem; }

.category-card .card-title,
.item-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== Hero ===== */
.hero-section {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #fff;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, .2), rgba(79, 70, 229, .1));
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-content h1 {
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero-content .lead { opacity: .9; }

/* ===== Category Hero ===== */
.category-hero {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 260px;
    display: flex;
    align-items: flex-end;
    position: relative;
    color: #fff;
    padding: 2rem 0;
    background-color: var(--color-text);
}

.category-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, .85) 0%, rgba(15, 23, 42, .4) 60%, rgba(15, 23, 42, .15) 100%);
}

.category-hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1rem;
}

.category-hero-content h1 {
    color: #fff;
    font-weight: 800;
    margin-bottom: .5rem;
}

.category-hero-content .lead {
    color: rgba(255, 255, 255, .85);
    font-size: 1.05rem;
}

.breadcrumb-light .breadcrumb-item a {
    color: rgba(255, 255, 255, .7);
}
.breadcrumb-light .breadcrumb-item a:hover {
    color: #fff;
}
.breadcrumb-light .breadcrumb-item.active {
    color: rgba(255, 255, 255, .5);
}
.breadcrumb-light .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, .4);
}

/* ===== Buttons ===== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    padding: .5rem 1.1rem;
}

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

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

.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
}
.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

.btn-lg {
    padding: .65rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.btn-light {
    background: rgba(255,255,255,0.2);
    border: none;
    color: var(--color-text);
    font-weight: 600;
}
.btn-light:hover {
    background: #fff;
    color: var(--color-primary);
}

/* ===== Forms ===== */
.form-control,
.form-select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: .6rem .85rem;
    font-size: .9rem;
    color: var(--color-text);
    background: var(--color-surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.form-label {
    font-weight: 500;
    font-size: .875rem;
    color: var(--color-text);
    margin-bottom: .35rem;
}

.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

/* ===== Tables ===== */
.table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: .9rem;
}

.table thead th {
    background: var(--color-text);
    color: #fff;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .75rem 1rem;
    border: none;
}

.table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.table tbody td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.table-hover tbody tr:hover { background: rgba(79, 70, 229, .03); }

/* override .table-dark in headers */
.table-dark { --bs-table-bg: var(--color-text); }

/* ===== Badges ===== */
.badge {
    font-weight: 500;
    font-size: .78rem;
    padding: .3em .7em;
    border-radius: 20px;
}

.badge.bg-success { background: var(--color-success) !important; }
.badge.bg-warning { background: var(--color-warning) !important; }
.badge.bg-danger  { background: var(--color-danger)  !important; }
.badge.bg-primary { background: var(--color-primary) !important; }
.badge.bg-info    { background: var(--color-info)    !important; }
.badge.bg-secondary { background: var(--color-text-muted) !important; }

/* ===== Stat Cards ===== */
.stat-card {
    border-left: 4px solid;
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.stat-card.primary { border-left-color: var(--color-primary); }
.stat-card.success { border-left-color: var(--color-success); }
.stat-card.warning { border-left-color: var(--color-warning); }
.stat-card.info    { border-left-color: var(--color-info); }
.stat-card.danger  { border-left-color: var(--color-danger); }

/* ===== Gallery ===== */
.gallery-main {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.gallery-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    opacity: .7;
}

.gallery-thumb:hover,
.gallery-thumb.active {
    border-color: var(--color-primary);
    opacity: 1;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
    background: transparent;
    padding: 0;
    font-size: .85rem;
}

.breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
}
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-item.active { color: var(--color-text-muted); }

/* ===== Pagination ===== */
.page-link {
    border-radius: var(--radius-sm) !important;
    margin: 0 .15rem;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: .875rem;
    font-weight: 500;
}

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

/* ===== Params ===== */
.param-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .5rem;
}

.param-row input { flex: 1; }

/* ===== Footer ===== */
footer {
    background: var(--color-text) !important;
    border-top: none;
}

footer p { margin-bottom: .3rem; }

/* ===== Toast Notifications (no layout shift) ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 2rem);
}

.toast-notification {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.15rem;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-info);
    opacity: 0;
    transform: translateX(30px);
    animation: toastSlideIn .3s ease forwards;
}

.toast-notification.toast-exiting {
    animation: toastSlideOut .25s ease forwards;
}

.toast-notification.toast-success { border-left-color: var(--color-success); }
.toast-notification.toast-danger  { border-left-color: var(--color-danger); }
.toast-notification.toast-warning { border-left-color: var(--color-warning); }
.toast-notification.toast-info    { border-left-color: var(--color-info); }

.toast-notification .toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--color-success); }
.toast-danger .toast-icon  { color: var(--color-danger); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon    { color: var(--color-info); }

.toast-notification .toast-message {
    flex: 1;
    font-size: .9rem;
    font-weight: 500;
    color: var(--color-text);
}

.toast-notification .toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.toast-notification .toast-close:hover { color: var(--color-text); }

@keyframes toastSlideIn {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

/* ===== Section headings ===== */
section h2 {
    font-weight: 700;
    font-size: 1.75rem;
    letter-spacing: -0.01em;
}

/* ===== Misc ===== */
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

.card-header.bg-dark {
    background: var(--color-text) !important;
}

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

.card-header.bg-success {
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
}

.card-header.bg-info {
    background: var(--color-info) !important;
    border-color: var(--color-info) !important;
}

.card-header.bg-warning {
    background: var(--color-warning) !important;
    color: #fff !important;
}

hr { border-color: var(--color-border); }

/* Admin quick-link cards */
.card.shadow-sm.p-4.text-center:hover {
    box-shadow: var(--shadow-md) !important;
}

.card.shadow-sm.p-4.text-center h5 {
    color: var(--color-text);
    margin-top: .5rem;
    font-size: 1rem;
}

.card.shadow-sm.p-4.text-center i {
    color: var(--color-primary) !important;
}

/* Empty states */
.bi-inbox,
.bi-calendar-x,
.bi-people,
.bi-camera {
    opacity: .4;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 768px) {
    .hero-section { min-height: 320px; }
    .hero-content h1 { font-size: 2rem; }
    .category-hero { min-height: 200px; }
    .category-hero-content h1 { font-size: 1.75rem; }
    .toast-container { left: 1rem; right: 1rem; max-width: none; }
}
