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

body {
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    background: #f9fafb;
    color: #111827;
}

/* Navigation */
nav {
    background: #1f2937;
    color: white;
    padding: 1rem;
}

.nav-container {
    max-width: 1200px;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-brand {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.25rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right span {
    color: #d1d5db;
}

.nav-right a {
    color: #d1d5db;
    text-decoration: none;
    margin-left: 1rem;
}

.nav-right a:hover {
    color: white;
}

/* Main content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Login page */
.login-container {
    text-align: center;
    margin-top: 4rem;
}

.login-container h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.login-container p {
    color: #6b7280;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-google {
    background: #4285f4;
    color: white;
}

.btn-google:hover {
    background: #3367d6;
    color: white;
}

/* Dashboard */
.dashboard-container h1 {
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
    color: #1f2937;
}

.dashboard-container > p {
    color: #6b7280;
    margin-bottom: 2rem;
}

.dashboard-actions {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dashboard-actions p {
    margin: 0;
    color: #6b7280;
}

/* Wizard */
.wizard-container {
    max-width: 800px;
    margin: 48px auto 0;
}

.wizard-container h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2937;
    margin-bottom: 24px;
}

.wizard-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

.wizard-card-heading {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: #111827;
    margin: 0 0 16px;
}

/* Forms */
.form-label {
    display: block;
    font-size: 0.875rem;
    color: #111827;
    margin-bottom: 4px;
}

.form-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
}

.form-input:focus {
    outline: 2px solid #4285f4;
    outline-offset: -1px;
    border-color: #4285f4;
}

.form-help {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 4px 0 16px;
}

.btn-primary {
    background: #4285f4;
    color: #ffffff;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary:hover {
    background: #3367d6;
}

/* Banners */
.banner {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.banner-error {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
}

.banner-warning {
    background: #fffbeb;
    border-left: 4px solid #d97706;
    color: #92400e;
}

.banner-info {
    background: #eff6ff;
    border-left: 4px solid #4285f4;
    color: #1e40af;
}

/* Progress */
.progress-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #4285f4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.summary-success {
    color: #16a34a;
    font-size: 1rem;
    margin: 0 0 16px;
}

/* (Gallery styles moved to inline <style> in templates, powered by lightGallery) */

.text-muted {
    color: #6b7280;
}

/* Tab switching — radios are siblings of panels inside .wizard-card */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.tab-radio {
    display: none;
}

.tab-label {
    padding: 8px 16px;
    font-size: 0.875rem;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

/* Active tab label — use :has() since labels are inside .tab-bar */
.wizard-card:has(#tab-domain:checked) label[for="tab-domain"],
.wizard-card:has(#tab-urls:checked) label[for="tab-urls"],
.wizard-card:has(#tab-upload:checked) label[for="tab-upload"] {
    color: #111827;
    font-weight: 700;
    border-bottom-color: #4285f4;
}

/* Tab panels: show only when corresponding radio is checked */
.tab-panel {
    display: none;
}

#tab-domain:checked ~ #panel-domain,
#tab-urls:checked ~ #panel-urls,
#tab-upload:checked ~ #panel-upload {
    display: block;
}

/* Textarea */
.form-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* (Drop zone replaced by FilePond) */

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 90vw;
    text-align: center;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 6s forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; pointer-events: none; }
}

/* ===== Review Table (Phase 5) ===== */

/* Review container — wider than wizard-container to accommodate table */
.review-container {
    max-width: 1100px;
    margin: 48px auto 0;
}

.review-container h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2937;
    margin-bottom: 24px;
}

/* Review table */
.review-table {
    width: 100%;
    border-collapse: collapse;
}

.review-table th {
    font-size: 0.875rem;
    font-weight: 700;
    color: #6b7280;
    padding: 8px 12px;
    border-bottom: 2px solid #e5e7eb;
    text-align: left;
}

/* Review rows */
.review-row {
    background: #ffffff;
}

.review-row:hover {
    background: #f9fafb;
}

.review-row td {
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.review-row--decorative {
    opacity: 0.55;
}

.review-row--failed {
    background: #fef2f2;
}

.review-row--editing {
    background: #eff6ff;
}

.review-row--saved {
    animation: save-flash 600ms ease forwards;
}

@keyframes save-flash {
    0% { background-color: #f0fdf4; }
    100% { background-color: #ffffff; }
}

@media (prefers-reduced-motion: reduce) {
    .review-row--saved {
        animation: none;
        background-color: #f0fdf4;
    }
}

/* Thumbnail */
.review-thumb {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #f3f4f6;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Alt text cell */
.alt-cell {
    cursor: pointer;
}

.alt-cell:hover {
    text-decoration: underline dotted;
}

.alt-cell--decorative {
    color: #9ca3af;
    font-style: italic;
    cursor: default;
}

.alt-cell--decorative:hover {
    text-decoration: none;
}

/* Character counter */
.char-counter {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: right;
    margin-top: 4px;
}

.char-counter--over {
    color: #dc2626;
    font-weight: 700;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 400;
}

.status-badge--generated {
    background: #f0fdf4;
    color: #16a34a;
}

.status-badge--edited {
    background: #eff6ff;
    color: #1e40af;
}

.status-badge--failed {
    background: #fef2f2;
    color: #991b1b;
}

.status-badge--decorative {
    background: #f3f4f6;
    color: #6b7280;
}

/* Review toolbar */
.review-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .review-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

/* Stats bar */
.stats-bar {
    font-size: 0.875rem;
    color: #6b7280;
}

.stats-bar strong {
    font-weight: 700;
}

/* Filter select */
.filter-select {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    min-width: 160px;
    background: white;
    font-size: 1rem;
}

.filter-select:focus {
    outline: 2px solid #4285f4;
}

/* Retry row button */
.btn-retry-row {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: white;
    font-size: 16px;
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-retry-row:hover {
    border-color: #4285f4;
    color: #4285f4;
}

/* Load more row */
.load-more-row td {
    text-align: center;
    padding: 16px 12px;
}

/* Error text */
.error-text {
    font-size: 0.875rem;
    color: #991b1b;
}

/* Quota display */
.quota-display {
    font-size: 0.85rem;
    color: #d1d5db;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}
.quota-count {
    font-weight: 600;
    color: #ffffff;
}
.quota-reset {
    font-size: 0.75rem;
    color: #9ca3af;
}
.quota-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #1e40af;
}
.quota-banner-exhausted {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

