@import url('/css/theme.css');

/* ═══════════════════════════════════
   SIDEBAR + LAYOUT — OptomCRM
   src/main/resources/static/css/sidebar.css
═══════════════════════════════════ */

:root {
    --bg: #09111d;
    --surface: rgba(12,18,29,.98);
    --panel: rgba(16,24,38,.94);
    --card: rgba(20,30,46,.84);
    --border: rgba(148,163,184,.08);
    --border-active: rgba(86,126,186,.26);
    --text: #ebf1fa;
    --muted: #8a9ab3;
    --dim: #55657e;
    --primary: #5a7fb7;
    --primary-glow: rgba(90,127,183,.12);
    --green: #38a37c;
    --green-dim: rgba(56,163,124,.12);
    --red: #d56d82;
    --red-dim: rgba(213,109,130,.12);
    --yellow: #c49a52;
    --sidebar-w: 220px;
    /* ── Aliases used by page-specific CSS ── */
    --line: var(--border);
    --success: var(--green);
    --warning: var(--yellow);
    --danger: var(--red);
    --sans: 'Manrope', Inter, system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --card-hover: rgba(24,34,52,.92);
    --yellow-dim: rgba(196,154,82,.12);
    --blue: #5a9fd4;
    --blue-dim: rgba(90,159,212,.12);
}

html {
    scrollbar-gutter: stable;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Manrope', Inter, system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
    letter-spacing: -.01em;
}

/* ─── Sidebar ─── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .25s ease;
    font-family: Inter, system-ui, sans-serif;
    line-height: 1.25;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #6e92c5, #5676ab);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #fff;
    font-size: .85rem;
    flex-shrink: 0;
    font-family: inherit;
}

.logo-text {
    font-weight: 900;
    font-size: .9rem;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -.02em;
}

.logo-sub {
    font-size: .68rem;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.trial-badge {
    margin: 8px 10px 0;
    padding: 7px 12px;
    background: rgba(196,154,82,.1);
    border: 1px solid rgba(196,154,82,.18);
    border-radius: 10px;
    font-size: .75rem;
    color: #e7c58a;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-command {
    padding: 12px 10px 2px;
    flex-shrink: 0;
}

.command-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(148,163,184,.12);
    background: rgba(255,255,255,.03);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: left;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.command-btn:hover {
    background: rgba(255,255,255,.05);
}

.command-hint {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
}

.nav-section {
    padding: 6px 8px 0;
    flex-shrink: 0;
}

.nav-label {
    font-size: .62rem;
    color: #677791;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 8px 10px 5px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #a8b4c8;
    font-size: .84rem;
    font-weight: 600;
    transition: all .15s ease;
    margin-bottom: 1px;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.2;
}

.nav-item:hover {
    background: rgba(255,255,255,.035);
    color: var(--text);
    text-decoration: none;
}

.nav-item.active {
    background: rgba(90,127,183,.12);
    color: #d4e4ff;
    border-color: rgba(90,127,183,.18);
}

.nav-icon {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: rgba(255,255,255,.05);
    display: grid;
    place-items: center;
    font-size: .8rem;
    flex-shrink: 0;
    line-height: 1;
}

.nav-item.active .nav-icon {
    background: rgba(90,127,183,.16);
}

.nav-group {
    border: 1px solid rgba(148,163,184,.06);
    border-radius: 14px;
    background: rgba(255,255,255,.015);
    margin-top: 2px;
}

.nav-group[open] {
    background: rgba(255,255,255,.025);
}

.nav-group-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 3px;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group-summary .nav-item {
    margin: 0;
    flex: 1;
}

.nav-caret {
    color: var(--muted);
    font-size: .8rem;
    padding-right: 10px;
    transition: transform .15s ease;
}

.nav-group[open] .nav-caret {
    transform: rotate(180deg);
}

.nav-group-items {
    padding: 0 4px 6px;
}

.nav-group-items .nav-item {
    margin-left: 0;
    padding-left: 12px;
}

/* ─── Sidebar Bottom ─── */
.sidebar-bottom {
    margin-top: auto;
    padding: 10px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 11px;
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(148,163,184,.08);
    margin-bottom: 7px;
}

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: rgba(90,127,183,.15);
    border: 1px solid rgba(90,127,183,.22);
    color: #d2e3ff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: .78rem;
    flex-shrink: 0;
    line-height: 1;
}

.user-name {
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
    line-height: 1.3;
}

.user-role {
    font-size: .65rem;
    color: var(--muted);
    line-height: 1.3;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(213,109,130,.15);
    background: rgba(213,109,130,.08);
    color: #e29aaa;
    font-size: .82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: .15s;
    text-align: left;
}

.logout-btn:hover {
    background: rgba(213,109,130,.14);
}

.command-palette {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 220;
}

.command-palette.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.command-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 18, .68);
    backdrop-filter: blur(8px);
}

