﻿/* ============================================================
   CRM System ? Main Stylesheet
   ============================================================ */

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

:root {
    --bg:         #0f1117;
    --surface:    #1a1d27;
    --surface2:   #22263a;
    --border:     #2d3150;
    --text:       #e2e8f0;
    --muted:      #6b7280;
    --primary:    #4f6ef7;
    --primary-h:  #3b5be8;
    --green:      #22c55e;
    --red:        #ef4444;
    --yellow:     #f59e0b;
    --blue:       #3b82f6;
    --purple:     #a855f7;
    --sidebar-w:  220px;
    --radius:     8px;
    --shadow:     0 4px 24px rgba(0,0,0,0.35);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #1a1d35 0%, #0f1117 70%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo h1 { font-size: 22px; margin: 8px 0 4px; }
.login-logo p  { color: var(--muted); font-size: 13px; }

.logo-icon {
    display: inline-block;
    font-size: 28px;
    color: var(--primary);
}

.login-hint {
    margin-top: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

/* ============================================================
   LAYOUT ? SIDEBAR + MAIN
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--muted);
    text-decoration: none;
    border-radius: 0;
    transition: all 0.15s;
    font-size: 13.5px;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: var(--surface2);
    color: var(--text);
    border-right: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.btn-logout {
    color: var(--red);
    text-decoration: none;
    font-size: 12px;
}
.btn-logout:hover { text-decoration: underline; }

.badge-count {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    border-radius: 10px;
    padding: 1px 7px;
    font-weight: 600;
}

.main-content {
    margin-left: var(--sidebar-w);
    padding: 28px 32px;
    min-height: 100vh;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    margin-bottom: 24px;
}
.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.page-header .subtitle {
    color: var(--muted);
    font-size: 13px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface2);
}

.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-8  { margin-bottom: 8px; }
.p-16  { padding: 16px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    border-left: 4px solid var(--border);
}

.stat-card.accent-green  { border-left-color: var(--green); }
.stat-card.accent-red    { border-left-color: var(--red); }
.stat-card.accent-yellow { border-left-color: var(--yellow); }
.stat-card.accent-blue   { border-left-color: var(--blue); }
.stat-card.accent-purple { border-left-color: var(--purple); }

.stat-num   { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ============================================================
   DATA TABLE
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th,
.data-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--surface2);
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-green  { background: #16a34a; color: #fff; }
.btn-green:hover:not(:disabled) { background: #15803d; }

.btn-red    { background: #dc2626; color: #fff; }
.btn-red:hover:not(:disabled)   { background: #b91c1c; }

.btn-yellow { background: #d97706; color: #fff; }
.btn-yellow:hover:not(:disabled){ background: #b45309; }

.btn-blue   { background: #2563eb; color: #fff; }
.btn-blue:hover:not(:disabled)  { background: #1d4ed8; }

.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }

.active-choice { outline: 3px solid #fff; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13.5px;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.2);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-green  { background: rgba(34,197,94,0.15);  color: var(--green); }
.badge-red    { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge-yellow { background: rgba(245,158,11,0.15);  color: var(--yellow); }
.badge-blue   { background: rgba(59,130,246,0.15);  color: var(--blue); }
.badge-purple { background: rgba(168,85,247,0.15);  color: var(--purple); }
.badge-gray   { background: rgba(107,114,128,0.15); color: var(--muted); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid;
}

.alert-success { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.3);  color: #4ade80; }
.alert-danger  { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fbbf24; }
.alert-info    { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #60a5fa; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow);
    transform: translateY(-16px);
    transition: transform 0.2s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text); }

.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Lead detail inside modal */
.lead-info { margin-bottom: 16px; }
.lead-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.lead-detail:last-child { border-bottom: none; }
.lead-detail span { color: var(--muted); }

.scrub-actions { padding: 8px 0; }

.dial-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

/* ============================================================
   DROP ZONE (import)
   ============================================================ */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--muted);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(79,110,247,0.05);
    color: var(--text);
}

.drop-icon { font-size: 36px; margin-bottom: 8px; }

.file-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--surface2);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
}

/* ============================================================
   ASSIGN ROWS
   ============================================================ */
.assign-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.assign-row:last-child { border-bottom: none; }
.assign-row label { flex: 1; font-size: 13.5px; }
.assign-status { font-size: 12px; color: var(--green); min-width: 60px; }
.assign-total { font-size: 13px; color: var(--muted); }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .row-2col { grid-template-columns: 1fr; }
}

.mini-stats { display: flex; flex-direction: column; gap: 10px; }
.mini-stats > div { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }

