/* ══════════════════════════════════════════════
   OneLaw CRM — Light Theme
   Espresso text on warm white backgrounds
   Gold accents matching brand identity
   ══════════════════════════════════════════════ */

:root {
    --bg:        #f5f3ef;
    --bg-card:   #ffffff;
    --bg-nav:    #1c1710;

    --gold:      #D4AF37;
    --gold-dark: #B8962D;
    --gold-light:#E8C84A;
    --gold-bg:   rgba(212,175,55,.1);
    --gold-border:rgba(212,175,55,.35);

    --text:      #1c1710;
    --text-sub:  #3a2e1a;
    --text-muted:#7a6a4a;
    --text-light:#b0a898;

    --border:    rgba(28,23,16,.1);
    --shadow:    0 1px 4px rgba(28,23,16,.08);
    --shadow-md: 0 4px 20px rgba(28,23,16,.1);

    --green:     #16a34a;
    --green-bg:  #dcfce7;
    --red:       #dc2626;
    --red-bg:    #fee2e2;
    --blue:      #2563eb;
    --blue-bg:   #dbeafe;
    --amber:     #d97706;
    --amber-bg:  #fef3c7;
    --gray:      #6b7280;
    --gray-bg:   #f3f4f6;

    --radius:    10px;
    --radius-sm: 6px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:15px; }
body {
    font-family: 'Assistant', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
}

/* ─── NAVBAR ─── */
.navbar {
    background: var(--bg-nav);
    padding: 0 28px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
}
.brand-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.brand-one { font-size: 1.3rem; font-weight: 900; color: #fff; letter-spacing: -.02em; }
.brand-law { font-size: 1.3rem; font-weight: 900; color: var(--gold); letter-spacing: -.02em; }
.brand-tag {
    font-size: .65rem; font-weight: 700; letter-spacing: 2px;
    text-transform: uppercase; color: rgba(255,255,255,.4);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 4px; padding: 2px 7px; margin-right: 4px;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}
.user-name { font-size: .9rem; color: rgba(255,255,255,.85); font-weight: 600; }
.user-role {
    font-size: .7rem; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; padding: 3px 10px;
    border-radius: 100px;
}
.user-role.super_admin { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-border); }
.user-role.lawyer { background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); border: 1px solid rgba(255,255,255,.15); }

.btn-logout {
    background: transparent; border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.7); padding: 6px 14px; border-radius: var(--radius-sm);
    cursor: pointer; font-family: inherit; font-size: .85rem;
    transition: all .2s;
}
.btn-logout:hover { border-color: var(--gold); color: var(--gold); }

/* ─── PAGE WRAP ─── */
.page-wrap { max-width: 1400px; margin: 0 auto; padding: 28px 28px; }

/* ─── STATS ROW ─── */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    min-width: 120px;
    flex: 1;
    box-shadow: var(--shadow);
}
.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.stat-card.new    .stat-value { color: var(--blue); }
.stat-card.progress .stat-value { color: var(--amber); }
.stat-card.won    .stat-value { color: var(--green); }
.stat-card.lost   .stat-value { color: var(--red); }

/* ─── CARD ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.data-table thead th {
    background: #faf9f7;
    padding: 11px 14px;
    text-align: right;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr {
    border-bottom: 1px solid rgba(28,23,16,.05);
    transition: background .15s;
}
.data-table tbody tr:hover { background: #faf8f4; }
.data-table tbody td { padding: 11px 14px; vertical-align: middle; }
.empty-row { text-align: center; color: var(--text-muted); padding: 36px !important; }

.td-id    { color: var(--text-light); font-size: .8rem; width: 50px; }
.td-name  { font-weight: 700; color: var(--text); }
.td-muted { color: var(--text-muted); font-size: .85rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-date  { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }
.td-actions { display: flex; gap: 6px; align-items: center; }

.phone-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
    font-size: .88rem;
}
.phone-link:hover { text-decoration: underline; }

/* ─── BADGES ─── */
.source-tag {
    display: inline-block;
    padding: 3px 9px;
    background: var(--gold-bg);
    color: var(--gold-dark);
    border: 1px solid var(--gold-border);
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}
.unassigned { color: var(--text-light); font-style: italic; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}
.status-badge.status-new          { background: var(--blue-bg);  color: var(--blue); }
.status-badge.status-contacted    { background: var(--amber-bg); color: var(--amber); }
.status-badge.status-in_progress  { background: var(--amber-bg); color: var(--amber); }
.status-badge.status-closed_won   { background: var(--green-bg); color: var(--green); }
.status-badge.status-closed_lost  { background: var(--red-bg);   color: var(--red); }
.status-badge.status-irrelevant   { background: var(--gray-bg);  color: var(--gray); }

/* ─── STATUS SELECT ─── */
.inline-form { margin: 0; }
.status-select {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.status-select:focus { border-color: var(--gold); }

/* ─── ACTION BUTTONS ─── */
.btn-wa-small {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    background: #dcfce7; color: #16a34a;
    font-size: .72rem; font-weight: 800;
    text-decoration: none; border: 1px solid #bbf7d0;
    transition: all .2s;
}
.btn-wa-small:hover { background: #16a34a; color: #fff; }

.btn-call-small {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    background: var(--blue-bg); color: var(--blue);
    font-size: .85rem; text-decoration: none;
    border: 1px solid #bfdbfe;
    transition: all .2s;
}
.btn-call-small:hover { background: var(--blue); }

/* ─── LOGIN PAGE ─── */
.login-page {
    background: #f0ede6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: var(--shadow-md);
}
.login-logo {
    text-align: center;
    margin-bottom: 36px;
}
.login-logo .brand-one { font-size: 2.2rem; color: var(--text); }
.login-logo .brand-law { font-size: 2.2rem; color: var(--gold); }
.login-logo-sub {
    font-size: .78rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 6px;
}

/* ─── FORMS ─── */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 7px;
}
.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color .2s;
    outline: none;
    direction: ltr;
    text-align: right;
}
.form-group input:focus { border-color: var(--gold); background: #fff; }

/* ─── BUTTONS ─── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1c1710;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: all .3s ease;
    box-shadow: 0 4px 16px rgba(212,175,55,.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212,175,55,.4);
}
.btn-full { width: 100%; }

/* ─── ALERTS ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid #fca5a5;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .page-wrap { padding: 16px; }
    .stats-row { gap: 10px; }
    .stat-card { min-width: 80px; padding: 14px 16px; }
    .stat-value { font-size: 1.5rem; }
    .data-table { font-size: .8rem; }
    .data-table thead th,
    .data-table tbody td { padding: 9px 10px; }
}