.command-dialog {
    position: relative;
    width: min(820px, calc(100vw - 48px));
    max-height: min(78vh, 720px);
    background: rgba(10, 16, 28, .98);
    border: 1px solid rgba(148,163,184,.12);
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0,0,0,.45);
    z-index: 1;
    overflow: hidden;
}

.command-head {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid rgba(148,163,184,.1);
}

.command-input {
    flex: 1;
    border: 1px solid rgba(148,163,184,.14);
    background: rgba(255,255,255,.04);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    font-size: .95rem;
}

.command-close {
    border: 0;
    background: rgba(255,255,255,.06);
    color: var(--muted);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
}

.command-results {
    max-height: min(62vh, 560px);
    overflow: auto;
    padding: 10px;
}

.command-section {
    margin-bottom: 10px;
}

.command-section-title {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 10px 8px 6px;
}

.command-item {
    display: block;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 12px;
}

.command-item:hover {
    background: rgba(255,255,255,.04);
    border-color: rgba(108,79,255,.18);
    color: var(--text);
}

.command-item-title {
    font-size: .88rem;
    font-weight: 700;
}

.command-item-subtitle {
    color: var(--muted);
    font-size: .78rem;
    margin-top: 2px;
}

.command-empty {
    color: var(--muted);
    font-size: .88rem;
    text-align: center;
    padding: 56px 12px 60px;
}

/* ─── Main Layout ─── */
.main-wrap {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-w));
}

.main-topbar {
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    color: var(--text);
    letter-spacing: -.02em;
}

.page-content {
    flex: 1;
    padding: 20px 24px;
}

.topbar-cluster {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-copy {
    min-width: 0;
}

.page-subtitle {
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.45;
}

.topbar-actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.topbar-actions-row.push-right {
    margin-left: auto;
}

.topbar-meta {
    color: var(--muted);
    font-size: .9rem;
}

.topbar-form {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 420px;
    align-items: center;
    flex-wrap: wrap;
}

.helper-card {
    background: rgba(70,127,214,.08);
    border: 1px solid rgba(70,127,214,.14);
    border-radius: 14px;
    padding: 14px 16px;
    color: #cfe0ff;
    font-size: .88rem;
    line-height: 1.55;
    margin-bottom: 16px;
}

.section-intro {
    margin-bottom: 16px;
}

.section-title {
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text);
}

.section-subtitle {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.45;
}

.section-subtitle.padded {
    padding: 8px 10px 12px;
}

.empty-state-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 20px;
    color: var(--muted);
    background: rgba(255,255,255,.02);
    border: 1px dashed rgba(148,163,184,.12);
    border-radius: 14px;
}

.empty-state-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.empty-state-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text);
}

.empty-state-subtitle {
    font-size: .88rem;
    color: var(--muted);
}

.panel-scroll {
    overflow-x: auto;
}

.compact-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.compact-title {
    font-weight: 700;
}

.compact-title.strong {
    font-weight: 800;
    font-size: 1rem;
}

.compact-title.xstrong {
    font-weight: 800;
    font-size: 1.1rem;
}

.compact-meta {
    color: var(--muted);
    font-size: .83rem;
}

.compact-meta.small {
    font-size: .8rem;
}