.float-right { float: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* Bar chart */
.bar-wrap  { background: var(--surface2); border-radius: 4px; height: 8px; width: 200px; overflow: hidden; }
.bar-fill  { background: var(--primary); height: 100%; border-radius: 4px; transition: width 0.4s; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    z-index: 500;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.25s;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.success { background: #166534; color: #4ade80; border: 1px solid #166534; }
.toast.error   { background: #7f1d1d; color: #f87171; border: 1px solid #7f1d1d; }

/* ============================================================
   TAB PANE
   ============================================================ */
.tab-pane { animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CALLBACK TAB ? STATUS DOTS
   ============================================================ */
.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-red    { background: var(--red);    box-shadow: 0 0 6px var(--red); }
.dot-yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.dot-green  { background: var(--green);  }
.dot-gray   { background: var(--muted);  }

/* Pulsing dot for overdue rows */
.dot-red { animation: pulse-red 1.4s ease-in-out infinite; }

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 4px var(--red); }
    50%       { box-shadow: 0 0 10px var(--red); }
}

/* ============================================================
   CALLBACK TAB ? TABLE ROWS
   ============================================================ */
.row-overdue  { background: rgba(239,68,68,0.06) !important; }
.row-due-soon { background: rgba(245,158,11,0.06) !important; }

.row-overdue:hover  { background: rgba(239,68,68,0.12) !important; }
.row-due-soon:hover { background: rgba(245,158,11,0.12) !important; }

.cb-overdue {
    color: var(--red);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.cb-soon {
    color: var(--yellow);
    font-weight: 600;
    font-size: 12px;
}

/* ============================================================
   CALLBACK TAB ? LEGEND
   ============================================================ */
.cb-legend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--muted);
}

/* ============================================================
   CALLBACK TAB ? DUE ALERT BANNER (inside tab)
   ============================================================ */
.cb-due-alert {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-weight: 500;
}

/* ============================================================
   REMINDER BANNER (top of page)
   ============================================================ */
.reminder-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.4);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #fbbf24;
    animation: slideDown 0.3s ease;
}

.reminder-banner .reminder-icon {
    font-size: 16px;
    flex-shrink: 0;
    animation: pulse-red 1.2s ease-in-out infinite;
}

.reminder-banner span:last-child,
.reminder-banner button {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}
.reminder-banner button:hover { color: var(--text); }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SIDEBAR ? CALLBACK BADGE STATES
   ============================================================ */
.badge-count-due {
    background: var(--red) !important;
    animation: pulse-badge 1.4s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

.due-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red);
    margin-left: 2px;
    vertical-align: middle;
    animation: pulse-red 1.2s ease-in-out infinite;
}

/* ============================================================
   DIAL MODAL ? CALL BACK STEP 2
   ============================================================ */
.callback-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.form-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 5px;
}

.text-red { color: var(--red); }

/* ============================================================
   STAT CARD ? ORANGE ACCENT (call backs)
   ============================================================ */
.stat-card.accent-orange { border-left-color: #f97316; }

.due-label {
    color: var(--red);
    font-weight: 700;
    font-size: 11px;
}

/* ============================================================
   DATETIME INPUT
   ============================================================ */
input[type="datetime-local"].form-control {
    color-scheme: dark;
}

/* ============================================================
   DASHBOARD ? SECTION LABELS
   ============================================================ */
.dash-section { margin-bottom: 28px; }
.dash-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}

/* ============================================================
   DASHBOARD ? PULSE ROW (today's numbers)
   ============================================================ */
.pulse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}
.pulse-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.pulse-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.pulse-card.c-green::before  { background: var(--green); }
.pulse-card.c-blue::before   { background: var(--blue); }
.pulse-card.c-yellow::before { background: var(--yellow); }
.pulse-card.c-red::before    { background: var(--red); }
.pulse-card.c-purple::before { background: var(--purple); }
.pulse-num   { font-size: 30px; font-weight: 700; line-height: 1; }
.pulse-lbl   { font-size: 11px; color: var(--muted); margin-top: 6px; letter-spacing: 0.3px; }
.pulse-card.c-green  .pulse-num { color: var(--green); }
.pulse-card.c-blue   .pulse-num { color: var(--blue); }
.pulse-card.c-yellow .pulse-num { color: var(--yellow); }
.pulse-card.c-red    .pulse-num { color: var(--red); }
.pulse-card.c-purple .pulse-num { color: var(--purple); }

/* ============================================================
   DASHBOARD ? PIPELINE ROW
   ============================================================ */
.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.pipe-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pipe-card a { text-decoration: none; color: inherit; }
.pipe-num  { font-size: 22px; font-weight: 700; color: var(--text); }
.pipe-lbl  { font-size: 11px; color: var(--muted); }
.pipe-card.alert-card { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.06); }
.pipe-card.alert-card .pipe-num { color: var(--red); }

/* ============================================================
   DASHBOARD ? FLOOR CARDS
   ============================================================ */
.floor-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}
.floor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.floor-card-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.floor-card-name .agent-pill {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface2);
    border-radius: 10px;
    padding: 2px 8px;
}
.floor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.floor-row:last-child { border-bottom: none; }
.floor-row-lbl { color: var(--muted); }
.floor-row-val { font-weight: 600; }
.floor-row-val.hi  { color: var(--green); }
.floor-row-val.warn { color: var(--red); }
.floor-card-link { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.floor-card-link:hover { border-color: var(--primary); transform: translateY(-2px); }

/* ============================================================
   DASHBOARD ? AGENT LEADERBOARD
   ============================================================ */
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.dot-green  { background: var(--green); box-shadow: 0 0 5px var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }

/* ============================================================
   DASHBOARD ? QUICK ACTIONS
   ============================================================ */
.quick-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

