/* ========================================================
   CONTROLE 360 — Design System
   Style: Clean, Professional, Apple-inspired
   ======================================================== */

:root {
    --sidebar-w: 260px;
    --topbar-h: 64px;

    /* Brand */
    --primary:     #0071e3;
    --primary-dk:  #0058b0;
    --primary-lt:  #e8f1fc;
    --accent:      #30d158;
    --danger:      #ff3b30;
    --warning:     #ff9f0a;
    --info:        #5ac8fa;
    --purple:      #bf5af2;

    /* Neutral */
    --bg:          #f5f5f7;
    --surface:     #ffffff;
    --surface-2:   #f9f9fb;
    --border:      #e5e5ea;
    --text:        #1d1d1f;
    --text-2:      #6e6e73;
    --text-3:      #aeaeb2;

    /* Sidebar */
    --sb-bg:       #1c1c1e;
    --sb-text:     #ebebf5cc;
    --sb-active:   #0071e3;
    --sb-hover:    rgba(255,255,255,0.06);

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:   0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:   0 16px 48px rgba(0,0,0,.14);

    --radius:      14px;
    --radius-sm:   8px;
    --radius-lg:   20px;

    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body.c360-body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── SIDEBAR ── */
.c360-sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sb-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), #00a3ff);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    box-shadow: 0 4px 12px rgba(0,113,227,.4);
}
.brand-name { display: block; font-size: 16px; font-weight: 700; color: #fff; line-height: 1.1; }
.brand-tag  { display: block; font-size: 11px; font-weight: 600; color: var(--primary); letter-spacing: .5px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: visible; }
.nav-section-label {
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
    color: rgba(255,255,255,.3); text-transform: uppercase;
    padding: 16px 8px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--sb-text); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: all .18s; cursor: pointer;
    position: relative; margin-bottom: 2px;
}
.nav-item:hover { background: var(--sb-hover); color: #fff; }
.nav-item.active { background: var(--sb-active); color: #fff; box-shadow: 0 4px 12px rgba(0,113,227,.35); }
.nav-item i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item-locked { opacity: .5; }
.badge-count {
    margin-left: auto; background: var(--danger);
    color: #fff; font-size: 11px; font-weight: 700;
    padding: 1px 7px; border-radius: 20px; min-width: 22px; text-align: center;
}

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.user-role { font-size: 11px; color: rgba(255,255,255,.4); }
.btn-logout { color: rgba(255,255,255,.4); font-size: 18px; margin-left: auto; transition: color .18s; text-decoration: none; }
.btn-logout:hover { color: var(--danger); }

/* ── MAIN ── */
.c360-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin .3s cubic-bezier(.4,0,.2,1);
}

/* ── TOPBAR ── */
.c360-topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 100;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.btn-toggle-sidebar {
    background: none; border: none; font-size: 22px;
    color: var(--text-2); cursor: pointer; padding: 4px;
    border-radius: 8px; transition: background .18s;
}
.btn-toggle-sidebar:hover { background: var(--border); }
.breadcrumb { font-size: 13px; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.topbar-date { font-size: 13px; color: var(--text-2); font-weight: 500; }
.topbar-alert {
    display: flex; align-items: center; gap: 5px;
    color: var(--warning); font-size: 13px; font-weight: 600;
    text-decoration: none; padding: 6px 10px;
    background: rgba(255,159,10,.1); border-radius: 8px;
}

/* ── CONTENT ── */
.c360-content { padding: 24px; flex: 1; }

/* ── CARDS ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    background: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 600; font-size: 14px;
    display: flex; align-items: center; gap: 8px;
}

/* ── METRIC CARDS ── */
.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
    position: relative; overflow: hidden;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.metric-card.green::before  { background: linear-gradient(90deg, var(--accent), #00c853); }
.metric-card.blue::before   { background: linear-gradient(90deg, var(--primary), #00a3ff); }
.metric-card.orange::before { background: linear-gradient(90deg, var(--warning), #ff6b00); }
.metric-card.red::before    { background: linear-gradient(90deg, var(--danger), #ff6b6b); }
.metric-card.purple::before { background: linear-gradient(90deg, var(--purple), #9b59b6); }
.metric-card.teal::before   { background: linear-gradient(90deg, #5ac8fa, #007aff); }

.metric-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 14px;
}
.metric-icon.green  { background: rgba(48,209,88,.12);  color: var(--accent); }
.metric-icon.blue   { background: rgba(0,113,227,.12);  color: var(--primary); }
.metric-icon.orange { background: rgba(255,159,10,.12); color: var(--warning); }
.metric-icon.red    { background: rgba(255,59,48,.12);  color: var(--danger); }
.metric-icon.purple { background: rgba(191,90,242,.12); color: var(--purple); }
.metric-icon.teal   { background: rgba(90,200,250,.12); color: var(--info); }

.metric-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.metric-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 8px; }
.metric-sub   { font-size: 12px; color: var(--text-2); }
.metric-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.badge-up   { background: rgba(48,209,88,.15); color: #1a8c3a; }
.badge-down { background: rgba(255,59,48,.12); color: #c0392b; }
.badge-neutral { background: var(--border); color: var(--text-2); }

/* ── TABLES ── */
.c360-table { width: 100%; border-collapse: collapse; }
.c360-table th {
    padding: 10px 14px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-2); background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.c360-table td {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    font-size: 13.5px; vertical-align: middle;
}
.c360-table tr:last-child td { border-bottom: none; }
.c360-table tbody tr { transition: background .12s; }
.c360-table tbody tr:hover { background: var(--surface-2); }

/* ── STATUS BADGE ── */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* ── BUTTONS ── */
.btn-primary {
    background: var(--primary); border: none; color: #fff;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-family: var(--font); font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all .18s;
}
.btn-primary:hover { background: var(--primary-dk); box-shadow: 0 4px 12px rgba(0,113,227,.3); }

/* ── FORMS ── */
.form-control, .form-select {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 14px; padding: 10px 14px;
    background: var(--surface); color: var(--text); width: 100%;
    transition: border-color .18s, box-shadow .18s; outline: none;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,113,227,.12);
}
label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: block; }

/* ── CHART CONTAINER ── */
.chart-wrap { position: relative; width: 100%; }

/* ── PAGE HEADER ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ── RANKING ── */
.rank-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.rank-item:last-child { border-bottom: none; }
.rank-pos {
    width: 28px; height: 28px; border-radius: 8px;
    font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.rank-pos.gold   { background: rgba(255,215,0,.15); color: #b8860b; }
.rank-pos.silver { background: rgba(192,192,192,.15); color: #808080; }
.rank-pos.bronze { background: rgba(205,127,50,.15); color: #a0522d; }
.rank-pos.other  { background: var(--border); color: var(--text-2); }
.rank-name { font-size: 13.5px; font-weight: 600; flex: 1; }
.rank-val  { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ── ALERT / EMPTY ── */
.empty-state {
    text-align: center; padding: 48px 24px; color: var(--text-3);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }

/* ── SIDEBAR COLLAPSED ── */
body.sidebar-collapsed .c360-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .c360-main   { margin-left: 0; }

/* ── PDV ── */
.pdv-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; height: calc(100vh - var(--topbar-h) - 48px); }
.pdv-products { overflow-y: auto; }
.pdv-cart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.cart-items { flex: 1; overflow-y: auto; padding: 16px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-footer { padding: 16px; border-top: 1px solid var(--border); }

/* ── RESPONSIVE ── */
@media (max-width: 992px) {
    .c360-sidebar { transform: translateX(-100%); }
    .c360-main    { margin-left: 0; }
    body.sidebar-open .c360-sidebar { transform: none; }
    .pdv-layout { grid-template-columns: 1fr; }
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.anim-in { animation: fadeInUp .35s ease both; }
.anim-in:nth-child(1) { animation-delay: .05s; }
.anim-in:nth-child(2) { animation-delay: .10s; }
.anim-in:nth-child(3) { animation-delay: .15s; }
.anim-in:nth-child(4) { animation-delay: .20s; }
.anim-in:nth-child(5) { animation-delay: .25s; }
.anim-in:nth-child(6) { animation-delay: .30s; }
.anim-in:nth-child(7) { animation-delay: .35s; }
.anim-in:nth-child(8) { animation-delay: .40s; }

/* ── LOGIN ── */
.login-page {
    min-height: 100vh; background: var(--sb-bg);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: var(--surface); border-radius: 24px;
    padding: 48px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .brand-logo { width: 64px; height: 64px; font-size: 28px; margin: 0 auto 12px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── PROGRESS ── */
.progress-bar-c { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* Utils */
.text-money { font-weight: 700; font-variant-numeric: tabular-nums; }
.gap-3 { gap: 12px !important; }
.fw-800 { font-weight: 800 !important; }
.fs-12 { font-size: 12px !important; }
.fs-13 { font-size: 13px !important; }

/* PDV - layout full height sem padding */
.c360-content--pdv {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-h));
    max-height: calc(100vh - var(--topbar-h));
}
.c360-content--pdv > div:not(.page-header) {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

