/* ============================================================
   Bloomberg Terminal Theme — EIA Case Management System
   Department of Forestry Fisheries & the Environment
   ============================================================ */

:root {
    --bg-0: #0D1117;
    --bg-1: #161B22;
    --bg-2: #1C2128;
    --bg-3: #21262D;
    --border: #30363D;
    --accent: #FF8C00;
    --accent-dim: #CC7000;
    --green: #3FB950;
    --red: #F85149;
    --yellow: #D29922;
    --blue: #58A6FF;
    --purple: #BC8CFF;
    --cyan: #39C5CF;
    --text-1: #E6EDF3;
    --text-2: #8B949E;
    --text-3: #484F58;
    --sidebar-width: 200px;
    --topbar-height: 40px;
    --statusbar-height: 32px;
}

[data-theme="light"] {
    --bg-0: #F6F8FA;
    --bg-1: #FFFFFF;
    --bg-2: #F0F2F5;
    --bg-3: #E8EAED;
    --border: #D0D7DE;
    --accent: #E36209;
    --accent-dim: #C25100;
    --green: #1A7F37;
    --red: #CF222E;
    --yellow: #9A6700;
    --blue: #0969DA;
    --purple: #8250DF;
    --cyan: #0598A0;
    --text-1: #1F2328;
    --text-2: #656D76;
    --text-3: #AFB8C1;
}

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

html, body {
    height: 100%;
    background: var(--bg-0);
    color: var(--text-1);
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--accent);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 1000;
    border-bottom: 2px solid var(--accent-dim);
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-brand {
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.topbar-separator {
    color: rgba(0,0,0,0.4);
}

.topbar-dept {
    font-size: 11px;
    opacity: 0.85;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 11px;
}

.topbar-tenant {
    background: rgba(0,0,0,0.2);
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-clock {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    min-width: 80px;
    text-align: right;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
    display: flex;
    height: 100vh;
    padding-top: var(--topbar-height);
    padding-bottom: var(--statusbar-height);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-label {
    padding: 4px 12px;
    font-size: 9px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.1s;
    border-left: 2px solid transparent;
}

.sidebar-item:hover {
    background: var(--bg-2);
    color: var(--text-1);
    border-left-color: var(--accent);
}

.sidebar-item.active {
    background: var(--bg-2);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: bold;
}

.sidebar-item .icon {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    font-size: 11px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-0);
    padding: 16px;
}

/* ============================================================
   STATUSBAR
   ============================================================ */
.statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--statusbar-height);
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 24px;
    z-index: 1000;
    font-size: 11px;
    color: var(--text-2);
}

.statusbar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.statusbar-key {
    background: var(--accent);
    color: #000;
    padding: 1px 5px;
    border-radius: 2px;
    font-weight: bold;
    font-size: 10px;
    cursor: pointer;
    text-decoration: none;
}

.statusbar-key:hover {
    background: var(--accent-dim);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.page-subtitle {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 2px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    padding: 14px 16px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.stat-card.green::before { background: var(--green); }
.stat-card.red::before { background: var(--red); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.blue::before { background: var(--blue); }

.stat-label {
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-1);
    line-height: 1;
    font-family: 'Courier New', monospace;
}

.stat-card.green .stat-value { color: var(--green); }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.blue .stat-value { color: var(--blue); }

.stat-sub {
    font-size: 10px;
    color: var(--text-2);
    margin-top: 4px;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.panel-header {
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-body {
    padding: 14px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    background: var(--bg-2);
    color: var(--accent);
    padding: 7px 10px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--bg-2);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr.non-compliant {
    border-left: 3px solid var(--red);
}

.data-table tr.non-compliant td {
    background: rgba(248, 81, 73, 0.05);
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 2px;
}

.badge-green { background: rgba(63,185,80,0.15); color: var(--green); border: 1px solid rgba(63,185,80,0.3); }
.badge-red { background: rgba(248,81,73,0.15); color: var(--red); border: 1px solid rgba(248,81,73,0.3); }
.badge-yellow { background: rgba(210,153,34,0.15); color: var(--yellow); border: 1px solid rgba(210,153,34,0.3); }
.badge-blue { background: rgba(88,166,255,0.15); color: var(--blue); border: 1px solid rgba(88,166,255,0.3); }
.badge-orange { background: rgba(255,140,0,0.15); color: var(--accent); border: 1px solid rgba(255,140,0,0.3); }
.badge-grey { background: rgba(139,148,158,0.15); color: var(--text-2); border: 1px solid rgba(139,148,158,0.3); }
.badge-purple { background: rgba(188,140,255,0.15); color: var(--purple); border: 1px solid rgba(188,140,255,0.3); }

/* ============================================================
   FILTERS / FORM CONTROLS
   ============================================================ */
.filter-bar {
    background: var(--bg-1);
    border: 1px solid var(--border);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.form-control {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 5px 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    outline: none;
    transition: border-color 0.1s;
}

.form-control:focus {
    border-color: var(--accent);
}

.form-control option {
    background: var(--bg-2);
    color: var(--text-1);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.1s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent-dim);
}

.btn-primary:hover {
    background: var(--accent-dim);
}

.btn-secondary {
    background: var(--bg-2);
    color: var(--text-1);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-3);
    border-color: var(--accent);
}

.btn-danger {
    background: rgba(248,81,73,0.1);
    color: var(--red);
    border-color: var(--red);
}

.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
}

/* ============================================================
   STATUS TIMELINE
   ============================================================ */
.timeline {
    display: flex;
    align-items: center;
    padding: 12px 0;
    overflow-x: auto;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 11px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.timeline-step.completed:not(:last-child)::after {
    background: var(--green);
}

.timeline-step.active:not(:last-child)::after {
    background: var(--accent);
}

.timeline-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-1);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.timeline-step.completed .timeline-dot {
    border-color: var(--green);
    background: var(--green);
    color: #000;
}

.timeline-step.active .timeline-dot {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
}

.timeline-step.refused .timeline-dot {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
}

.timeline-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-2);
    margin-top: 4px;
    text-align: center;
}

