:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    --topnav-height: 64px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--lf-font-family);
    background: var(--lf-bg);
    color: var(--lf-text);
}

/* ---- Admin Layout ---- */

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
}

.admin-wrapper.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}

.admin-wrapper.sidebar-collapsed .brand-text,
.admin-wrapper.sidebar-collapsed .sidebar-nav .nav-link span:not(.badge),
.admin-wrapper.sidebar-collapsed .nav-section {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

.admin-wrapper.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.admin-wrapper.sidebar-collapsed .sidebar-nav .nav-link i {
    margin-right: 0;
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.admin-wrapper.sidebar-collapsed .admin-main {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: var(--topnav-height);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.sidebar-close {
    margin-left: auto;
    color: var(--sidebar-text);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, #8B6914 0%, #C9A227 100%);
    color: #0A0A0A;
    font-weight: 600;
}

.sidebar-nav .nav-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 1rem 0.85rem 0.5rem;
    transition: opacity 0.2s ease;
}

/* ---- Top Navigation ---- */

.admin-topnav {
    height: var(--topnav-height);
    background: var(--lf-bg-card);
    border-bottom: 1px solid var(--lf-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topnav-left,
.topnav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    color: var(--lf-text-muted);
    font-size: 1.5rem;
    padding: 0.25rem;
    text-decoration: none;
}

.topnav-search .input-group-text,
.topnav-search .form-control {
    background: var(--lf-secondary-subtle);
    border-color: var(--lf-border);
    color: var(--lf-text);
}

.topnav-search .form-control {
    min-width: 240px;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--lf-border);
    border-radius: 50px;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    background: var(--lf-bg-card);
    color: var(--lf-text);
}

.user-menu-btn .usr-avatar {
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--lf-text-muted);
}

/* ---- Content Area ---- */

.admin-content {
    flex: 1;
    padding: var(--lf-space-lg);
    background: var(--lf-bg);
}

.admin-breadcrumb {
    margin-bottom: 1rem;
}

.admin-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    font-size: 0.875rem;
}

.admin-footer {
    padding: var(--lf-space-md) var(--lf-space-lg);
    border-top: 1px solid var(--lf-border);
    background: var(--lf-bg-card);
    color: var(--lf-text-muted);
    font-size: var(--lf-font-small);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-footer-inner {
    line-height: 1.5;
}

.admin-footer-inner a {
    color: var(--lf-primary);
    text-decoration: none;
}

.admin-footer-inner a:hover {
    text-decoration: underline;
}

.admin-footer-sep {
    margin: 0 0.35rem;
    opacity: 0.5;
}

.admin-footer-copy {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* Cards, KPI, typography — see design-system.css */

.flash-messages {
    margin-bottom: var(--lf-space-md);
}

/* ---- Auth Pages ---- */

.auth-body {
    min-height: 100vh;
    margin: 0;
    background: url("../images/login-background.png") center center / cover no-repeat fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.auth-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 0;
}

.login-page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 920px;
    padding: 1.5rem;
}

.login-card {
    display: flex;
    background: #fff;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    min-height: 520px;
}

.login-brand-panel {
    flex: 0 0 42%;
    background: linear-gradient(165deg, #0A0A0A 0%, #1a1a1a 55%, #0A0A0A 100%);
    color: #fff;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    border-right: 3px solid var(--gf-gold, #C9A227);
}

.login-brand-content {
    text-align: center;
}

.login-brand-logo,
.brand-logo-login {
    width: 100%;
    max-width: 220px;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    display: block;
    background: transparent;
}

.login-brand-title {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #E8C547;
}

.login-brand-subtitle {
    font-size: 0.9rem;
    color: #C9A227;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: center;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-form-panel {
    flex: 1;
    padding: 2.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

.login-role-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 0.35rem;
    margin-bottom: 2rem;
    gap: 0.25rem;
}

.login-role-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #64748b;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.login-role-tab.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.login-role-tab:hover:not(.active) {
    color: #334155;
}

.login-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.4rem;
}

.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    z-index: 2;
}

.login-input {
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.95rem;
}

.login-input:focus {
    border-color: var(--lf-primary);
    box-shadow: 0 0 0 3px rgba(var(--lf-primary-rgb), 0.12);
    background: #fff;
}

.login-password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #94a3b8;
    padding: 0.25rem;
    z-index: 2;
}

.login-password-toggle:hover {
    color: #475569;
}

.login-submit-btn {
    background: #1e293b;
    color: #fff;
    border: none;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s ease;
}

.login-submit-btn:hover {
    background: #0f172a;
    color: #fff;
}

.login-form-panel .flash-messages {
    margin-bottom: 1rem;
}

.login-form-panel .alert {
    font-size: 0.875rem;
    padding: 0.65rem 1rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 767.98px) {
    .login-card {
        flex-direction: column;
        min-height: auto;
    }

    .login-brand-panel {
        flex: none;
        padding: 2rem 1.5rem;
    }

    .login-brand-logo {
        max-width: 160px;
        margin-bottom: 1rem;
    }

    .login-brand-title {
        font-size: 1.35rem;
    }

    .login-form-panel {
        padding: 2rem 1.5rem;
    }
}

/* ---- Forgot password flow ---- */

.auth-forgot-card {
    max-width: 920px;
}

.auth-forgot-link {
    color: var(--lf-primary, #0d6efd);
    text-decoration: none;
    font-weight: 500;
}

.auth-forgot-link:hover {
    text-decoration: underline;
    color: var(--lf-primary, #0d6efd);
}

.auth-forgot-steps {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.auth-step {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--lf-text-muted, #6c757d);
    font-weight: 500;
}

.auth-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: var(--lf-border, #dee2e6);
    color: var(--lf-text-muted, #6c757d);
    font-size: 0.7rem;
}

.auth-step.active {
    color: var(--lf-primary, #0d6efd);
}

.auth-step.active .auth-step-num {
    background: var(--lf-primary, #0d6efd);
    color: #fff;
}

.auth-step.done {
    color: var(--lf-success, #198754);
}

.auth-step.done .auth-step-num {
    background: var(--lf-success, #198754);
    color: #fff;
}

.auth-otp-input {
    letter-spacing: 0.35em;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
}

#resendOtpBtn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    text-decoration: none;
}

/* ---- Responsive ---- */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0 !important;
    }

    .admin-wrapper.sidebar-collapsed .admin-sidebar {
        width: var(--sidebar-width);
    }
}

@media (max-width: 575.98px) {
    .admin-content {
        padding: 1rem;
    }

    .admin-topnav {
        padding: 0 1rem;
    }
}
