/* static/css/style.css */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px 0;
    margin-bottom: 24px;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header-meta { display: flex; align-items: center; gap: 16px; font-size: 14px; color: #666; }

/* Refresh button */
.btn-refresh {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.btn-refresh:hover { background: #1d4ed8; }
.btn-refresh:disabled { background: #93c5fd; cursor: not-allowed; }

/* Metric cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.metric-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}
.metric-card .label { font-size: 13px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-card .value { font-size: 28px; font-weight: 700; margin: 4px 0; }
.metric-card .change { font-size: 14px; font-weight: 500; }
.metric-card .change.positive { color: #16a34a; }
.metric-card .change.negative { color: #dc2626; }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.chart-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}
.chart-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* Tables */
.table-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}
.table-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
}
th:hover { color: #1a1a1a; }
td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
tr:hover td { background: #fafafa; }
.url-cell { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toast notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    padding-right: 36px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    z-index: 100;
    cursor: pointer;
}
.toast.error { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.toast.success { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.empty-state h2 { margin-bottom: 8px; }

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
}

/* Navigation */
.nav {
    background: #1a1a1a;
    padding: 0;
}
.nav-inner {
    display: flex;
    gap: 0;
}
.nav-link {
    color: #999;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}
.nav-link:hover { color: #fff; }
.nav-link.active {
    color: #fff;
    border-bottom-color: #2563eb;
}

/* View toggle */
.view-toggle {
    display: inline-flex;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}
.view-toggle button {
    background: #fff;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border-right: 1px solid #e0e0e0;
}
.view-toggle button:last-child { border-right: none; }
.view-toggle button.active {
    background: #2563eb;
    color: #fff;
}
.view-toggle button:hover:not(.active) { background: #f5f5f5; }

/* Expandable rows */
.expandable-row { cursor: pointer; }
.expandable-row:hover td { background: #f0f7ff; }
.expand-icon { display: inline-block; width: 16px; transition: transform 0.2s; }
.expand-icon.open { transform: rotate(90deg); }
.detail-row { display: none; }
.detail-row.open { display: table-row; }
.detail-row td { padding: 0 12px 12px 40px; background: #fafafa; }
.sub-table { width: 100%; }
.sub-table th { font-size: 12px; padding: 6px 8px; border-bottom: 1px solid #e0e0e0; }
.sub-table td { font-size: 13px; padding: 6px 8px; border-bottom: 1px solid #f0f0f0; }

/* Brand filter */
.brand-filter {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}
.brand-filter:focus { border-color: #2563eb; }

/* Badges */
.badge-new {
    background: #dbeafe;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.badge-lost {
    background: #fee2e2;
    color: #dc2626;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Login page */
.login-container {
    max-width: 360px;
    margin: 120px auto;
    padding: 40px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
}
.login-container h1 { font-size: 20px; margin-bottom: 24px; }
.login-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}
.login-input:focus { border-color: #2563eb; }
.login-error { color: #dc2626; font-size: 14px; margin-bottom: 12px; }

/* Logout link in nav */
.nav-logout {
    margin-left: auto;
}

/* Content type badges */
.content-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}
.content-type-article { background: #e0e7ff; color: #3730a3; }
.content-type-video { background: #fce7f3; color: #be185d; }
.content-type-faq { background: #d1fae5; color: #065f46; }
.content-type-news { background: #fef3c7; color: #92400e; }
.content-type-featured_snippet { background: #fef9c3; color: #854d0e; }
