/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #1a365d;
    --blue-light: #2b6cb0;
    --accent: #2b6cb0;
    --text: #1a202c;
    --text-muted: #718096;
    --bg: #ffffff;
    --bg-gray: #f7fafc;
    --border: #e2e8f0;
    --success: #38a169;
    --danger: #e53e3e;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 16px;
}

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

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

/* === Header === */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    background: var(--bg);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--blue);
}
.logo span { color: var(--text-muted); font-weight: 400; }
.logo:hover { text-decoration: none; }

nav { display: flex; gap: 16px; align-items: center; }
nav a { font-size: 14px; }
.nav-link-muted { color: var(--text-muted); }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--blue-light); text-decoration: none; color: #fff; }

.btn-lg { padding: 14px 36px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-outline {
    background: none;
    color: var(--blue);
    border: 2px solid var(--blue);
}
.btn-outline:hover { background: var(--blue); color: #fff; }
.btn-accent { background: var(--success); }
.btn-accent:hover { background: #2f855a; }

/* === Hero === */
.hero {
    text-align: center;
    padding: 80px 0 60px;
}
.hero h1 { font-size: 42px; color: var(--blue); margin-bottom: 8px; }
.hero .accent { color: var(--text-muted); font-weight: 400; }
.tagline { font-size: 20px; color: var(--text-muted); margin-bottom: 6px; }
.subtitle { font-size: 22px; margin-bottom: 24px; font-weight: 500; }
.hero-note { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* === How It Works === */
.how-it-works { padding: 40px 0 60px; }
.how-it-works h2 { text-align: center; margin-bottom: 32px; font-size: 24px; }

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}
.step { text-align: center; }
.step-num {
    width: 40px; height: 40px;
    background: var(--blue);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 12px;
}
.step h3 { margin-bottom: 6px; font-size: 16px; }
.step p { color: var(--text-muted); font-size: 14px; }

/* === Auth Pages === */
.auth-page {
    max-width: 420px;
    margin: 60px auto;
    text-align: center;
}
.auth-page h1 { margin-bottom: 8px; }
.auth-page p { color: var(--text-muted); margin-bottom: 24px; }

.auth-form { text-align: left; }
.auth-form label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.auth-form input[type="email"],
.auth-form input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    margin-bottom: 16px;
}
.auth-form input:focus { border-color: var(--blue); outline: none; }
.auth-form .btn { width: 100%; }

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #f0fff4; border: 1px solid #c6f6d5; color: #22543d; }
.alert-error { background: #fff5f5; border: 1px solid #fed7d7; color: #9b2c2c; }

/* === Create Form === */
.quick-update-banner {
    background: #f0f7ff;
    border: 1px solid #bee3f8;
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 15px;
}
.quick-update-banner span { color: var(--text-muted); }
.quick-update-banner a { font-weight: 600; }

.quick-update-btn {
    display: inline-block;
    background: #f0f7ff;
    border: 1px solid #bee3f8;
    border-radius: var(--radius);
    padding: 10px 16px 14px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.quick-update-btn:hover { background: #e1efff; border-color: #90cdf4; text-decoration: none; }
.quick-update-btn strong { color: var(--accent); }

.create-page { padding: 56px 0 40px; }
.create-page h1 { margin-bottom: 4px; }
.create-subtitle { color: var(--text-muted); margin-top: 16px; margin-bottom: 18px; font-size: 17.5px; }

.progress-track {
    margin-bottom: 32px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.progress-track-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

.form-step { display: none; }
.form-step.active { display: block; }
.form-step h2 { margin-bottom: 6px; font-size: 26px; }
.step-hint { color: var(--text-muted); margin-bottom: 24px; font-size: 16px; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
}
.optional { font-weight: 400; color: var(--text-muted); font-size: 14px; }

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--blue); outline: none; }

.input-prefix {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.input-prefix:focus-within { border-color: var(--blue); }
.input-prefix span {
    padding: 10px 12px;
    background: var(--bg-gray);
    font-weight: 600;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
}
.input-prefix input {
    border: none !important;
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
}
.input-prefix input:focus { outline: none; }

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

.product-section { margin-bottom: 20px; }
.product-section h3 { font-size: 16px; margin-bottom: 12px; color: var(--text); }

.toggle-section { margin-bottom: 24px; }
.toggle-btn {
    background: none;
    border: 1px dashed var(--border);
    padding: 8px 16px;
    color: var(--accent);
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 14px;
}
.toggle-btn:hover { border-color: var(--accent); }

.hidden { display: none; }

.remove-product-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.remove-product-btn:hover { color: #ef4444; }

.step-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* === Inline Image Previews === */
.inline-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.inline-images .img-preview {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--accent);
    flex-shrink: 0;
    max-width: 300px;
}
.inline-images .img-preview img {
    width: 100%;
    height: auto;
    display: block;
}
.inline-images .img-preview .img-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    padding: 0;
}
.inline-images .img-preview .img-remove:hover { background: #ef4444; }
.file-preview { margin-top: 8px; }
.file-preview .img-preview { display: inline-block; position: relative; }

.inline-images .img-loading {
    font-size: 13px;
    color: #9ca3af;
    padding: 8px 0;
}

/* === Loading Overlay === */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.loading-overlay.hidden { display: none; }
.loading-content {
    text-align: center;
    max-width: 400px;
}
.loading-content h2 { margin-bottom: 8px; font-size: 24px; }
.loading-content p { color: #6b7280; }
.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Preview === */
/* === Tone Selector === */
.tone-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.tone-selector label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}
.tone-selector select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    background: var(--bg);
}
.tone-selector select:focus {
    border-color: var(--blue);
    outline: none;
}
#toneStatus {
    font-size: 13px;
    font-weight: 500;
}

.preview-page { padding: 40px 0; }
.preview-page h1 { margin-bottom: 4px; }
.preview-subtitle { color: var(--text-muted); margin-bottom: 24px; margin-top: 12px; font-size: 17px; }
.preview-edit-hint {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 8px;
    min-height: 20px;
}
.preview-card:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.preview-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 32px;
    line-height: 1.7;
    font-size: 15.5px;
    overflow: hidden;
}
.preview-card ul { padding-left: 20px; list-style: none; }
.preview-card li { padding: 6px 0; padding-left: 16px; position: relative; }
.preview-card li::before { content: ''; position: absolute; left: 0; top: 14px; width: 6px; height: 6px; background: #38a169; border-radius: 50%; }
.preview-card strong { color: var(--blue); }
.preview-card[contenteditable]:focus { outline: 2px solid var(--accent); }

.share-link-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    margin: 0 8px;
    min-width: 300px;
}

.distribute-options { margin-top: 20px; }
.distribute-options h2 { margin-bottom: 20px; }

.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.option-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}
.option-card h3 { margin-bottom: 8px; font-size: 16px; }
.option-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }

