/* ═══════════════════════════════════════════════════════
   Stipple App Styles — matches landing page design system
   ═══════════════════════════════════════════════════════ */

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

:root {
    --ink: #080c18;
    --deep: #0e1428;
    --surface: #151b30;
    --coral: #ff6347;
    --coral-hover: #ff4f2f;
    --peach: #ffad99;
    --cream: #f5f0eb;
    --muted: #8892a8;
    --glass: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.06);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #ef4444;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--ink);
    color: var(--cream);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Grain overlay */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 999;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─── Navigation ────────────────────────────────────── */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 12, 24, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    color: var(--cream);
    text-decoration: none;
}

.logo span { color: var(--coral); }

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--cream);
    background: var(--glass);
}

.nav-link.active {
    color: var(--coral);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ─── Typography ────────────────────────────────────── */
h1, h2, h3 {
    font-family: 'Syne', sans-serif;
    letter-spacing: -0.02em;
}

h1 { font-weight: 800; font-size: 2.2rem; line-height: 1.1; }
h2 { font-weight: 700; font-size: 1.6rem; line-height: 1.2; }
h3 { font-weight: 700; font-size: 1.15rem; }

.page-header {
    padding: 48px 0 32px;
}

.page-header p {
    color: var(--muted);
    margin-top: 8px;
    font-size: 1.05rem;
    max-width: 560px;
}

/* ─── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--coral);
    color: white;
}
.btn-primary:hover { background: var(--coral-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: var(--glass);
    color: var(--cream);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: none;
    padding: 8px 12px;
}
.btn-ghost:hover { color: var(--cream); }

.btn-sm { font-size: 0.82rem; padding: 6px 14px; }
.btn-lg { font-size: 1rem; padding: 14px 32px; }

.btn-success { background: var(--success); color: var(--ink); }
.btn-success:hover { filter: brightness(1.1); }

.btn-warning { background: var(--warning); color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

/* ─── Forms ─────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--cream);
    margin-bottom: 6px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 4px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--deep);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--cream);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    transition: border-color 0.2s ease;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--coral);
}

.form-input::placeholder, .form-textarea::placeholder {
    color: rgba(136, 146, 168, 0.5);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.form-select option {
    background: var(--deep);
    color: var(--cream);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ─── Cards ─────────────────────────────────────────── */
.card {
    background: linear-gradient(135deg, var(--glass), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 28px;
    transition: border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(255,255,255,0.1);
}

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

/* ─── Auth Pages ────────────────────────────────────── */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, var(--glass), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
}

.auth-logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: -0.02em;
    color: var(--cream);
    text-align: center;
    margin-bottom: 8px;
}

.auth-logo span { color: var(--coral); }

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

.auth-card .btn {
    width: 100%;
    margin-top: 8px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.88rem;
    color: var(--muted);
}

.auth-footer a {
    color: var(--coral);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

.auth-error.visible { display: block; }

/* ─── Dashboard Stats ───────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.stat-card .stat-number {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--cream);
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ─── Content Cards ─────────────────────────────────── */
.content-grid {
    display: grid;
    gap: 16px;
}

.content-card {
    background: linear-gradient(135deg, var(--glass), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s ease;
}

.content-card:hover {
    border-color: rgba(255,255,255,0.1);
}

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

.content-platform {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--coral);
    background: rgba(255,99,71,0.1);
    padding: 4px 12px;
    border-radius: 100px;
}

.content-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border-radius: 100px;
}

.status-draft { background: rgba(136,146,168,0.15); color: var(--muted); }
.status-approved { background: rgba(52,211,153,0.15); color: var(--success); }
.status-scheduled { background: rgba(251,191,36,0.15); color: var(--warning); }

.content-type-tag {
    font-size: 0.75rem;
    color: var(--muted);
    background: rgba(255,255,255,0.04);
    padding: 3px 10px;
    border-radius: 100px;
}

.content-text {
    color: var(--cream);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 14px;
    white-space: pre-wrap;
}

.content-visual {
    background: rgba(255,99,71,0.04);
    border: 1px solid rgba(255,99,71,0.08);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.content-visual-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--coral);
    margin-bottom: 6px;
}

.content-visual p {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
    font-style: italic;
}

.content-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Brand Setup ───────────────────────────────────── */
.brand-setup {
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 60px;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid var(--glass-border);
    color: var(--muted);
    transition: all 0.3s ease;
}

.step-dot.active {
    border-color: var(--coral);
    color: var(--coral);
    background: rgba(255,99,71,0.1);
}

.step-dot.done {
    border-color: var(--success);
    color: var(--success);
    background: rgba(52,211,153,0.1);
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--glass-border);
}

.step-line.done {
    background: var(--success);
}

.brand-step {
    display: none;
}

.brand-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.step-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.step-desc {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

.step-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 12px;
}

/* Tone selector pills */
.tone-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.tone-pill {
    padding: 12px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.tone-pill:hover {
    border-color: rgba(255,255,255,0.12);
    color: var(--cream);
}

.tone-pill.selected {
    border-color: var(--coral);
    color: var(--coral);
    background: rgba(255,99,71,0.08);
}

/* Platform checkboxes */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.platform-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.platform-option:hover {
    border-color: rgba(255,255,255,0.12);
}

.platform-option.selected {
    border-color: var(--coral);
    background: rgba(255,99,71,0.06);
}

.platform-option .platform-icon {
    font-size: 1.2rem;
}

.platform-option .platform-name {
    font-weight: 500;
    font-size: 0.92rem;
}

/* ─── Generate Page ─────────────────────────────────── */
.generate-page {
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 60px;
}

.generate-results {
    margin-top: 32px;
}

/* ─── Filters Bar ───────────────────────────────────── */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover { border-color: rgba(255,255,255,0.12); color: var(--cream); }

.filter-pill.active {
    border-color: var(--coral);
    color: var(--coral);
    background: rgba(255,99,71,0.08);
}

/* ─── Empty State ───────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--cream);
}

.empty-state p {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

/* ─── Loading ───────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 24px;
    color: var(--muted);
}

.loading-overlay .spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
    border-top-color: var(--coral);
}

/* ─── Toast ─────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--cream);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast-success { border-color: rgba(52,211,153,0.3); }
.toast-error { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.1); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Edit Modal ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 24, 0.8);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 32px;
    animation: fadeIn 0.2s ease;
}

.modal h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ─── Schedule picker ───────────────────────────────── */
.schedule-row {
    display: flex;
    gap: 10px;
    align-items: end;
}

.schedule-row .form-group { flex: 1; margin-bottom: 0; }

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .tone-grid { grid-template-columns: repeat(2, 1fr); }
    .platform-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .nav-inner { padding: 0 16px; }
    .content-card-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    h1 { font-size: 1.8rem; }
    .auth-card { padding: 28px 20px; }
}
