:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --primary: #0056d6;
    --primary-hover: #0043a8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

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

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

/* Login Page Styles */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #091e42 0%, #0047bb 100%);
}

.login-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    max-height: 48px;
    width: auto;
    margin-bottom: 16px;
    object-fit: contain;
}

.login-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-brand p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: all 0.2s;
    font-family: var(--font);
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 214, 0.15);
}

.form-hint {
    margin-bottom: 20px;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
}

.form-hint small {
    color: var(--text-muted);
}

.form-hint code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Admin Dashboard Layout */
.admin-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 38px;
    width: auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-tag {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: var(--font);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #0f172a;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #1e293b;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: #f1f5f9;
}

.btn-danger-soft {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fee2e2;
}

.btn-danger-soft:hover {
    background: #fee2e2;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Main Content Area */
.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px;
    width: 100%;
    flex: 1;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 1.8rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f8fafc;
}

.stat-total .stat-icon { background: #eff6ff; }
.stat-new .stat-icon { background: #fffbeb; }
.stat-contacted .stat-icon { background: #f0fdf4; }
.stat-scheduled .stat-icon { background: #faf5ff; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Toolbar Form */
.toolbar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.toolbar-form {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 260px;
    background: #f8fafc;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
}

.search-box svg {
    color: var(--text-muted);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    font-family: var(--font);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-group select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: #ffffff;
    font-size: 0.875rem;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
}

/* Data Table Card */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.table-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.table-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.table-responsive {
    overflow-x: auto;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.leads-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.leads-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.leads-table tr:hover td {
    background-color: #f8fafc;
}

.cell-id {
    font-weight: 700;
    color: var(--primary);
}

.date-main {
    font-weight: 600;
    color: var(--text-primary);
}

.date-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.patient-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.patient-note-snippet {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8125rem;
    margin-bottom: 4px;
}

.contact-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.badge-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
}

.cell-dates small {
    color: var(--text-muted);
}

.status-select {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
}

.status-select.status-new {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.status-select.status-contacted {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.status-select.status-scheduled {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.status-select.status-completed {
    background: #f3e8ff;
    color: #6b21a8;
    border-color: #e9d5ff;
}

.status-select.status-archived {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.cell-actions {
    white-space: nowrap;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: #eff6ff;
}

.btn-icon.btn-del:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: #fef2f2;
}

.empty-state {
    padding: 60px 20px !important;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

/* Modal Popup */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 999;
}

.modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 540px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
    font-size: 0.9rem;
}

.detail-row {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-message-box {
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
}

.detail-message-content {
    margin-top: 6px;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .toolbar-form {
        flex-direction: column;
        align-items: stretch;
    }
}
