/* ============================================================
   ZetrexStudio — Dark green theme inspired by ZetrexMC
   ============================================================ */
:root {
    color-scheme: dark;
    --bg: #0B120D;
    --bg2: #121C14;
    --bg3: #1A2A1D;
    --line: #263B2A;
    --lime: #A2D22B;
    --mint: #3FD68C;
    --ink: #F2F7EE;
    --muted: #8fa391;
    --amber: #FF9F1C;
    --red: #FF3B3B;
    --blue: #3D8BFF;
    --purple: #9B5CFF;
    --ar: "Cairo", Tahoma, "Segoe UI", sans-serif;
    --en: "Montserrat", "Cairo", Tahoma, sans-serif;
    --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--ar);
    font-size: 15px;
    line-height: 1.7;
    font-weight: 500;
}
body::before {
    content: "";
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 0%, #16301b 0%, transparent 60%),
        linear-gradient(rgba(162,210,43,.04) 1px, transparent 1px) 0 0/80px 80px,
        linear-gradient(90deg, rgba(162,210,43,.04) 1px, transparent 1px) 0 0/80px 80px;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
/* Inline icons default to text size; component rules below override this. */
svg { width: 1em; height: 1em; flex-shrink: 0; }
html[lang="en"] body { font-family: var(--en); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
a { color: var(--lime); text-decoration: none; font-weight: 700; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; font-weight: 900; line-height: 1.4; }
h2 { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
h2::before { content: ""; width: 5px; height: 20px; background: var(--lime); border-radius: 3px; flex: none; box-shadow: 0 0 12px rgba(162,210,43,.5); }
h3 { font-size: 17px; font-weight: 700; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid var(--line); background: var(--bg3); color: var(--ink);
    padding: 9px 18px; border-radius: 10px; cursor: pointer; font-weight: 700;
    white-space: nowrap; transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn.sm svg { width: 14px; height: 14px; }
.btn:hover { transform: translateY(-2px); border-color: var(--lime); }
.btn:active { transform: translateY(1px) scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.pri { background: var(--lime); border-color: var(--lime); color: var(--bg); font-weight: 800; }
.btn.pri:hover { box-shadow: 0 6px 24px rgba(162,210,43,.4); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); padding: 8px 12px; font-size: 13px; font-weight: 600; }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }

/* ============ Layout ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; flex-shrink: 0; height: 100vh; position: sticky; top: 0;
    background: #0e1710; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 20px 16px; overflow-y: auto;
}
.main { flex: 1; min-width: 0; }
.topbar {
    height: 64px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; border-bottom: 1px solid var(--line);
    background: rgba(11,18,13,.85); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 5;
}
.content { padding: 28px; max-width: 1400px; margin: 0 auto; }

/* ============ Logo ============ */
.logo { display: flex; align-items: center; gap: 10px; direction: ltr; margin-bottom: 28px; }
.mark {
    width: 40px; height: 40px; border-radius: 10px; background: var(--lime);
    display: grid; place-items: center; flex: none;
    box-shadow: 0 0 20px rgba(162,210,43,.4);
}
.mark b { font-family: var(--en); font-weight: 900; font-size: 22px; color: var(--bg); }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-family: var(--en); font-size: 18px; font-weight: 900; letter-spacing: -.5px; }
.logo-text strong span { color: var(--lime); }
.logo-text small { font-size: 10px; color: var(--muted); letter-spacing: 1px; font-weight: 700; }

/* ============ Sidebar Nav ============ */
.nav-label { font-size: 10px; letter-spacing: 1.5px; color: #5a7a56; margin: 20px 0 10px; padding-inline-start: 10px; font-weight: 800; }
.nav-btn {
    width: 100%; text-align: start; background: none; border: none; color: var(--muted);
    display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 9px;
    font-size: 14px; font-weight: 600; margin-bottom: 3px; cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-btn:hover { background: rgba(162,210,43,.06); color: var(--ink); }
.nav-btn.active { background: rgba(162,210,43,.12); color: var(--lime); box-shadow: inset 3px 0 var(--lime); }
.nav-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-btn .badge-count {
    margin-left: auto; background: var(--amber); color: var(--bg);
    font-size: 11px; font-weight: 900; padding: 0 7px; border-radius: 10px;
}
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
.user-card { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    font-weight: 800; font-size: 15px; flex-shrink: 0; border: 1px solid rgba(255,255,255,.1);
}
.user-card .info { min-width: 0; }
.user-card .info span { display: block; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .info small { font-size: 11px; color: var(--muted); }

/* ============ Login ============ */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
    width: min(460px, 100%); background: var(--bg2); border: 1px solid var(--lime);
    border-radius: 20px; padding: 36px; box-shadow: 0 0 80px rgba(162,210,43,.15);
    animation: pop .5s cubic-bezier(.34,1.56,.64,1) both;
}
.login-card .logo { margin-bottom: 20px; justify-content: center; }
.login-card h1 { text-align: center; margin-bottom: 6px; font-size: 26px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role-btn {
    background: var(--bg3); border: 2px solid var(--line); border-radius: 12px;
    padding: 16px; text-align: center; cursor: pointer; transition: all .2s var(--ease);
}
.role-btn:hover { border-color: var(--lime); transform: translateY(-2px); }
.role-btn.active { border-color: var(--lime); background: rgba(162,210,43,.1); }
.role-btn svg { display: block; margin: 0 auto 8px; width: 32px; height: 32px; color: var(--lime); }
.role-btn strong { display: block; font-size: 15px; }
.role-btn small { font-size: 11px; color: var(--muted); }

/* ============ Form ============ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
    padding: 11px 14px; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--lime); box-shadow: 0 0 0 3px rgba(162,210,43,.15); outline: none;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============ Cards / Panels ============ */
.card {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
    padding: 20px; position: relative; overflow: hidden;
}
.card::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(135deg, rgba(162,210,43,.03) 0 10px, transparent 10px 22px);
}

/* ============ Stat Tiles ============ */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.tile {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
    padding: 18px 20px; position: relative; overflow: hidden;
    transition: transform .2s var(--ease), border-color .2s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--lime); }
.tile::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(135deg, rgba(162,210,43,.04) 0 10px, transparent 10px 22px);
}
.tile .label { font-size: 13px; color: var(--muted); font-weight: 700; position: relative; }
.tile .value {
    font-family: var(--en); font-size: 34px; font-weight: 900;
    font-variant-numeric: tabular-nums; direction: ltr; text-align: right;
    line-height: 1.3; position: relative;
}
.tile.hero-tile {
    background: var(--lime); border-color: var(--lime); color: var(--bg);
    box-shadow: 0 0 40px rgba(162,210,43,.2);
}
.tile.hero-tile .label { color: rgba(11,18,13,.7); }
.tile.hero-tile::before { background: repeating-linear-gradient(135deg, rgba(11,18,13,.06) 0 10px, transparent 10px 22px); }
.tile.mint .value { color: var(--mint); }
.tile.amber .value { color: var(--amber); }
.tile.blue .value { color: var(--blue); }
.tile.purple .value { color: var(--purple); }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 600px; text-align: start; font-size: 14px; }
th {
    font-size: 12px; font-weight: 800; background: var(--bg3); color: var(--lime);
    padding: 12px 16px; white-space: nowrap; letter-spacing: .5px;
}
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(162,210,43,.04); }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--en); font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; text-align: end; white-space: nowrap; }
td.num b { font-weight: 900; }
td.actions { white-space: nowrap; text-align: left; }

