/* ============================================================
   MetaNex License Manager - Main Stylesheet
   Design: Dark Industrial / Command Center Aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-base:       #080b14;
    --bg-surface:    #0f1525;
    --bg-card:       #131d30;
    --bg-card-hover: #1a2540;
    --bg-sidebar:    #090d1a;
    --border:        #1e2d4a;
    --border-bright: #263650;
    --accent:        #e94560;
    --accent-glow:   rgba(233,69,96,0.18);
    --accent2:       #0f3460;
    --cyan:          #00d4ff;
    --cyan-dim:      rgba(0,212,255,0.1);
    --green:         #10b981;
    --green-dim:     rgba(16,185,129,0.1);
    --amber:         #f59e0b;
    --amber-dim:     rgba(245,158,11,0.1);
    --red:           #ef4444;
    --red-dim:       rgba(239,68,68,0.1);
    --text-primary:  #e2e8f0;
    --text-secondary:#8899b4;
    --text-muted:    #4a5e7a;
    --sidebar-width: 260px;
    --topbar-h:      64px;
    --radius:        10px;
    --radius-lg:     16px;
    --font:          'Space Grotesk', sans-serif;
    --mono:          'JetBrains Mono', monospace;
    --transition:    0.2s cubic-bezier(0.4,0,0.2,1);
}

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

html, body {
    height: 100%;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-footer .admin-badge span,
.sidebar.collapsed .version-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item i { margin: 0; font-size: 18px; }
.sidebar.collapsed .sidebar-footer { justify-content: center; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-icon {
    width: 38px; height: 38px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}
.brand-sub {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 12px 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
}
.nav-item i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(233,69,96,0.2);
}
.nav-item.active i { color: var(--accent); }
.nav-item-danger:hover { background: var(--red-dim); color: var(--red); }
.nav-item-danger:hover i { color: var(--red); }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.admin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}
.admin-badge i { font-size: 18px; color: var(--accent); }
.version-badge {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 20px;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}
.main-wrapper.sidebar-collapsed { margin-left: 72px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
}
.sidebar-toggle {
    background: none; border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-card); }
.topbar-breadcrumb {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary); font-size: 13px;
}
.breadcrumb-root { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }
.topbar-breadcrumb i { font-size: 10px; color: var(--text-muted); }
.topbar-right { margin-left: auto; }
.topbar-time {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-container {
    padding: 16px 24px 0;
    transition: opacity 0.4s;
}
.flash-alert {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}
.flash-alert i { font-size: 16px; }
.flash-close {
    margin-left: auto; background: none; border: none;
    cursor: pointer; font-size: 18px; line-height: 1;
    opacity: 0.6;
}
.flash-close:hover { opacity: 1; }
.flash-success { background: var(--green-dim); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.flash-danger  { background: var(--red-dim);   border: 1px solid rgba(239,68,68,0.3);  color: var(--red); }
.flash-info    { background: var(--cyan-dim);   border: 1px solid rgba(0,212,255,0.3);  color: var(--cyan); }
.flash-warning { background: var(--amber-dim);  border: 1px solid rgba(245,158,11,0.3); color: var(--amber); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content { padding: 28px 28px 40px; flex: 1; }

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap; gap: 12px;
}
.page-title {
    font-size: 22px; font-weight: 700;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 10px;
}
.page-title i { color: var(--accent); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.accent::before  { background: var(--accent); }
.stat-card.cyan::before    { background: var(--cyan); }
.stat-card.green::before   { background: var(--green); }
.stat-card.amber::before   { background: var(--amber); }

.stat-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}
.stat-icon.accent { background: var(--accent-glow); color: var(--accent); }
.stat-icon.cyan   { background: var(--cyan-dim);    color: var(--cyan); }
.stat-icon.green  { background: var(--green-dim);   color: var(--green); }
.stat-icon.amber  { background: var(--amber-dim);   color: var(--amber); }

.stat-label {
    font-size: 11px; font-weight: 600;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 6px;
}
.stat-value {
    font-size: 28px; font-weight: 700;
    color: var(--text-primary); font-family: var(--mono);
}
.stat-sub {
    font-size: 12px; color: var(--text-muted); margin-top: 4px;
}

/* ============================================================
   DATA CARDS / PANELS
   ============================================================ */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.panel-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.panel-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.panel-title i { color: var(--accent); }