.section-header { display: flex; justify-content: space-between; align-items: center; }
.investor-list-section {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.list-header h3 { font-size: 16px; margin: 0; }
.investor-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.investor-chip {
    background: #e5e7eb;
    color: #374151;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}
.add-investor-inline {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.add-investor-inline input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.send-section { margin-top: 24px; }
.send-section h2 { margin-bottom: 16px; }

/* === Big Fun Share Cards === */
.share-options-hero { margin-top: 32px; text-align: center; }
.share-options-hero h2 { font-size: 28px; margin-bottom: 4px; }
.share-subtitle { color: #6b7280; margin-bottom: 32px; font-size: 16px; }

.share-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.share-card {
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #fff;
}
.share-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}
.share-card-emoji {
    font-size: 48px;
    margin-bottom: 16px;
}
.share-card h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text);
}
.share-card p {
    color: #6b7280;
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.5;
}
.share-card .btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    border-radius: 10px;
}

.share-card-detail { font-size: 14px; color: #6b7280; margin-top: 8px; margin-bottom: 0; min-height: 44px; }
.share-action-btn { width: 100%; margin-top: 16px; }

/* === Toast Notification === */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1f2937;
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}
.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.divider-or {
    text-align: center;
    margin: 24px 0;
    position: relative;
}
.divider-or::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border);
}
.divider-or span {
    background: var(--bg);
    padding: 0 16px;
    position: relative;
    color: var(--text-muted);
    font-size: 14px;
}

