:root {
    --bs-primary: #5955D1;
    --bs-primary-rgb: 89, 85, 209;
    --bs-heading-color: #1C274C;
    --bs-body-color: #4b5563;
    --bs-body-bg: #f4f6fb;
    --bs-border-color: #e9edf5;
    --sidebar-width: 280px;
    --header-height: 72px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Instrument Sans", system-ui, -apple-system, sans-serif;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

a {
    text-decoration: none;
}

.btn-primary {
    --bs-btn-bg: #5955D1;
    --bs-btn-border-color: #5955D1;
    --bs-btn-hover-bg: #4a46bf;
    --bs-btn-hover-border-color: #4a46bf;
    --bs-btn-active-bg: #403cb0;
    --bs-btn-active-border-color: #403cb0;
}

.form-control,
.form-select {
    border-color: var(--bs-border-color);
    border-radius: 0.75rem;
    min-height: 44px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(89, 85, 209, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(89, 85, 209, 0.12);
}

.form-label {
    font-weight: 600;
    color: var(--bs-heading-color);
}

.card {
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(28, 39, 76, 0.04);
}

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

.card-title,
.card-header h5,
.card-header h6 {
    margin: 0;
    color: var(--bs-heading-color);
    font-weight: 700;
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    border-bottom-color: var(--bs-border-color);
    background: #fafbff;
}

.table > :not(caption) > * > * {
    padding: 0.95rem 1rem;
    border-bottom-color: var(--bs-border-color);
}

/* Auth */
.auth-body {
    background: #fff;
}

.auth-cover-wrapper {
    min-height: 100vh;
}

.auth-cover {
    min-height: 100vh;
    background: linear-gradient(135deg, #5955D1 0%, #7b6cf6 45%, #4f46e5 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 35%),
        radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.12), transparent 30%);
}

.auth-cover-content {
    position: relative;
    max-width: 480px;
}

.auth-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-form-wrapper {
    max-width: 450px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, #5955D1, #7b6cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #6b7280;
}

/* App shell */
.page-layout {
    min-height: 100vh;
    background: var(--bs-body-bg);
}

.app-shell {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    z-index: 1035;
}

.page-layout.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.app-menubar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.app-menubar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.brand-logo {
    display: inline-flex;
}

.brand-logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #5955D1, #7b6cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.brand-text strong {
    display: block;
    color: var(--bs-heading-color);
    font-size: 1rem;
}

.brand-text small {
    color: #6b7280;
}

.app-navbar {
    flex: 1;
    overflow: auto;
    padding: 1rem 0.875rem;
}

.menu-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 0.75rem 0.75rem 0.5rem;
}

.side-menubar {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.menu-item + .menu-item {
    margin-top: 0.25rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border-radius: 0.85rem;
    color: #4b5563;
    font-weight: 600;
    transition: all 0.2s ease;
}

.menu-link i {
    width: 1.25rem;
    text-align: center;
    font-size: 1.05rem;
}

.menu-link:hover {
    background: #f3f4ff;
    color: var(--bs-primary);
}

.menu-link.active {
    background: rgba(89, 85, 209, 0.12);
    color: var(--bs-primary);
}

.menu-link-danger:hover,
.menu-link-danger.active {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.app-menubar-footer {
    padding: 0 1rem 1rem;
}

.card-gradient {
    background: linear-gradient(135deg, rgba(89, 85, 209, 0.12), rgba(123, 108, 246, 0.08));
    border: 1px solid rgba(89, 85, 209, 0.12);
}

.card-gradient h6 {
    color: var(--bs-heading-color);
    font-weight: 700;
}

.card-gradient p {
    font-size: 0.875rem;
    margin-bottom: 0.875rem;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--bs-border-color);
}

.app-header-inner {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
}

.app-toggler {
    width: 42px;
    height: 42px;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.85rem;
    background: #fff;
    color: var(--bs-heading-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-search {
    position: relative;
    width: min(320px, 100%);
}

.header-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.header-search .form-control {
    padding-left: 2.75rem;
    background: #f8f9fd;
    border-color: transparent;
}

.app-header-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-icon,
.btn-action-gray {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: var(--bs-heading-color);
}

.btn-user {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--bs-border-color);
    background: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
}

.btn-user strong,
.btn-user small {
    display: block;
    line-height: 1.2;
    text-align: left;
}

.btn-user small {
    color: #6b7280;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-weight: 700;
}

.avatar-sm {
    width: 40px;
    height: 40px;
}

.dropdown-user-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.dropdown-user-meta strong,
.dropdown-user-meta small {
    display: block;
}

.dropdown-item i {
    width: 1.1rem;
}

/* Main */
.app-wrapper {
    flex: 1;
    padding: 1.25rem 0 2rem;
}

.app-page-head {
    margin-bottom: 1.5rem;
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--bs-heading-color);
}

.breadcrumb {
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: #6b7280;
}

.breadcrumb-item.active {
    color: var(--bs-heading-color);
    font-weight: 600;
}

.footer-wrapper {
    border-top: 1px solid var(--bs-border-color);
    background: #fff;
    padding: 1rem 0;
    font-size: 0.875rem;
}

.footer-wrapper a {
    color: var(--bs-primary);
}

/* Components */
.admin-card,
.stat-card {
    background: #fff;
}

.stat-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 24px rgba(28, 39, 76, 0.04);
}

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

.stat-label {
    display: block;
    color: #6b7280;
    font-size: 0.875rem;
}

.stat-card h3 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--bs-heading-color);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--bs-heading-color);
}

.product-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.85rem;
    border: 1px solid var(--bs-border-color);
}

.product-thumb.placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #9ca3af;
}

.category-list {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.85rem;
    padding: 0.75rem;
    background: #fafbff;
}

.image-card {
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.875rem;
    padding: 0.5rem;
    background: #fff;
}

.image-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 0.65rem;
}

.image-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.alert {
    border: 0;
    border-radius: 0.85rem;
}

@media (max-width: 991.98px) {
    .app-menubar {
        transform: translateX(-100%);
    }

    .page-layout.sidebar-open .app-menubar {
        transform: translateX(0);
    }

    .app-shell {
        margin-left: 0;
    }
}

@media (min-width: 992px) {
    .app-toggler {
        display: none;
    }
}