.panel-body { padding: 24px; }

/* ============================================================
   TABLE
   ============================================================ */
.mnx-table {
    width: 100%; border-collapse: collapse;
    font-size: 13.5px;
}
.mnx-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px; font-weight: 600;
    letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.mnx-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
.mnx-table tr:last-child td { border-bottom: none; }
.mnx-table tbody tr { transition: background var(--transition); }
.mnx-table tbody tr:hover { background: var(--bg-card-hover); }
.mnx-table tbody tr.renewal-urgent { background: rgba(239,68,68,0.06); }
.mnx-table tbody tr.renewal-urgent td { border-bottom-color: rgba(239,68,68,0.1); }

/* ============================================================
   BADGES
   ============================================================ */
.badge-mnx {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.5px;
}
.badge-green  { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(16,185,129,0.2); }
.badge-amber  { background: var(--amber-dim);  color: var(--amber);  border: 1px solid rgba(245,158,11,0.2); }
.badge-red    { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(239,68,68,0.2); }
.badge-cyan   { background: var(--cyan-dim);   color: var(--cyan);   border: 1px solid rgba(0,212,255,0.2); }
.badge-gray   { background: rgba(74,94,122,0.2); color: var(--text-muted); border: 1px solid var(--border); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-mnx {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13.5px; font-weight: 600;
    border: none; cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-mnx-sm { padding: 5px 12px; font-size: 12px; }

.btn-accent {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-accent:hover {
    background: #d63651; color: #fff;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--border-bright); color: var(--text-primary); background: var(--bg-surface); }
.btn-danger-soft { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger-soft:hover { background: rgba(239,68,68,0.2); color: var(--red); }
.btn-green-soft { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.btn-green-soft:hover { background: rgba(16,185,129,0.2); color: var(--green); }

/* ============================================================
   FORMS
   ============================================================ */
.form-label-mnx {
    display: block;
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.8px; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 7px;
}
.form-control-mnx {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13.5px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control-mnx:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control-mnx::placeholder { color: var(--text-muted); }
.form-control-mnx option { background: var(--bg-surface); }
.form-error { color: var(--red); font-size: 12px; margin-top: 5px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
@media (max-width: 768px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   RENEWAL ALERT WIDGET
   ============================================================ */
.renewal-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.renewal-item:last-child { border-bottom: none; }
.renewal-days {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono); font-weight: 700; font-size: 16px;
    flex-shrink: 0;
}
.days-critical { background: var(--red-dim); color: var(--red); }
.days-warning  { background: var(--amber-dim); color: var(--amber); }
.renewal-info { flex: 1; min-width: 0; }
.renewal-product { font-weight: 600; color: var(--text-primary); font-size: 13.5px; }
.renewal-client  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   CHART WRAPPER
   ============================================================ */
.chart-wrapper { position: relative; height: 240px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 14px; }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar i { color: var(--text-muted); font-size: 15px; }
.search-bar input {
    background: none; border: none; outline: none;
    color: var(--text-primary); font-family: var(--font); font-size: 13.5px;
    width: 220px;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ============================================================
   PROFIT / LOSS COLORS
   ============================================================ */
.text-profit { color: var(--green); font-family: var(--mono); font-weight: 600; }
.text-loss   { color: var(--red);   font-family: var(--mono); font-weight: 600; }
.text-cost   { color: var(--amber); font-family: var(--mono); }
.text-mono   { font-family: var(--mono); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(233,69,96,0.06) 0%, transparent 70%);
    top: -100px; right: -100px;
    pointer-events: none;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%; max-width: 420px;
    position: relative;
}
.login-logo {
    text-align: center; margin-bottom: 36px;
}
.login-logo-icon {
    width: 56px; height: 56px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px;
    margin-bottom: 14px;
    box-shadow: 0 0 40px var(--accent-glow);
}
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   REPORT SUMMARY ROW
   ============================================================ */
.summary-row {
    display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.summary-item {
    flex: 1; min-width: 160px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
}
.summary-item .s-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 6px; }
.summary-item .s-value { font-size: 20px; font-weight: 700; font-family: var(--mono); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .page-content { padding: 20px 16px; }
}