.timeline-step.active .timeline-label {
    color: var(--accent);
    font-weight: bold;
}

.timeline-step.completed .timeline-label {
    color: var(--green);
}

/* ============================================================
   CASE HEADER
   ============================================================ */
.case-header {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.case-ref {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

.case-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--text-1);
    margin: 4px 0;
}

.case-meta {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.case-meta-item {
    font-size: 11px;
    color: var(--text-2);
}

.case-meta-item strong {
    color: var(--text-1);
}

/* ============================================================
   PROVINCE TABLE
   ============================================================ */
.province-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.province-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.province-name {
    color: var(--text-2);
}

.province-count {
    font-weight: bold;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

.province-bar {
    height: 3px;
    background: var(--accent);
    margin-top: 2px;
    transition: width 0.3s;
}

/* ============================================================
   ALERT / DEADLINE
   ============================================================ */
.deadline-urgent {
    color: var(--red);
    font-weight: bold;
}

.deadline-warning {
    color: var(--yellow);
    font-weight: bold;
}

.deadline-ok {
    color: var(--green);
}

.alert-box {
    padding: 10px 14px;
    border-left: 3px solid var(--yellow);
    background: rgba(210,153,34,0.08);
    font-size: 12px;
    color: var(--yellow);
    margin-bottom: 12px;
}

.alert-box.alert-danger {
    border-left-color: var(--red);
    background: rgba(248,81,73,0.08);
    color: var(--red);
}

/* ============================================================
   DETAIL FIELDS
   ============================================================ */
.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.field-label {
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-value {
    font-size: 13px;
    color: var(--text-1);
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

/* ============================================================
   PUBLIC REGISTER
   ============================================================ */
.register-header {
    background: var(--accent);
    color: #000;
    padding: 16px 24px;
    margin-bottom: 20px;
}

.register-title {
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.register-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

.register-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    background: var(--bg-1);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-0);
}

.login-box {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    width: 380px;
    padding: 32px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-logo-sub {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 8px 10px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
}

.btn-login {
    width: 100%;
    background: var(--accent);
    color: #000;
    border: none;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background 0.1s;
}

.btn-login:hover {
    background: var(--accent-dim);
}

.login-error {
    background: rgba(248,81,73,0.1);
    border: 1px solid var(--red);
    color: var(--red);
    padding: 8px 12px;
    font-size: 12px;
    margin-bottom: 16px;
}

/* ============================================================
   FORM PAGE
   ============================================================ */
.form-section {
    background: var(--bg-1);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    padding: 16px;
}

.form-section-title {
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-field label {
    display: block;
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 6px 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    outline: none;
    transition: border-color 0.1s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--accent);
}

.form-field select option {
    background: var(--bg-2);
    color: var(--text-1);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-0);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--text-2); }
.text-small  { font-size: 11px; }
.text-mono   { font-family: 'Courier New', monospace; }
.fw-bold     { font-weight: bold; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.justify-between { justify-content: space-between; }
