/* SEO Extractor - Main Stylesheet */

@font-face {
    font-family: 'Space Grotesk';
    src: url('/static/fonts/SpaceGrotesk-Variable.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --primary-color: #dc3545;
    --primary-hover: #c82333;
    --secondary-color: #6c757d;
    --success-color: #1a1a1a;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;

    --text-color: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --bg-light: #f8f9fa;
    --bg-white: #fff;

    --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-heading: 'Geist', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 6px;
    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-y: scroll;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--text-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    font-family: var(--font-family-heading);
}

.nav-brand a:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-color);
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px;
    flex: 1;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--text-color);
}

.breadcrumb .breadcrumb-current {
    color: var(--primary-color);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: #1a1a1a;
    color: white;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: white;
    color: var(--text-color);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-light);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Cards
   ============================================ */
.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.client-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.client-card:hover {
    box-shadow: var(--box-shadow);
}

.client-card-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.client-card-header h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.client-card-header h3 a {
    color: var(--text-color);
}

.client-website {
    font-size: 12px;
    color: var(--text-muted);
}

.client-card-body {
    padding: 15px;
}

.client-notes {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.client-stats {
    font-size: 13px;
}

.client-stats .stat {
    color: var(--text-muted);
}

.client-stats .stat strong {
    color: var(--text-color);
}

.client-card-footer {
    padding: 15px;
    background: var(--bg-light);
    display: flex;
    gap: 10px;
}

/* ============================================
   Forms
   ============================================ */
.form-container {
    max-width: 600px;
}

.form {
    background: var(--bg-white);
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #999;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-light);
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions .btn,
.data-table .actions form {
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.data-table .actions form:last-child,
.data-table .actions .btn:last-child {
    margin-right: 0;
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    text-transform: capitalize;
}

.status-pending {
    background: #f0f0f0;
    color: #666;
}

.status-extracted {
    background: #f0f0f0;
    color: #333;
}

.status-processed {
    background: #f0f0f0;
    color: #333;
}

.status-completed {
    background: #f0f0f0;
    color: #333;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: #1a1a1a;
    color: white;
    border-radius: 10px;
    margin-left: 5px;
}

/* ============================================
   Flash Messages
   ============================================ */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background: #d4edda;
    color: #155724;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
}

.flash-warning {
    background: #fff3cd;
    color: #856404;
}

.flash-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
}

.flash-close:hover {
    opacity: 1;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 30px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.empty-state h2,
.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-muted);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
}

/* ============================================
   Setup Section
   ============================================ */
.setup-section {
    margin-top: 40px;
    padding: 20px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.setup-section h3 {
    margin-bottom: 15px;
}

.status-list {
    list-style: none;
    margin-bottom: 15px;
}

.status-list li {
    padding: 8px 0;
}

.status-ok::before {
    content: '✓';
    color: #1a1a1a;
    margin-right: 10px;
}

.status-missing::before {
    content: '✗';
    color: var(--danger-color);
    margin-right: 10px;
}

/* ============================================
   Danger Zone
   ============================================ */
.danger-zone {
    margin-top: 40px;
    padding: 20px;
    background: #fff5f5;
    border: 1px solid var(--danger-color);
    border-radius: var(--border-radius);
}

.danger-zone h3 {
    color: var(--danger-color);
    margin-bottom: 10px;
}

.danger-zone p {
    margin-bottom: 15px;
    color: var(--text-muted);
}

/* ============================================
   Text Utilities
   ============================================ */
.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
    text-align: center;
    padding: 80px 30px;
}

.error-page h1 {
    font-size: 72px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.error-page p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* ============================================
   Responsive
   ============================================ */
/* ============================================
   Dark Mode
   ============================================ */
[data-theme="dark"] {
    --primary-color: #ff6b6b;
    --primary-hover: #ff5252;
    --secondary-color: #868e96;
    --success-color: #e0e0e0;
    --warning-color: #ffd43b;
    --danger-color: #ff6b6b;
    --info-color: #3bc9db;

    --text-color: #d4d4d4;
    --text-muted: #909090;
    --border-color: #3a3a3a;
    --bg-light: #1a1a1e;
    --bg-white: #242428;

    --box-shadow: 0 2px 4px rgba(0,0,0,0.3);

    color-scheme: dark;
}

/* Buttons need explicit overrides for hardcoded colors */
[data-theme="dark"] .btn-secondary {
    background: #2e2e32;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-secondary:hover {
    background: #36363a;
}

[data-theme="dark"] .btn-primary {
    background: #e0e0e0;
    color: #1a1a1a;
}

[data-theme="dark"] .btn-primary:hover {
    background: #fff;
}

[data-theme="dark"] .btn-warning {
    color: #1a1a1e;
}

/* Status badges */
[data-theme="dark"] .status-pending {
    background: #2e2e32;
    color: #909090;
}

[data-theme="dark"] .status-extracted {
    background: #2e2e32;
    color: #d4d4d4;
}

[data-theme="dark"] .status-processed,
[data-theme="dark"] .status-completed {
    background: #2e2e32;
    color: #d4d4d4;
}

/* Flash messages */
[data-theme="dark"] .flash-success {
    background: #1a3326;
    color: #51cf66;
}

[data-theme="dark"] .flash-error {
    background: #3d1a1a;
    color: #ff6b6b;
}

[data-theme="dark"] .flash-warning {
    background: #3d3316;
    color: #ffd43b;
}

/* Alerts */
[data-theme="dark"] .alert-warning {
    background: #3d3316;
    border-color: #665520;
    color: #ffd43b;
}

[data-theme="dark"] .alert-danger {
    background: #3d1a1a;
    border-color: #662020;
    color: #ff6b6b;
}

/* Danger zone */
[data-theme="dark"] .danger-zone {
    background: #2d1a1a;
    border-color: var(--danger-color);
}

/* Form inputs */
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
    background: #1a1a1e;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus {
    border-color: #666;
}

/* Table row hover */
[data-theme="dark"] .data-table tr:hover td {
    background: #2e2e32;
}

/* Card header links */
[data-theme="dark"] .client-card-header h3 a {
    color: var(--text-color);
}

/* Generic .table class (used in edit_client) */
[data-theme="dark"] .table {
    color: var(--text-color);
}
[data-theme="dark"] .table th {
    background: #1a1a1e;
    color: #909090;
    border-color: var(--border-color);
}
[data-theme="dark"] .table td {
    border-color: var(--border-color);
}

/* Nav brand */
[data-theme="dark"] .nav-brand a {
    color: var(--text-color);
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--text-color);
    border-color: var(--text-muted);
}

.theme-toggle svg {
    display: block;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .client-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }
}
