/* ══════════════════════════════════════════════════════════════
   Spotlight CRM — Main Stylesheet
══════════════════════════════════════════════════════════════ */

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    background: linear-gradient(180deg,
        #6b7280 0%,
        #374151 20%,
        #1f2937 50%,
        #111827 75%,
        #030712 100%);
    color: #fff;
    width: 240px;
    min-height: 100vh;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    z-index: 50;
}

@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        height: 100vh;
        transform: translateX(-100%);
    }
    .sidebar.sidebar-open { transform: translateX(0); }
}

.sidebar-logo { padding: 16px 20px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo-img { width: 40px; height: 40px; object-fit: contain; filter: brightness(0) invert(1); flex-shrink: 0; }

.sidebar-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    padding: 12px 20px 6px;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Nav links ───────────────────────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 0.875rem;
    color: #d1d5db;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: #818cf8;
}
.nav-link.active {
    background: rgba(99,102,241,0.2);
    color: #fff;
    border-left-color: #6366f1;
    font-weight: 600;
}
.nav-icon { width: 18px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    padding: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex-shrink: 0;
}
.stat-value { font-size: 1.75rem; font-weight: 700; color: #0f172a; line-height: 1; }
.stat-label { font-size: 0.8rem; color: #64748b; margin-top: 3px; }

/* ── Alert cards (dashboard) ─────────────────────────────────── */
.alert-card {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid;
    margin-bottom: 10px;
    font-size: 0.875rem;
}
.alert-card:last-child { margin-bottom: 0; }
.alert-card.alert-red    { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert-card.alert-orange { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.alert-card.alert-blue   { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-card .alert-icon  { margin-top: 1px; flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    font-size: 0.875rem; font-weight: 500;
    cursor: pointer; border: none;
    transition: all 0.15s ease;
    text-decoration: none; white-space: nowrap;
}
.btn-primary  { background: #4f46e5; color: #fff; }
.btn-primary:hover  { background: #4338ca; }
.btn-success  { background: #10b981; color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-danger   { background: #ef4444; color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-ghost    { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-ghost:hover    { background: #e2e8f0; }
.btn-outline  { background: transparent; color: #4f46e5; border: 1px solid #6366f1; }
.btn-outline:hover  { background: #eef2ff; }
.btn-sm  { padding: 5px 11px; font-size: 0.8rem; }
.btn-icon{ padding: 6px 9px; }

/* ── Tables ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead tr { border-bottom: 2px solid #e2e8f0; }
.data-table thead th {
    text-align: left; padding: 11px 16px;
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b;
}
.data-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background 0.1s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td { padding: 13px 16px; color: #334155; vertical-align: middle; }
.data-table tbody tr:last-child { border-bottom: none; }
.action-btns { display: flex; gap: 6px; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600;
    text-transform: capitalize; white-space: nowrap;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 680px;
    max-height: 92vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
}
.modal-box.modal-lg  { max-width: 860px; }
.modal-box.modal-xl  { max-width: 1040px; }
.modal-box.modal-sm  { max-width: 480px; }

.modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 22px 28px 18px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; color: #0f172a; }
.modal-header p  { font-size: 0.8rem; color: #64748b; margin-top: 2px; }

.modal-close-btn {
    background: #f1f5f9; border: none; border-radius: 8px;
    width: 32px; height: 32px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #64748b; transition: all 0.15s; flex-shrink: 0; margin-left: 12px;
}
.modal-close-btn:hover { background: #e2e8f0; color: #0f172a; }

.modal-body { padding: 22px 28px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 16px 28px;
    border-top: 1px solid #e2e8f0;
    display: flex; justify-content: flex-end; gap: 10px;
    flex-shrink: 0; background: #f8fafc; border-radius: 0 0 16px 16px;
}

/* ── Modal Tabs ──────────────────────────────────────────────── */
.modal-tabs {
    display: flex; gap: 0;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 28px;
    overflow-x: auto;
    flex-shrink: 0;
    background: #fff;
}
.tab-btn {
    padding: 11px 16px;
    font-size: 0.82rem; font-weight: 500;
    color: #64748b;
    border: none; background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tab-btn:hover  { color: #4f46e5; }
.tab-btn.active { color: #4f46e5; border-bottom-color: #6366f1; font-weight: 600; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
    display: block; font-size: 0.82rem;
    font-weight: 500; color: #374151; margin-bottom: 5px;
}
.form-label .req { color: #ef4444; margin-left: 2px; }

.form-input, .form-select, .form-textarea {
    width: 100%; padding: 8px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 0.875rem; color: #0f172a;
    background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
    outline: none; box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-textarea { resize: vertical; min-height: 82px; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 560px) {
    .form-grid, .form-grid3 { grid-template-columns: 1fr; }
}

.form-section-title {
    font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: #6366f1; margin: 22px 0 14px;
    padding-bottom: 6px; border-bottom: 1px solid #e0e7ff;
}
.form-section-title:first-child { margin-top: 0; }

/* Input with $ prefix */
.input-money { position: relative; }
.input-money span {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: #64748b; font-size: 0.875rem; pointer-events: none;
}
.input-money input { padding-left: 24px; }

/* Other text input (shown when "Other" selected) */
.other-input {
    margin-top: 6px;
    display: none;
}
.other-input.visible { display: block; }

/* Checkbox pills (services multi-select) */
.checkbox-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checkbox-pill  {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 20px;
    border: 1px solid #d1d5db; background: #f8fafc;
    font-size: 0.82rem; cursor: pointer;
    transition: all 0.15s; user-select: none;
}
.checkbox-pill:hover { border-color: #6366f1; background: #eef2ff; }
.checkbox-pill input { display: none; }
.checkbox-pill.checked { background: #eef2ff; border-color: #6366f1; color: #4f46e5; font-weight: 500; }

/* Toggle (Y/N) */
.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row label { font-size: 0.875rem; color: #374151; }
.toggle-switch {
    position: relative; width: 42px; height: 24px;
    display: inline-block; cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute; inset: 0; background: #d1d5db;
    border-radius: 12px; transition: 0.2s;
}
.toggle-slider::before {
    content: ''; position: absolute;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px;
    transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: #6366f1; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px; gap: 12px;
}
.page-header h2 { font-size: 1.15rem; font-weight: 700; color: #0f172a; }
.page-header p  { font-size: 0.82rem; color: #64748b; margin-top: 3px; }

/* ── Search / filter bar ─────────────────────────────────────── */
.filter-bar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 18px; flex-wrap: wrap;
}
.search-input {
    flex: 1; min-width: 200px;
    padding: 8px 12px 8px 36px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 0.875rem; outline: none; background: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 10px center;
}
.search-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }

/* ── Payment schedule table ──────────────────────────────────── */
.payment-schedule { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 8px; }
.payment-schedule th {
    background: #f8fafc; padding: 9px 14px;
    text-align: left; font-size: 0.75rem; font-weight: 600;
    color: #64748b; text-transform: uppercase; letter-spacing: 0.05em;
}
.payment-schedule td { padding: 10px 14px; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.payment-schedule tr.paid td { background: #f0fdf4; }
.payment-schedule tr.overdue td { background: #fff1f2; }

.pay-status-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px;
}
.pay-status-dot.paid    { background: #10b981; }
.pay-status-dot.unpaid  { background: #d1d5db; }
.pay-status-dot.overdue { background: #ef4444; }

/* ── Milestones ──────────────────────────────────────────────── */
.milestone-panel {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 16px; margin-top: 8px;
}
.milestone-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.milestone-item:last-child { border-bottom: none; }
.milestone-check {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid #cbd5e1; flex-shrink: 0;
    cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.milestone-check.done { background: #10b981; border-color: #10b981; }
.milestone-check.done::after { content: '✓'; color: #fff; font-size: 11px; font-weight: 700; }
.milestone-title { font-size: 0.875rem; font-weight: 500; color: #334155; }
.milestone-title.done { text-decoration: line-through; color: #94a3b8; }
.milestone-meta { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }

/* ── Client Journey Timeline ─────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px;
    width: 2px; background: #e2e8f0;
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
    position: absolute; left: -24px; top: 3px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #6366f1; border: 2px solid #fff;
    box-shadow: 0 0 0 2px #6366f1;
}
.timeline-dot.tl-lead     { background: #3b82f6; box-shadow: 0 0 0 2px #3b82f6; }
.timeline-dot.tl-proposal { background: #8b5cf6; box-shadow: 0 0 0 2px #8b5cf6; }
.timeline-dot.tl-deal     { background: #10b981; box-shadow: 0 0 0 2px #10b981; }
.timeline-dot.tl-post     { background: #f59e0b; box-shadow: 0 0 0 2px #f59e0b; }
.timeline-date { font-size: 0.72rem; color: #94a3b8; margin-bottom: 2px; }
.timeline-action { font-size: 0.875rem; font-weight: 600; color: #0f172a; }
.timeline-detail { font-size: 0.8rem; color: #64748b; margin-top: 2px; }
.timeline-by { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }

/* ── Edit version list ───────────────────────────────────────── */
.version-item {
    border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 14px 16px; margin-bottom: 10px; background: #fafafa;
}
.version-item:last-child { margin-bottom: 0; }
.version-badge {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: 20px;
    background: #dbeafe; color: #1e40af;
    font-size: 0.75rem; font-weight: 700; margin-bottom: 6px;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #0f172a; color: #fff;
    padding: 12px 20px; border-radius: 10px;
    font-size: 0.875rem; font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
    z-index: 200; opacity: 1; transition: opacity 0.4s;
    display: flex; align-items: center;
}
.toast.hidden { display: none; }
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
.toast.warning { background: #92400e; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 20px; color: #94a3b8; }
.empty-state i { font-size: 2.8rem; margin-bottom: 12px; display: block; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; }

/* ── Login page ──────────────────────────────────────────────── */
.login-logo {
    width: 100px; height: 100px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    margin: 0 auto 12px;
    display: block;
}
.login-logo-fallback {
    width: 72px; height: 72px;
    background: #4f46e5; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px;
}

/* ── Responsive tweaks ───────────────────────────────────────── */
@media (max-width: 640px) {
    .modal-box { border-radius: 12px; }
    .modal-header, .modal-body, .modal-footer { padding-left: 18px; padding-right: 18px; }
    .modal-tabs { padding: 0 18px; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
