/**
 * House of Noor — Business Management System
 * Custom admin interface styles
 */

/* --------------------------------------------------------------------------
   Layout Variables (colors defined in theme.css)
   -------------------------------------------------------------------------- */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 68px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--color-text);
}

a {
    color: var(--color-accent-dark);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   Admin Layout Shell
   -------------------------------------------------------------------------- */
.admin-body {
    overflow-x: hidden;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
}

body.sidebar-collapsed .admin-main {
    margin-left: var(--sidebar-collapsed-width);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: 1.75rem;
    background-color: var(--color-bg);
}

@media (max-width: 991.98px) {
    .admin-main {
        margin-left: 0;
    }

    body.sidebar-collapsed .admin-main {
        margin-left: 0;
    }

    .page-content {
        padding: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg, #2D3748);
    border-right: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
    min-height: var(--topbar-height);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sidebar-text-hover, #fff);
    text-decoration: none;
    overflow: hidden;
}

.sidebar-brand:hover {
    color: var(--sidebar-text-hover, #fff);
}

.sidebar-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    border-radius: var(--radius-sm);
    font-size: 1.125rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition);
}

body.sidebar-collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.brand-sub {
    font-size: 0.6875rem;
    color: var(--sidebar-text-muted, rgba(255, 255, 255, 0.55));
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--sidebar-text-muted, rgba(255, 255, 255, 0.55));
    font-size: 1.25rem;
    padding: 0.25rem;
    cursor: pointer;
    transition: color var(--transition);
}

.sidebar-close:hover {
    color: var(--sidebar-text-hover, #fff);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem;
}

.sidebar-item {
    margin-bottom: 0.125rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6875rem 0.875rem;
    color: var(--sidebar-text, rgba(255, 255, 255, 0.78));
    text-decoration: none;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.sidebar-link:hover,
.sidebar-sublink:hover {
    background: var(--sidebar-nav-hover, #3A4658);
    color: var(--sidebar-text-hover, #fff);
}

.sidebar-link.active,
.sidebar-sublink.active {
    background: var(--sidebar-nav-active, var(--color-accent));
    color: #fff;
}

.sidebar-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
    color: var(--sidebar-icon, rgba(255, 255, 255, 0.68));
}

.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .submenu-arrow {
    opacity: 0;
    width: 0;
}

.submenu-arrow {
    font-size: 0.75rem;
    transition: transform var(--transition), opacity var(--transition);
}

.submenu-toggle[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0.25rem 2.5rem;
    display: none;
}

.sidebar-submenu.show {
    display: block;
}

body.sidebar-collapsed .sidebar-submenu {
    display: none !important;
}

.sidebar-sublink {
    display: block;
    padding: 0.5rem 0.875rem;
    color: var(--sidebar-text, rgba(255, 255, 255, 0.78));
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    transition: background var(--transition), color var(--transition);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
    text-align: center;
}

.sidebar-logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    margin-bottom: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.sidebar-logout-link:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #FCA5A5;
}

.sidebar-version {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted, rgba(255, 255, 255, 0.55));
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 1.5rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px var(--color-shadow);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background var(--transition);
}

.topbar-toggle:hover {
    background: var(--color-surface-muted);
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.topbar-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.375rem 0.875rem 0.375rem 0.375rem;
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 500;
}

.topbar-user-btn:hover,
.topbar-user-btn:focus {
    background: var(--color-surface-muted);
    border-color: var(--color-border);
    color: var(--color-text);
}

.topbar-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    border-radius: 50%;
    font-size: 0.875rem;
}

.topbar-dropdown {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px var(--color-shadow-md);
    padding: 0.5rem;
    min-width: 200px;
}

.topbar-dropdown .dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.topbar-dropdown .dropdown-item:hover {
    background: var(--color-surface-secondary);
}

.topbar-cashier .topbar-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
}

.topbar-cashier .topbar-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
}

.topbar-cashier .topbar-brand-name {
    font-family: var(--font-display, Georgia, serif);
    font-size: 1.125rem;
}

.cashier-mode .sidebar:not(.pos-body .sidebar) {
    width: var(--sidebar-width);
}

@media (max-width: 575.98px) {
    .topbar {
        padding: 0 1rem;
    }
}

.hon-submitting {
    cursor: wait;
}

/* --------------------------------------------------------------------------
   Stat Cards
   -------------------------------------------------------------------------- */
.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    height: 100%;
}

.stat-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Stat icon colors defined in theme.css */

.stat-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0.25rem 0;
    line-height: 1.2;
}

.stat-hint {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* --------------------------------------------------------------------------
   Content Cards
   -------------------------------------------------------------------------- */
.content-card {
    /* height set only in grid columns or via .h-100 — see theme.css list layout */
}

.content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.content-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.content-card-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-accent-dark);
    background: var(--color-accent-soft);
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
}

.content-card-body {
    padding: 1.25rem;
}

/* --------------------------------------------------------------------------
   Placeholders
   -------------------------------------------------------------------------- */
.placeholder-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 220px;
    color: var(--color-text-light);
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
    padding: 2rem;
}

.placeholder-chart i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-accent);
    opacity: 0.6;
}

.placeholder-chart p {
    margin: 0;
    font-size: 0.875rem;
    max-width: 320px;
}

.placeholder-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    font-size: 0.875rem;
}

.placeholder-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.5;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.dashboard-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-surface-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1.25rem;
}

.dashboard-table tbody td {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--color-bg) 0%, #EEF0F4 50%, var(--color-accent-soft) 100%);
    padding: 1.5rem;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px var(--color-shadow-md);
    padding: 2.5rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    letter-spacing: 0.02em;
}

.login-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.login-form .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.login-form .form-control,
.login-form .input-group-text {
    border-color: var(--color-border);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
}

.login-form .form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 0.2rem rgba(184, 146, 143, 0.2);
}

.login-form .input-group-text {
    background: var(--color-surface-secondary);
    color: var(--color-text-muted);
}

.btn-login {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.login-title-brand {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 1.5rem;
}

.login-footer-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin: 1.5rem 0 0;
}

/* --------------------------------------------------------------------------
   Module Placeholder
   -------------------------------------------------------------------------- */
.placeholder-module {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 200px;
    padding: 2rem;
    color: var(--color-text-muted);
    background: var(--color-surface-secondary);
    border-radius: var(--radius-sm);
}

.placeholder-module i {
    font-size: 2rem;
    color: var(--color-accent);
    opacity: 0.6;
    margin-bottom: 1rem;
}

.placeholder-module p {
    margin: 0;
    max-width: 420px;
    font-size: 0.9375rem;
}

/* --------------------------------------------------------------------------
   Product Module
   -------------------------------------------------------------------------- */
.page-header-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header-subtitle {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.row.g-4 {
    --bs-gutter-y: 1.5rem;
    --bs-gutter-x: 1.5rem;
}

/* --------------------------------------------------------------------------
   Scrollbar (subtle)
   -------------------------------------------------------------------------- */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Executive Dashboard — Phase 11
   -------------------------------------------------------------------------- */
.dashboard-page .dash-hero {
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-secondary) 100%);
}

.dashboard-page .dash-greeting {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.dashboard-page .dash-business {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin: 0;
}

.dashboard-page .dash-growth {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.dashboard-page .dash-aging-box {
    padding: 0.75rem 0.5rem;
}

.dashboard-page .dash-aging-box small {
    display: block;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.dashboard-page .content-card canvas {
    max-height: 240px;
}
