/* =========================================================
   SMS — Global App CSS
   Design System: Dark mode, glassmorphism, premium feel
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@400;500;600;700&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
    /* Brand Colors */
    --primary:        #6FB0AC;
    --primary-dark:   #5F9F9B;
    --primary-light:  #E8F3F2;
    --secondary:      #86ADCE;
    --accent:         #F5C346;
    --success:        #94CF97;
    --warning:        #F5C346;
    --danger:         #EC6260;
    --info:           #86ADCE;

    /* Backgrounds & Surfaces */
    --bg-body:        #F4F6F6;
    --bg-card:        #FFFFFF;
    --bg-sidebar:     #FFFFFF;
    --bg-input:       #FFFFFF;
    --bg-hover:       #F2F2F2;
    --bg-glass:       rgba(255,255,255,0.7);

    /* Text */
    --text-primary:   #263238;
    --text-secondary: #455A64;
    --text-muted:     #78909C;
    --text-inverse:   #FFFFFF;

    /* Borders */
    --border:         #CFD8DC;
    --border-focus:   #6FB0AC;

    /* Shadows */
    --shadow-sm:      0 1px 3px rgba(38, 50, 56, 0.04);
    --shadow-md:      0 2px 8px rgba(38, 50, 56, 0.06);
    --shadow-lg:      0 8px 24px rgba(38, 50, 56, 0.08);
    --shadow-glow:    0 4px 12px rgba(111, 176, 172, 0.2);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6FB0AC, #86ADCE);
    --gradient-hero:    linear-gradient(135deg, #F4F6F6 0%, #FFFFFF 100%);

    /* Sizes */
    --sidebar-w:      260px;
    --topbar-h:       72px;
    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-xl:      24px;
    --radius-pill:    999px;

    /* Transitions */
    --transition:     all 0.2s ease-out;
    --transition-slow: all 0.3s ease-out;

    /* Fonts */
    --font-family: "Poppins", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; font-size: 15px; }

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
    font-weight: 600;
}
h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.15; }
h2 { font-size: 1.875rem; line-height: 1.2; }
h3 { font-size: 1.5rem; line-height: 1.25; }
h4 { font-size: 1.25rem; line-height: 1.3; }

p { color: var(--text-secondary); margin-bottom: 1rem; }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: none;
}
.btn-primary:hover {
    transform: translateY(-1px);
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
}
.btn-secondary:hover { background: #D5EBE9; color: var(--primary-dark); }

.btn-success  { background: var(--success);  color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-warning  { background: var(--warning);  color: var(--text-primary); }
.btn-info     { background: var(--info);     color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--primary); color: #568F8C; }
.btn-outline:hover { background: var(--primary); color: #FFFFFF; }

.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }

.btn:disabled { background: #E8ECEE !important; color: #78909C !important; border: none !important; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: none;
    transition: var(--transition);
}
.card:hover { transform: translateY(-1px); border-color: var(--primary); box-shadow: var(--shadow-sm); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); }

/* ── Glass Card ───────────────────────────────────────────── */
.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 176, 172, 0.2);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

/* ── Form Row ─────────────────────────────────────────────── */
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
    .form-row.cols-2,
    .form-row.cols-3 { grid-template-columns: 1fr; }
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table th {
    background: var(--bg-sidebar);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}
.badge-success  { background: #ECF8ED; color: #5D9F61; } /* Green */
.badge-danger   { background: #FDECEC; color: #C94F4D; } /* Coral */
.badge-warning  { background: #FFF6D9; color: #9A771B; } /* Yellow */
.badge-info     { background: #EAF2F8; color: #628EAE; } /* Blue */
.badge-primary  { background: #E8F3F2; color: #4F9692; } /* Teal */
.badge-muted    { background: var(--bg-hover); color: var(--text-muted); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: rgba(148, 207, 151, 0.15); border-color: var(--success); color: #5D9F61; }
.alert-danger  { background: rgba(236, 98, 96, 0.15);  border-color: var(--danger);  color: #C94F4D; }
.alert-warning { background: rgba(245, 195, 70, 0.15); border-color: var(--warning); color: #9A771B; }
.alert-info    { background: rgba(134, 173, 206, 0.15);  border-color: var(--info);    color: #628EAE; }

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }
.stat-change { font-size: 0.78rem; font-weight: 600; margin-top: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: var(--transition);
}
.pagination a:hover   { background: var(--bg-hover); color: var(--text-primary); }
.pagination .active   { background: var(--gradient-primary); color: #fff; border-color: transparent; }
.pagination .disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* ── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--bg-sidebar);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    border: 1px solid var(--border);
    z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(-8px); }

/* ── Utilities ────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted) !important; }
.text-primary-c { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.d-flex   { display: flex; }
.d-block  { display: block; }
.d-none   { display: none; }
.d-grid   { display: grid; }

.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0 !important; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }

.w-full  { width: 100%; }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.fs-sm   { font-size: 0.82rem; }
.fs-xs   { font-size: 0.75rem; }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.overflow-hidden { overflow: hidden; }
.pointer { cursor: pointer; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.fade-in  { animation: fadeIn  0.3s ease forwards; }
.slide-in { animation: slideIn 0.3s ease forwards; }
.pulse    { animation: pulse   1.5s ease infinite; }

/* ── Grid Layout Helpers ──────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.25s ease;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-close {
    background: var(--bg-hover);
    border: none;
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: #fff; }

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 100%; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: var(--transition);
}
.dropdown-menu.open { opacity: 1; transform: translateY(0); pointer-events: all; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none; background: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 0.875rem; }

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 14px;
    gap: 10px;
    flex: 1;
    max-width: 340px;
}
.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    padding: 9px 0;
    width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}
.page-header-left h1 { font-size: 1.5rem; }
.page-header-left p  { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ── Tab ──────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab-link {
    padding: 10px 18px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}
.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Status Pipeline ──────────────────────────────────────── */
.status-pipeline {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 4px 0;
}
.pipeline-step {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.pipeline-step.done    { background: rgba(16,185,129,0.15); color: #34d399; border-color: transparent; }
.pipeline-step.current { background: var(--gradient-primary); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }
.pipeline-arrow { color: var(--text-muted); font-size: 0.8rem; }
