/* ============================================================
   WebRate — CSS complet, fara dependente externe
   ============================================================ */

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

:root {
    --brand:       #2563eb;
    --brand-dark:  #1d4ed8;
    --brand-light: #eff6ff;
    --brand-text:  #1e40af;
    --bg:          #f8fafc;
    --surface:     #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-muted:  #64748b;
    --text-faint:  #94a3b8;
    --success:     #10b981;
    --warning:     #f59e0b;
    --danger:      #ef4444;
    --radius:      10px;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,.1);
}

html { height: 100%; }
body {
    min-height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
    font: inherit;
    border: none;
    outline: none;
    background: none;
}
button { cursor: pointer; }

/* ─── Layout ────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
main.container { padding-top: 32px; padding-bottom: 64px; }
main.fullwidth  { padding: 0; }

/* ─── Navbar ────────────────────────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 18px;
    color: var(--brand-text);
}
.navbar-logo svg { color: var(--brand); }
.navbar-links {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    font-weight: 500;
}
.navbar-links a { color: var(--text-muted); transition: color .15s; }
.navbar-links a:hover,
.navbar-links a.active { color: var(--brand); }
.navbar-right { display: flex; align-items: center; gap: 10px; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    transition: all .15s;
    cursor: pointer;
    border: 1.5px solid transparent;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { color: var(--brand); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Credits badge */
.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    border-radius: 100px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 700;
}

/* ─── User dropdown ─────────────────────────────────────────── */
.user-menu { position: relative; }
.user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background .15s;
}
.user-trigger:hover { background: var(--bg); }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.dropdown {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text);
    transition: background .1s;
    border-top: 1px solid transparent;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg); }
.dropdown .divider { border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown .danger { color: var(--danger); }

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 24px; }
.card-sm .card-body { padding: 16px; }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s;
}
.form-control:focus { border-color: var(--brand); outline: none; }
.form-control.error { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-hint  { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ─── Grid & utilities ──────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media(max-width:900px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media(max-width:600px) { .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-lg { font-size: 17px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 24px; }
.text-muted { color: var(--text-muted); } .text-faint { color: var(--text-faint); }
.text-brand { color: var(--brand); } .text-danger { color: var(--danger); }
.text-success { color: var(--success); } .text-warning { color: var(--warning); }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ─── Badges / Tags ─────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ─── Score ring ────────────────────────────────────────────── */
.score-ring { stroke-dasharray: 251.2; transition: stroke-dashoffset 1s ease; }
.score-display { position: relative; display: inline-block; }
.score-number {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
}

/* ─── Flash messages ────────────────────────────────────────── */
.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex; align-items: center; gap: 8px;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ─── Hero ──────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    color: #fff;
    padding: 64px 20px;
    text-align: center;
    margin-bottom: 40px;
}
.hero h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 900; line-height: 1.15; margin-bottom: 16px; }
.hero p  { color: #bfdbfe; font-size: 17px; max-width: 560px; margin: 0 auto 28px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-white { background: #fff; color: var(--brand-dark); font-weight: 700; }
.btn-white:hover { background: #f0f4ff; }
.btn-outline-white { border: 1.5px solid rgba(255,255,255,.4); color: #fff; }
.btn-outline-white:hover { background: rgba(255,255,255,.1); }

/* ─── Stats bar ─────────────────────────────────────────────── */
.stats-bar { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 40px; }
@media(max-width:600px) { .stats-bar { grid-template-columns: repeat(2,1fr); } }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 900; color: var(--text); }
.stat-card .lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Site cards ────────────────────────────────────────────── */
.site-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow .15s;
    text-decoration: none;
    color: inherit;
}
.site-card:hover { box-shadow: var(--shadow-md); }
.site-card .favicon { width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; }
.site-card .info { flex: 1; min-width: 0; }
.site-card .domain { font-weight: 600; font-size: 14px; }
.site-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.site-card .score-col { text-align: right; flex-shrink: 0; }
.site-card .score-col .score { font-size: 22px; font-weight: 900; }
.score-green  { color: var(--success); }
.score-yellow { color: var(--warning); }
.score-red    { color: var(--danger); }
.score-gray   { color: var(--text-faint); }

/* ─── Section headers ───────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { font-size: 18px; font-weight: 700; }

/* ─── Features ──────────────────────────────────────────────── */
.features { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-bottom: 40px; }
@media(max-width:700px) { .features { grid-template-columns: 1fr; } }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.feature-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ─── CTA box ───────────────────────────────────────────────── */
.cta-box { background: var(--brand-light); border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 32px; text-align: center; }
.cta-box h2 { font-size: 20px; font-weight: 700; color: var(--brand-text); margin-bottom: 8px; }
.cta-box p  { color: #3b82f6; font-size: 14px; margin-bottom: 20px; }

/* ─── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 10px 12px; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ─── Pagination ────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.page-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 14px; font-weight: 600;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    transition: all .15s;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ─── Auth layout ───────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo a { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--brand-text); }
.auth-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-sub   { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-footer { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 20px; }
.auth-footer a { color: var(--brand); font-weight: 600; }

/* ─── Dashboard ─────────────────────────────────────────────── */
.dash-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 32px; }
@media(max-width:700px) { .dash-stats { grid-template-columns: repeat(2,1fr); } }
.dash-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.dash-stat .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.dash-stat .value { font-size: 26px; font-weight: 900; color: var(--text); }

/* ─── Progress bar ──────────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; background: var(--brand); transition: width 1s ease; }

/* ─── Filter bar ────────────────────────────────────────────── */
.filter-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.filter-bar select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); background: var(--surface); }
.filter-bar select:focus { border-color: var(--brand); outline: none; }

/* ─── Score buttons (review form) ───────────────────────────── */
.score-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.score-btn {
    width: 34px; height: 34px;
    border-radius: 6px; font-size: 12px; font-weight: 700;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    transition: all .1s;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.score-btn:hover { border-color: var(--brand); color: var(--brand); }
.score-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ─── Footer ────────────────────────────────────────────────── */
footer {
    margin-top: 64px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 32px 20px;
}
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; color: var(--brand-text); }
.footer-links { display: flex; gap: 20px; font-size: 14px; color: var(--text-muted); }
.footer-links a:hover { color: var(--brand); }
.footer-copy { font-size: 12px; color: var(--text-faint); }

/* ─── Spinner ───────────────────────────────────────────────── */
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty state ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); font-size: 14px; }

/* ─── Danger zone ───────────────────────────────────────────── */
.danger-zone { border: 1.5px solid #fca5a5; border-radius: var(--radius); padding: 20px; margin-top: 24px; }
.danger-zone h3 { color: var(--danger); font-size: 15px; margin-bottom: 8px; }