/* ============ Pills / Badges ============ */
.pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800;
    border: 1px solid; white-space: nowrap;
}
.pill.pending { color: var(--amber); border-color: rgba(255,159,28,.4); background: rgba(255,159,28,.1); }
.pill.delivered { color: var(--blue); border-color: rgba(61,139,255,.4); background: rgba(61,139,255,.1); }
.pill.confirmed { color: var(--purple); border-color: rgba(155,92,255,.4); background: rgba(155,92,255,.1); }
.pill.paid { color: var(--mint); border-color: rgba(63,214,140,.4); background: rgba(63,214,140,.1); }
.pill.admin { color: var(--lime); border-color: rgba(162,210,43,.4); background: rgba(162,210,43,.1); }
.pill.editor { color: var(--purple); border-color: rgba(155,92,255,.4); background: rgba(155,92,255,.1); }

.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; flex: none; vertical-align: middle; }

/* ============ Progress bars ============ */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar { display: grid; grid-template-columns: 120px 1fr 80px; gap: 10px; align-items: center; }
.bar .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.bar .track { height: 14px; background: var(--bg3); border-radius: 999px; overflow: hidden; display: flex; }
.bar .track span { display: block; height: 100%; border-radius: 999px; }
.bar .amt { font-family: var(--en); font-weight: 900; direction: ltr; text-align: left; font-size: 13px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ============ Ideas ============ */
.ideas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.idea-card {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
    padding: 18px; transition: transform .2s var(--ease), border-color .2s;
}
.idea-card:hover { transform: translateY(-3px); border-color: var(--lime); }
.idea-card .idea-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.idea-card .idea-meta small { font-size: 11px; color: var(--muted); }
.idea-card .idea-cat { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--lime); }
.idea-card p { font-size: 14px; color: #c4d5be; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.idea-card footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.idea-card footer small { font-size: 11px; color: var(--muted); }

/* ============ Modal ============ */
.modal-shade {
    position: fixed; inset: 0; background: rgba(5,9,6,.75); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center; padding: 16px;
    z-index: 20; animation: fade .2s both;
}
.modal {
    background: var(--bg2); border: 1px solid var(--lime); border-radius: 18px;
    padding: 26px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
    box-shadow: 0 0 60px rgba(162,210,43,.2); animation: pop .35s cubic-bezier(.34,1.56,.64,1) both;
}
.modal h3 { margin: 0 0 18px; font-size: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ============ Toast ============ */
#toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--lime); color: var(--bg); padding: 10px 24px; border-radius: 999px;
    font-weight: 800; font-size: 14px; z-index: 30; display: none; max-width: 90%;
    box-shadow: 0 8px 30px rgba(162,210,43,.35); animation: toastin .35s cubic-bezier(.34,1.56,.64,1);
}
#toast.error { background: var(--red); color: #fff; }

/* ============ Empty state ============ */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty svg { display: block; margin: 0 auto 12px; width: 40px; height: 40px; color: #4a6a44; }

/* ============ Page header ============ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { color: var(--muted); font-size: 13px; }

/* ============ Countdown ============ */
.countdown { font-family: var(--en); font-size: 12px; font-weight: 700; }
.countdown.overdue { color: var(--red); }
.countdown.soon { color: var(--amber); }
.countdown.ok { color: var(--mint); }

/* ============ Animations ============ */
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toastin { from { transform: translate(-50%, 30px); opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(20px); } }
.page-enter > * { animation: up .5s var(--ease) both; }
.page-enter > *:nth-child(2) { animation-delay: .06s; }
.page-enter > *:nth-child(3) { animation-delay: .12s; }
.page-enter > *:nth-child(4) { animation-delay: .18s; }
.page-enter > *:nth-child(5) { animation-delay: .24s; }
.page-enter > *:nth-child(n+6) { animation-delay: .3s; }

/* ============ Mobile menu ============ */
.mobile-toggle { display: none; background: none; border: none; color: var(--muted); padding: 5px; cursor: pointer; }

/* ============ HUD brackets ============ */
.hud { position: fixed; width: 18px; height: 18px; border: 2px solid rgba(242,247,238,.2); pointer-events: none; z-index: 3; }
.hud.a { bottom: 12px; right: 12px; border-top: 0; border-left: 0; }
.hud.b { bottom: 12px; left: 12px; border-top: 0; border-right: 0; }

/* ============ Responsive ============ */
@media (max-width: 800px) {
    .sidebar { display: none; position: fixed; left: 0; top: 0; width: 240px; height: 100vh; z-index: 15; box-shadow: 20px 0 60px #000a; }
    .sidebar.open { display: flex; }
    .mobile-toggle { display: block; }
    .topbar { padding: 0 16px; }
    .content { padding: 18px 16px; }
    .tiles { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .hud { display: none; }
    h1 { font-size: 24px; }
    .bar { grid-template-columns: 80px 1fr 60px; }
}

@media (max-width: 500px) {
    .tiles { grid-template-columns: 1fr; }
    .role-pick { grid-template-columns: 1fr; }
    .ideas-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ============ RTL overrides ============ */
[dir="rtl"] .sidebar { border-right: 0; border-inline-start: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .nav-btn.active { box-shadow: inset -3px 0 var(--lime); }
[dir="rtl"] .nav-btn .badge-count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .dot { margin-right: 0; margin-left: 8px; }
[dir="rtl"] .legend i { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .bar .amt { text-align: right; }
@media (max-width: 800px) {
    [dir="rtl"] .sidebar { left: auto; right: 0; box-shadow: -20px 0 60px #000a; }
}

/* ============ Language switch (segmented) ============ */
.lang-switch {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--bg3); border: 1px solid var(--line);
    border-radius: 999px; padding: 3px; direction: ltr;
}
.lang-opt {
    border: 0; background: none; color: var(--muted); cursor: pointer;
    font-family: var(--en); font-size: 12px; font-weight: 800; letter-spacing: .3px;
    padding: 6px 13px; border-radius: 999px; line-height: 1; min-width: 36px;
    transition: background .18s var(--ease), color .18s;
}
.lang-opt:hover { color: var(--ink); }
.lang-opt.on { background: var(--lime); color: var(--bg); box-shadow: 0 2px 10px rgba(162,210,43,.35); }
.login-lang { position: absolute; top: 16px; inset-inline-end: 16px; }
.login-card { position: relative; }

.field-hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

.modal h3 svg { width: 18px; height: 18px; vertical-align: -3px; margin-inline-end: 6px; }
.modal table td { padding: 9px 12px; }
.modal table td:last-child { text-align: end; }

/* Tables inside modals fit the dialog instead of overflowing it */
.modal .table-wrap { overflow: visible; }
.modal .table-wrap table { min-width: 0; }

/* Reference video link on an idea card */
.idea-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--blue);
    text-decoration: none; word-break: break-all;
}
.idea-link:hover { text-decoration: underline; }

/* Money row + action row on an idea card */
.idea-money {
    display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px;
    font-size: 12px; color: var(--muted); font-family: var(--en);
}
.idea-money b { color: var(--ink); }
.idea-money .ok b { color: var(--mint); }
.idea-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.idea-card .idea-meta { flex-wrap: wrap; gap: 8px; }

/* Idea card footer: keep the "For <editor>" line intact and let the
   buttons take their own row instead of splitting mid-phrase. */
.idea-card footer { flex-wrap: wrap; row-gap: 10px; align-items: center; }
.idea-card footer > small { white-space: nowrap; }
.idea-card .idea-actions { width: 100%; justify-content: flex-start; }

/* Ideas tab bar */
.idea-tabs { display: flex; gap: 8px; margin: 0 0 22px; flex-wrap: wrap; }
.idea-tab {
    padding: 9px 18px; border-radius: 999px; cursor: pointer;
    background: var(--bg3); border: 1px solid var(--line); color: var(--muted);
    font-family: inherit; font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 7px;
    transition: color .15s, border-color .15s, background .15s;
}
.idea-tab:hover { color: var(--ink); border-color: var(--lime); }
.idea-tab.on { background: var(--lime); border-color: var(--lime); color: var(--bg); }
.idea-tab .tab-n {
    font-family: var(--en); font-size: 11px; font-weight: 800;
    background: rgba(0,0,0,.18); padding: 1px 7px; border-radius: 999px;
}
.idea-tab.on .tab-n { background: rgba(0,0,0,.22); }

/* Uploaded thumbnail preview */
.thumb-shot {
    display: block; margin-top: 12px; border-radius: 12px; overflow: hidden;
    border: 1px solid var(--line); background: #000; line-height: 0;
}
.thumb-shot img { width: 100%; height: auto; display: block; max-height: 260px; object-fit: cover; }
.thumb-shot:hover { border-color: var(--lime); }
.upload-preview { margin-top: 10px; }
.upload-preview img {
    width: 100%; max-height: 180px; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--line); display: block;
}
input[type="file"] {
    width: 100%; padding: 10px; border-radius: 10px;
    background: var(--bg3); border: 1px solid var(--line); color: var(--muted);
    font-size: 13px; cursor: pointer;
}
input[type="file"]::file-selector-button {
    background: var(--lime); color: var(--bg); border: 0; border-radius: 8px;
    padding: 7px 14px; margin-inline-end: 12px; font-family: inherit;
    font-weight: 700; font-size: 12px; cursor: pointer;
}