/**
 * Invoicing CSS — Muriq Theme
 * Completely isolated from public/style.css.
 * All design tokens are duplicated here intentionally.
 */

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

:root {
    --primary:     #D4AF37;
    --accent:      #8C6239;
    --bg:          #0B0B0B;
    --surface:     #2A2A2A;
    --surface2:    #363636;
    --text:        #F5F3EE;
    --muted:       #A0A0A0;
    --border:      #3D3D3D;
    --danger:      #C62828;
    --success:     #2E7D32;
    --warning:     #E65100;
    --info:        #1565C0;
    --radius:      10px;
    --input-bg:    rgba(255,255,255,0.05);
    --heading:     'Space Grotesk', sans-serif;
    --body:        'Inter', sans-serif;
    --mono:        'JetBrains Mono', monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    overflow-wrap: break-word;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ─── Typography ─── */
h1, h2, h3, h4 { font-family: var(--heading); font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; color: var(--primary); border-bottom: 1px solid var(--accent); padding-bottom: 10px; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 1.1rem; }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─── */
.inv-layout {
    display: flex;
    min-height: 100vh;
}

.inv-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 100;
}

.inv-sidebar-logo {
    font-family: var(--heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.inv-nav {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.inv-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.inv-nav a:hover {
    color: var(--primary);
    background: rgba(212,175,55,0.05);
    text-decoration: none;
}

.inv-nav a.active {
    color: var(--primary);
    background: rgba(212,175,55,0.1);
    border-left-color: var(--primary);
}

.inv-nav a i { width: 18px; text-align: center; }

.inv-main {
    margin-left: 240px;
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ─── Forms ─── */
.form-group { margin-bottom: 1.2rem; }

label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 11px 15px;
    background: #1e1e1e;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--body);
    font-size: 0.95rem;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(212,175,55,0.2);
}

select option { background: var(--surface); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ─── Buttons ─── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: var(--body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary   { background: var(--primary); color: #000; }
.btn-primary:hover { background: #e5c05b; transform: translateY(-1px); }
.btn-secondary { background: var(--accent);  color: #fff; }
.btn-secondary:hover { background: #a0733f; }
.btn-danger    { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost     { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm        { padding: 6px 12px; font-size: 0.8rem; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

.action-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ─── Tables ─── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--surface);
    color: var(--primary);
    padding: 12px 14px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 0.9rem;
    vertical-align: middle;
}

tbody tr:hover { background: rgba(212,175,55,0.04); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─── */
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-draft    { background: rgba(100,116,139,0.2); color: #94a3b8; border: 1px solid #475569; }
.badge-sent     { background: rgba(21,101,192,0.2);  color: #42a5f5; border: 1px solid #1565c0; }
.badge-paid     { background: rgba(46,125,50,0.2);   color: #66bb6a; border: 1px solid #2e7d32; }
.badge-partial  { background: rgba(230,81,0,0.2);    color: #ffa726; border: 1px solid #e65100; }
.badge-overdue  { background: rgba(198,40,40,0.2);   color: #ef5350; border: 1px solid #c62828; }
.badge-void     { background: rgba(80,80,80,0.3);    color: #888;    border: 1px solid #555; }
.badge-accepted { background: rgba(46,125,50,0.2);   color: #66bb6a; border: 1px solid #2e7d32; }
.badge-declined { background: rgba(198,40,40,0.2);   color: #ef5350; border: 1px solid #c62828; }

/* ─── Stat Cards ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: rgba(212,175,55,0.1);
    color: var(--primary);
}

.stat-card .icon.danger { background: rgba(198,40,40,0.1); color: #ef5350; }
.stat-card .icon.success { background: rgba(46,125,50,0.1); color: #66bb6a; }
.stat-card .icon.info { background: rgba(21,101,192,0.1); color: #42a5f5; }

.stat-card .stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.stat-card .stat-value { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--text); }

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ─── Auth Pages ─── */
#particleCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #0B0B0B 0%, #1a1a1a 100%);
}

.auth-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(42,42,42,0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.auth-logo {
    font-family: var(--heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-footer a { color: var(--primary); font-weight: 600; }

.site-footer {
    position: fixed;
    bottom: 20px;
    left: 0; right: 0;
    text-align: center;
    z-index: 1;
    color: var(--muted);
    font-size: 0.8rem;
}

.site-footer span { color: var(--primary); font-weight: 500; }

/* ─── Alert Messages ─── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: none;
}
.alert.active { display: block; }
.alert-error   { background: rgba(198,40,40,0.15); border: 1px solid #c62828; color: #ef5350; }
.alert-success { background: rgba(46,125,50,0.15);  border: 1px solid #2e7d32; color: #66bb6a; }

/* ─── Landing Page ─── */
.landing-hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    gap: 2rem;
}

.landing-logo {
    font-family: var(--heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 15px;
}

.landing-tagline {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 500px;
    line-height: 1.7;
}

.landing-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    width: 100%;
    margin-top: 2rem;
}

.feature-card {
    background: rgba(42,42,42,0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.feature-card .feat-icon {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.8rem;
}

.feature-card h4 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-family: var(--heading);
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .inv-sidebar { transform: translateX(-100%); position: fixed; transition: transform 0.3s; }
    .inv-sidebar.open { transform: translateX(0); box-shadow: 10px 0 30px rgba(0,0,0,0.5); }
    .inv-main { margin-left: 0; padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .landing-logo { font-size: 2rem; }
}

/* ─── Utility ─── */
.text-primary   { color: var(--primary); }
.text-muted     { color: var(--muted); }
.text-danger    { color: #ef5350; }
.text-success   { color: #66bb6a; }
.text-right     { text-align: right; }
.text-center    { text-align: center; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.flex  { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.mono   { font-family: var(--mono); }

/* ─── Line Item Editor ─── */
.line-items-table { width: 100%; border-collapse: collapse; }
.line-items-table th { font-size: 0.75rem; text-align: left; color: var(--muted); padding-bottom: 8px; text-transform: uppercase; }
.line-items-table td { padding: 6px 4px; vertical-align: middle; }
.line-items-table td input { padding: 8px 10px; font-size: 0.9rem; }
.line-items-table .subtotal-cell { font-family: var(--mono); font-size: 0.9rem; color: var(--primary); white-space: nowrap; padding: 0 8px; }
.line-items-table .remove-row { color: var(--danger); background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 4px 8px; transition: color 0.2s; }
.line-items-table .remove-row:hover { color: #ff6b6b; }

.totals-panel { background: rgba(212,175,55,0.05); border: 1px solid rgba(212,175,55,0.15); border-radius: 10px; padding: 1.2rem 1.5rem; }
.totals-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.9rem; color: var(--muted); }
.totals-row.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; font-size: 1.1rem; color: var(--text); font-weight: 700; }
.totals-row.total .amount { font-family: var(--mono); color: var(--primary); font-size: 1.3rem; }
/* ─── Toast Notifications ─── */
#invToasts { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border: 1px solid var(--border); padding: 12px 24px; border-radius: 8px; color: var(--text); box-shadow: 0 4px 15px rgba(0,0,0,0.5); min-width: 250px; animation: slideIn 0.3s ease-out; display: flex; align-items: center; gap: 12px; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Custom Modal / Confirm ─── */
.custom-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 2500; display: none; align-items: center; justify-content: center; padding: 20px; }
.custom-modal-overlay.active { display: flex; }
.custom-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; max-width: 400px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,0.8); }
.custom-modal h3 { color: var(--primary); margin-bottom: 1rem; }
.custom-modal p { color: var(--muted); margin-bottom: 2rem; }
.custom-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