.inline-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.inline-stat-row.with-divider {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.detail-total-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.surface-chip {
    padding: 9px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.surface-chip.success {
    background: rgba(24,195,126,.15);
    color: #8ef0c0;
    border-color: rgba(24,195,126,.25);
}

.surface-chip.primary {
    background: rgba(70,127,214,.16);
    color: #d7e5ff;
    border-color: rgba(70,127,214,.24);
}

.surface-chip.cyan {
    background: rgba(0,204,187,.18);
    color: #eafffd;
    border-color: rgba(0,204,187,.24);
}

.surface-chip.warning {
    background: rgba(245,158,11,.1);
    color: #fcd34d;
    border-color: rgba(245,158,11,.2);
}

.surface-chip.danger {
    background: rgba(244,63,94,.12);
    color: #fb7185;
    border-color: rgba(244,63,94,.2);
}

.surface-button {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255,255,255,.04);
    color: var(--text);
}

.surface-button.success {
    background: rgba(15,186,118,.12);
    border-color: rgba(15,186,118,.2);
    color: #34d399;
}

.surface-button.primary {
    background: rgba(70,127,214,.16);
    border-color: rgba(70,127,214,.24);
    color: #d7e5ff;
}

.surface-button.warning {
    background: rgba(245,158,11,.1);
    border-color: rgba(245,158,11,.2);
    color: #fcd34d;
}

.surface-button.danger {
    background: rgba(244,63,94,.12);
    border-color: rgba(244,63,94,.2);
    color: #fb7185;
}

.surface-button.soft-success {
    background: rgba(15,186,118,.12);
    border-color: rgba(15,186,118,.18);
    color: #8ef0c0;
}

.surface-button.soft-info {
    background: rgba(59,130,246,.12);
    border-color: rgba(59,130,246,.18);
    color: #93c5fd;
}

.soft-info-card {
    background: rgba(255,255,255,.03);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
}

.list-card {
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    margin-bottom: 8px;
}

.info-box {
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 18px;
    border: 1px solid rgba(148,163,184,.14);
}

.info-box.info {
    background: rgba(59,179,255,.08);
    border-color: rgba(59,179,255,.2);
}

.info-box.success {
    background: rgba(24,195,126,.08);
    border-color: rgba(24,195,126,.2);
}

.info-box.primary {
    background: linear-gradient(135deg, rgba(108,79,255,.12), rgba(59,130,246,.08));
    border-color: rgba(108,79,255,.2);
}

.info-box-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.info-box-title.info { color: #9bddff; }
.info-box-title.success { color: #8ef0c0; }

.info-box-copy {
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.6;
}

.feature-chip-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.feature-chip {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.feature-chip.teal {
    background: rgba(0,204,187,.12);
    color: #00ccbb;
}

.feature-chip.blue {
    background: rgba(27,161,226,.12);
    color: #1ba1e2;
}

.feature-chip.green {
    background: rgba(15,186,118,.12);
    color: #34d399;
}

.empty-state-dashed {
    text-align: center;
    padding: 30px;
    border: 2px dashed rgba(255,255,255,.08);
    border-radius: 14px;
    color: var(--muted);
}

.inline-link {
    color: var(--primary);
    text-decoration: none;
}

.inline-link.muted {
    color: var(--muted);
}

.card-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.card-section-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.card-section-copy {
    font-size: .88rem;
    color: var(--muted);
}

.tone-success { color: #8ef0c0 !important; }
.tone-danger { color: #ff9eac !important; }
.tone-primary { color: #c4b5fd !important; }
.tone-warning { color: #fcd34d !important; }

.status-banner {
    border-radius: 14px;
    padding: 12px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.status-banner-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-banner-icon {
    font-size: 1.1rem;
}

.status-banner-title {
    font-weight: 800;
}

.status-banner-meta {
    color: var(--muted);
    font-size: .85rem;
    margin-left: 8px;
}

.status-banner.success {
    background: rgba(15,186,118,.08);
    border: 1px solid rgba(15,186,118,.2);
}

.status-banner.success .status-banner-title,
.status-banner.success .status-banner-action {
    color: #34d399;
}

.status-banner.danger {
    background: rgba(244,63,94,.06);
    border: 1px solid rgba(244,63,94,.15);
}

.status-banner.danger .status-banner-title,
.status-banner.danger .status-banner-action {
    color: #fb7185;
}

.status-banner-action {
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: .82rem;
    text-decoration: none;
    border: 1px solid transparent;
}

.status-banner.success .status-banner-action {
    background: rgba(15,186,118,.15);
    border-color: rgba(15,186,118,.25);
}

.status-banner.danger .status-banner-action {
    background: rgba(244,63,94,.12);
    border-color: rgba(244,63,94,.2);
}

/* ─── Alerts ─── */
.alert-success {
    background: rgba(15,186,118,.12);
    border: 1px solid rgba(15,186,118,.25);
    border-radius: 12px;
    padding: 11px 16px;
    color: #34d399;
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(244,63,94,.1);
    border: 1px solid rgba(244,63,94,.2);
    border-radius: 12px;
    padding: 11px 16px;
    color: #fda4af;
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ─── Mobile ─── */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.4);
    }
    .main-wrap {
        margin-left: 0;
        width: 100%;
    }
    .hamburger {
        display: block;
    }
    .page-content {
        padding: 14px;
    }
    .main-topbar {
        padding: 10px 14px;
    }
}

/* === TIL TANLASH TUGMASI === */
.lang-pill {
    flex: 1;
    text-align: center;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: .74rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--muted, #8ea0bd);
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(148,163,184,.12);
    transition: all .18s;
}
.lang-pill:hover {
    color: #e8f0fd;
    border-color: rgba(70,127,214,.4);
}
.lang-pill.lang-active {
    background: rgba(90,127,183,.18);
    border-color: rgba(90,127,183,.36);
    color: #bfd1ec;
}

.sidebar-meta-label {
    display: block;
    font-size: .62rem;
    color: #677791;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 8px 0 6px;
    padding-left: 2px;
}

.theme-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(148,163,184,.12);
}

.theme-pill {
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .74rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all .18s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-pill:hover {
    color: var(--text);
    background: rgba(255,255,255,.04);
}

.theme-pill.theme-active {
    background: linear-gradient(180deg, rgba(90,127,183,.26), rgba(90,127,183,.16));
    border-color: rgba(90,127,183,.3);
    color: #eef4ff;
    box-shadow: 0 8px 20px rgba(10,18,32,.16);
}
