/* ===== SEO Sniper — Ultra Modern SaaS Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1a1a2e;
    --primary-dark: #0f0f1a;
    --primary-light: #2d2d4a;
    --primary-bg: rgba(26,26,46,0.06);
    --accent: #4361ee;
    --accent-light: #6b83f2;
    --accent-bg: rgba(67,97,238,0.08);
    --success: #0d9f6e;
    --success-bg: rgba(13,159,110,0.08);
    --warning: #e6a817;
    --warning-bg: rgba(230,168,23,0.08);
    --danger: #e53e3e;
    --danger-bg: rgba(229,62,62,0.08);
    --info: #3182ce;
    --info-bg: rgba(49,130,206,0.08);
    --bg: #eef1f6;
    --bg-page: #f5f7fa;
    --bg-card: #ffffff;
    --bg-input: #f5f7fa;
    --bg-hover: #fafbfc;
    --text: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #8e90a6;
    --border: #e4e6ef;
    --border-light: #eff0f6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
    --sidebar-w: 260px;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

::selection { background: var(--accent); color: white; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== AUTH PAGES ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.auth-container {
    background: var(--bg-card);
    padding: 48px 40px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-container h1 {
    font-size: 26px;
    margin-bottom: 8px;
    text-align: center;
}

.auth-container .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}

.auth-container .logo {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--primary);
    letter-spacing: -0.03em;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
    background: white;
}

.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,26,46,0.2);
}

.btn-accent {
    background: var(--accent);
    color: white;
}
.btn-accent:hover {
    background: var(--accent-light);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67,97,238,0.25);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.05); text-decoration: none; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.05); text-decoration: none; }

.btn-outline {
    background: white;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
    background: var(--primary-bg);
}

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    padding: 28px 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 1px 0 0 var(--border-light);
}

.sidebar-logo {
    padding: 0 28px;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 36px;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.sidebar-nav {
    list-style: none;
    padding: 0 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-xs);
    transition: var(--transition);
    margin-bottom: 2px;
}

.sidebar-nav a:hover {
    color: var(--text);
    background: var(--bg-input);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 600;
    text-decoration: none;
}

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

.sidebar-section {
    padding: 0 28px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 28px 0 8px;
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 13px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}
.sidebar-footer a:hover { background: var(--danger-bg); color: var(--danger); text-decoration: none; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 32px 40px;
    max-width: 1320px;
}

.content-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-header h1 { font-size: 26px; }

.page-header .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}
.page-header .breadcrumb a { color: var(--accent); }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h2, .card-header h3 { font-size: 16px; }

/* ===== GRID ===== */
.grid { display: grid; gap: 16px; }

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.stat-card .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
    padding: 3px 8px;
    border-radius: 6px;
}

.stat-card.primary .stat-icon { background: var(--primary-bg); color: var(--primary); }
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.info .stat-icon { background: var(--accent-bg); color: var(--accent); }
.stat-card.info .stat-value { color: var(--accent); }

/* ===== TABLE ===== */
.table-container { overflow-x: auto; border-radius: var(--radius-xs); }

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--bg-input);
    border: none;
}

th:first-child { border-radius: var(--radius-xs) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-xs) 0 0; }

td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
tr.user-row td { background: var(--accent-bg); }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-running, .badge-scraping { background: var(--accent-bg); color: var(--accent); }
.badge-completed, .badge-approved, .badge-published { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-discovered { background: var(--primary-bg); color: var(--text-muted); }
.badge-targeted, .badge-analyzing, .badge-generating { background: var(--accent-bg); color: var(--accent); }

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-xs);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-info {
    background: var(--accent-bg);
    color: var(--accent);
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; font-size: 14px; }

/* ===== SERP AUDIT ===== */
.position-map { margin: 16px 0; }
.position-map-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-xs);
    margin-bottom: 4px; font-size: 14px;
    transition: var(--transition);
}
.position-map-item:hover { background: var(--bg-hover); }
.position-map-item.is-user {
    background: var(--accent-bg);
    border: 1.5px solid var(--accent-light);
}
.position-rank {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    background: var(--bg-input); color: var(--text);
    flex-shrink: 0;
}
.position-rank.top3 { background: var(--primary); color: #fff; }
.position-bar {
    flex: 1; height: 4px; background: var(--border-light);
    border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.position-bar-fill { height: 100%; border-radius: 2px; }

.competitor-card {
    border-left: 3px solid var(--border);
    padding-left: 20px; margin-bottom: 24px;
    padding-bottom: 24px; border-bottom: 1px solid var(--border-light);
}
.competitor-card:last-child { border-bottom: none; margin-bottom: 0; }
.competitor-card.is-user { border-left-color: var(--accent); }
.competitor-card h4 { font-size: 15px; margin-bottom: 8px; }
.competitor-card .meta-info { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

.metric-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px; margin-bottom: 16px;
}
.metric-item {
    background: var(--bg-input); padding: 14px; border-radius: var(--radius-xs);
    text-align: center;
}
.metric-item .metric-value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.metric-item .metric-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; font-weight: 600; }

.recommendations-section h4 {
    font-size: 15px; margin: 20px 0 8px;
    color: var(--accent);
    padding-bottom: 6px; border-bottom: 1px solid var(--border-light);
}
.recommendations-section ul { padding-left: 20px; }
.recommendations-section li { margin-bottom: 8px; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }

/* ===== UTILITIES ===== */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.text-secondary { color: var(--text-secondary); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
