/* ============================================================
   DomainAlert Bot — Main Stylesheet
   White/Light theme, modern SaaS design
   ============================================================ */

/* ─── Google Fonts ─────────────────────────────────────────── */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Brand colors */
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --primary-light: #dbeafe;
    --success:       #16a34a;
    --warning:       #d97706;
    --danger:        #dc2626;
    --info:          #0891b2;

    /* Neutrals */
    --white:         #ffffff;
    --bg-app:        #f8fafc;
    --bg-card:       #ffffff;
    --bg-sidebar:    #ffffff;
    --border:        #e2e8f0;
    --border-light:  #f1f5f9;

    /* Text */
    --text-primary:  #0f172a;
    --text-secondary:#475569;
    --text-muted:    #94a3b8;

    /* Sidebar */
    --sidebar-width: 240px;
    --navbar-height: 58px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
    --shadow-md:  0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:  0 8px 24px rgba(0,0,0,.1);

    /* Transitions */
    --transition: 0.18s ease;
}

/* ─── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; }

body {
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-app);
    margin: 0;
    padding: 0;
}

/* ─── Typography ────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-weight: 600; color: var(--text-primary); }
.fw-700 { font-weight: 700 !important; }
.text-muted { color: var(--text-muted) !important; }

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

/* ─── Navbar ────────────────────────────────────────────────── */
.navbar {
    height: var(--navbar-height);
    z-index: 1050;
    padding: 0 1rem;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.search-group .form-control,
.search-group .input-group-text {
    border-radius: 8px !important;
    border-color: var(--border);
}

.search-group {
    max-width: 380px;
}

.search-group .form-control:focus {
    box-shadow: 0 0 0 3px var(--primary-light);
    border-color: var(--primary);
}

/* Avatar circle */
.avatar-circle {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Notification badge */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Layout Wrapper ────────────────────────────────────────── */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-nav .nav { gap: 1px; }

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 16px 4px;
    text-transform: uppercase;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-secondary);
    border-radius: 0;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-app);
    color: var(--primary);
}

.sidebar-nav .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    padding: 24px;
}

/* ─── Page header ────────────────────────────────────────────── */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 14px 18px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 12px 12px 0 0 !important;
}

.card-body { padding: 18px; }

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.blue    { background: #eff6ff; color: var(--primary); }
.stat-icon.green   { background: #f0fdf4; color: var(--success); }
.stat-icon.orange  { background: #fff7ed; color: var(--warning); }
.stat-icon.red     { background: #fef2f2; color: var(--danger); }
.stat-icon.cyan    { background: #ecfeff; color: var(--info); }
.stat-icon.purple  { background: #faf5ff; color: #7c3aed; }
.stat-icon.pink    { background: #fdf2f8; color: #be185d; }
.stat-icon.teal    { background: #f0fdfa; color: #0d9488; }

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

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* ─── Tables ─────────────────────────────────────────────────── */
.table {
    font-size: 0.85rem;
    margin: 0;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-app);
    padding: 10px 12px;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover { background: #f8faff; }
.table tbody tr:last-child td { border-bottom: none; }

/* Domain name cell */
.domain-name {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.domain-name:hover { color: var(--primary-dark); text-decoration: underline; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 6px;
}

.score-badge {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.btn-sm { font-size: 0.78rem; padding: 4px 10px; }

.btn-icon {
    padding: 5px 8px;
    line-height: 1;
}

/* ─── Forms ──────────────────────────────────────────────────── */
.form-control, .form-select {
    border-color: var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-text { font-size: 0.78rem; }

/* ─── Alerts / Banners ───────────────────────────────────────── */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
}

.alert-info    { background: #eff6ff; color: var(--primary); }
.alert-success { background: #f0fdf4; color: var(--success); }
.alert-warning { background: #fff7ed; color: var(--warning); }
.alert-danger  { background: #fef2f2; color: var(--danger); }

/* ─── Tabs ───────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--border); }
.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 0;
}
.nav-tabs .nav-link.active {
    color: var(--primary);
    background: none;
    border-bottom: 2px solid var(--primary);
    font-weight: 600;
}

/* ─── Score meter ────────────────────────────────────────────── */
.score-meter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.score-circle.high   { background: #dcfce7; color: #15803d; border: 3px solid #86efac; }
.score-circle.medium { background: #fef9c3; color: #854d0e; border: 3px solid #fde047; }
.score-circle.low    { background: #fee2e2; color: #991b1b; border: 3px solid #fca5a5; }

/* Score breakdown bars */
.score-bar-row { margin-bottom: 8px; }
.score-bar-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 3px; display: flex; justify-content: space-between; }
.score-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.score-bar-fill.positive { background: var(--success); }
.score-bar-fill.negative { background: var(--danger); }

/* ─── Lifecycle timeline ─────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-date { font-size: 0.75rem; color: var(--text-muted); }
.timeline-status { font-weight: 600; font-size: 0.85rem; }

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state h5 { font-weight: 600; color: var(--text-secondary); }

/* ─── Loading ────────────────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

/* ─── Toast ──────────────────────────────────────────────────── */
.toast {
    border-radius: 10px;
    border: none;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
}

/* ─── Filters bar ────────────────────────────────────────────── */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-bar .form-control,
.filter-bar .form-select {
    font-size: 0.82rem;
    padding: 6px 10px;
    height: 34px;
}

/* ─── Scanner status dot ─────────────────────────────────────── */
.scanner-status-dot {
    cursor: default;
    transition: all var(--transition);
}

.scanner-status-dot.running i  { color: var(--success) !important; animation: pulse 1.5s infinite; }
.scanner-status-dot.idle i     { color: var(--text-muted) !important; }
.scanner-status-dot.error i    { color: var(--danger) !important; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ─── Domain detail page ─────────────────────────────────────── */
.domain-hero {
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
}

.domain-hero .domain-url {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Trademark warning */
.trademark-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    color: #92400e;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Login page ─────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

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

/* ─── Installer ──────────────────────────────────────────────── */
.installer-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.installer-card {
    max-width: 640px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.installer-header {
    background: var(--primary);
    padding: 24px 32px;
    color: #fff;
}

.installer-body { padding: 32px; }

.step-indicators {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,.4);
}

.step-dot.active { background: #fff; }
.step-dot.done   { background: rgba(255,255,255,.7); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1060;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .stat-value { font-size: 1.4rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .filter-bar { gap: 8px; }
}

@media (max-width: 576px) {
    .domain-hero .domain-url { font-size: 1.2rem; }
    .score-circle { width: 64px; height: 64px; font-size: 1.2rem; }
}

/* ─── Utilities ──────────────────────────────────────────────── */
.text-truncate-domain { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.rounded-10 { border-radius: 10px !important; }
.bg-app { background: var(--bg-app) !important; }
.border-light-custom { border-color: var(--border-light) !important; }
