/* ── Lead Manager — Professional Admin Theme v2 ── */

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-bg: #eff6ff;
    --primary-ring: rgba(59,130,246,0.12);
    --sidebar-bg: #0f172a;
    --body-bg: #f1f5f9;
    --card-bg: #fff;
    --card-border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    letter-spacing: -0.3px;
}

.sidebar-header .subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    margin-top: 0.15rem;
}

.sidebar-user {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

.sidebar-user strong {
    color: #fff;
    display: block;
    font-size: 0.9rem;
}

.sidebar-nav { padding: 0.5rem 0; flex: 1; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.12s;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.8);
}

.sidebar-nav a.active {
    background: rgba(59,130,246,0.12);
    color: #fff;
    border-left-color: var(--primary);
}

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: 0.5;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.12s;
}

.sidebar-footer a:hover { color: rgba(255,255,255,0.7); }

/* ── Main ── */
.main {
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - 260px);
    overflow-x: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.main-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.3px;
}

.main-header .breadcrumb {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}

.main-header .breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border);
    transition: box-shadow 0.12s;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; color: var(--primary); }
.stat-icon.green  { background: #ecfdf3; color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }

.stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-info .stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.table thead th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 2px solid var(--card-border);
    white-space: nowrap;
}

.table thead th:first-child { border-radius: 8px 0 0 0; }
.table thead th:last-child  { border-radius: 0 8px 0 0; }

.table tbody tr { transition: background 0.1s; }

.table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #f1f5f9;
}

.table tbody td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
    color: #334155;
}

.table tbody tr:hover { background: #f8fafc; }

.table tbody tr:nth-child(even) { background: #fafbfc; }
.table tbody tr:nth-child(even):hover { background: #f1f5f9; }

/* Detail table */
.detail-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.detail-table th {
    padding: 0.6rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
    width: 140px;
}
.detail-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--card-border);
    color: #334155;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.12s ease;
    background: var(--primary);
    color: #fff;
    user-select: none;
}

.btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.25); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text);
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 6px;
}
.btn-sm:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.btn-sm:active { transform: translateY(0); }

.btn-flat {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    color: var(--primary);
    text-decoration: none;
}
.btn-flat:hover { text-decoration: underline; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
    color: var(--text-muted);
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--text);
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 600;
}

.badge-blue { background: #eff6ff; color: #3b82f6; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-red    { background: #fef2f2; color: var(--danger); }
.badge-amber  { background: var(--warning-bg); color: var(--warning); }
.badge-blue   { background: #eff6ff; color: #3b82f6; }
.badge-violet { background: #f5f3ff; color: #7c3aed; }
.badge-rose   { background: #fff1f2; color: #e11d48; }
.badge-unread { background: #dbeafe; color: #1d4ed8; }
.badge-read   { background: #e5e7eb; color: #6b7280; }
.unread-row   { background: #eff6ff !important; font-weight: 600; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label, legend {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: #334155;
}

input, textarea, select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.12s, box-shadow 0.12s;
    color: var(--text);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

::placeholder { color: var(--text-light); }

input[type="checkbox"], input[type="radio"] {
    width: auto;
    margin-right: 0.35rem;
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="number"] { width: auto; }

.hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

fieldset {
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

legend {
    font-size: 0.85rem;
    padding: 0 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
}

code.d-block {
    display: block;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text);
    word-break: break-all;
    border: 1px solid var(--card-border);
}

.field-row {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    transition: background 0.12s;
}
.field-row:hover { background: #f1f5f9; }

/* ── Alerts ── */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Login ── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 2rem;
}

.login-box {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.login-box p.subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
}

/* ── Misc ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state p { font-size: 0.95rem; }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    width: auto;
    min-width: 140px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ── Custom Modal ── */
.fe-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: feFadeIn 0.15s ease;
}
.fe-modal {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1.75rem 2rem 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
    animation: feScaleIn 0.15s ease;
}
.fe-modal h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.fe-modal p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}
.fe-modal-actions { display: flex; gap: 0.75rem; justify-content: center; }
.fe-modal-actions .btn { min-width: 90px; justify-content: center; }
@keyframes feFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes feScaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: 100%; min-height: auto; position: static; height: auto; }
    .main { max-width: 100%; padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .layout { flex-direction: column; }
    .filter-bar input, .filter-bar select { min-width: 100px; flex: 1; }
}