/* === View Page === */
.view-page { padding: 40px 0; }
.view-compact { padding-top: 20px; }
.view-compact .preview-card { font-size: 14px; line-height: 1.6; }
.view-compact .preview-card li { margin-bottom: 6px; }
.view-compact .preview-card img { border-radius: 6px; }
.view-gate {
    max-width: 420px;
    margin: 40px auto;
    text-align: center;
}
.view-gate h1 { color: var(--blue); margin-bottom: 8px; }
.view-gate p { color: var(--text-muted); margin-bottom: 24px; }
.view-header { margin-bottom: 24px; }
.view-header h1 { color: var(--blue); }
.view-date { color: var(--text-muted); font-size: 14px; }
.powered-by { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 32px; }

.update-images { margin: 24px 0; text-align: center; }
.update-images img { max-width: 100%; border-radius: var(--radius); margin-bottom: 12px; }

/* === Dashboard === */
.dashboard-page { padding: 40px 0; }
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.company-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.edit-name-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
}
.edit-name-btn:hover { color: var(--accent); }
.company-name-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}
.company-name-edit input {
    font-size: 16px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 300px;
}
.company-name-edit.hidden { display: none; }
.dashboard-page h2 { margin: 32px 0 16px; font-size: 20px; }

.empty-state {
    padding: 40px;
    text-align: center;
    background: var(--bg-gray);
    border-radius: var(--radius);
    color: var(--text-muted);
}

table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
th { font-weight: 600; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-draft { background: #fefcbf; color: #975a16; }
.badge-published { background: #c6f6d5; color: #22543d; }

.link { font-size: 13px; margin-right: 8px; }
.link-danger { color: var(--danger); }

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.list-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.list-card h3 { font-size: 15px; margin-bottom: 4px; }
.list-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }

/* === Detail Pages === */
.detail-page { padding: 40px 0; }
.back-link { display: inline-block; margin-bottom: 16px; font-size: 14px; }
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.share-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    font-size: 14px;
}
.share-bar label { font-weight: 600; white-space: nowrap; }

.muted { color: var(--text-muted); }

.add-contact-form {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    align-items: end;
}
.add-contact-form input {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* === Company Section (Investor Dashboard) === */
.company-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.company-section h2 { color: var(--blue); margin-bottom: 12px; }

.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}
.timeline-date { font-size: 14px; color: var(--text-muted); }

/* === Footer === */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 60px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.footer-links { margin: 8px 0; }
.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 12px;
}
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-user { margin-top: 6px; font-size: 13px; color: #6b7280; font-weight: 500; }

/* === Responsive === */
@media (max-width: 768px) {
    .hero h1 { font-size: 30px; }
    .tagline { font-size: 16px; }
    .subtitle { font-size: 18px; }
    .steps-grid { grid-template-columns: 1fr; gap: 24px; }
    .options-grid { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .add-contact-form { flex-direction: column; }
    .share-link-input { min-width: auto; width: 100%; }
    .share-bar { flex-direction: column; align-items: flex-start; }
    .hide-mobile { display: none !important; }

    /* Newsletter mobile: un-float image, stack full-width */
    .preview-card div[style*="float:right"],
    .preview-card div[style*="float: right"] {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 16px 0 !important;
    }

    /* Masthead: stack on mobile */
    .preview-card div[style*="linear-gradient"] {
        flex-direction: column !important;
        gap: 4px !important;
        padding: 18px 20px !important;
        text-align: center !important;
    }

    /* Body padding tighter on mobile */
    .preview-card > div:last-child,
    .preview-card div[style*="padding:32px 36px"],
    .preview-card div[style*="padding: 32px 36px"] {
        padding: 20px 16px !important;
    }

    /* Tone selector stacks on mobile */
    .tone-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .tone-selector select { width: 100%; }
}
