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

:root {
    --bg-app: #f7f5f2;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6560;
    --border: #e8e4df;
    --accent-blue: #3d5a80;
    --accent-blue-hover: #2e4466;
    --accent-dark: #2c3e50;
    --accent-dark-hover: #1e2d3d;
    --accent-green: #2d6a4f;
    --accent-green-hover: #1f4e39;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.header {
    height: 52px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 10;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon-box {
    width: 28px;
    height: 28px;
    background: var(--accent-blue);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.credit-badge {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.plan-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    background: #eef1f6;
    border: 1px solid #c8d3e0;
    border-radius: 4px;
    padding: 2px 7px;
    letter-spacing: 0.3px;
}

.header-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: underline;
    padding: 0;
    font-family: inherit;
}

.header-link-red {
    color: #c0392b;
    text-decoration: none;
}

/* ── App layout (below header) ── */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    width: 310px;
    min-width: 310px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    gap: 20px;
    overflow-y: auto;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

/* ── Buttons ── */
.btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.btn-default {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-default:hover { background: #f7f5f2; }

.btn-blue {
    background: var(--accent-blue);
    border: none;
    color: #fff;
    font-weight: 600;
}
.btn-blue:hover { background: var(--accent-blue-hover); }

.btn-dark {
    background: var(--accent-dark);
    border: none;
    color: #fff;
    font-weight: 600;
}
.btn-dark:hover { background: var(--accent-dark-hover); }

.btn-green {
    background: var(--accent-green);
    border: none;
    color: #fff;
    font-weight: 600;
}
.btn-green:hover { background: var(--accent-green-hover); }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* side-by-side buttons */
.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ── Textarea ── */
.textarea {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 10px;
    font-size: 13px;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}
.textarea::placeholder { color: var(--text-secondary); }
.textarea:focus { outline: none; border-color: var(--accent-blue); }
.textarea:disabled { background: #f7f5f2; }

/* ── Ad space ── */
.ad-space {
    margin-top: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 100px;
    background: #fff;
}

/* ── Main canvas area ── */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: var(--bg-app);
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* ── Canvas overlay buttons ── */
.canvas-overlay-btns {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: box-shadow 0.15s;
    color: var(--text-primary);
}
.icon-btn:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.icon-btn-red { color: #c0392b; }

/* ── Loading ── */
.hidden { display: none !important; }

.loading-overlay {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 1000;
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
}
.loading-overlay.hidden { display: none !important; }

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.click-blocker {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 999;
    cursor: not-allowed;
    display: none;
}
.click-blocker.active { display: block; }

/* ── Pricing overlay ── */
.pricing-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(26, 26, 26, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(4px);
}
.pricing-overlay.hidden { display: none; }

/* modal card */
.login-modal {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px;
    text-align: center;
    width: 90%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    color: var(--text-primary);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.btn-social {
    color: #fff;
    border: none;
    width: 100%;
    height: 46px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
}
.btn-social:hover { opacity: 0.9; }
.btn-google { background: #fff; color: #1a1a1a; border: 1px solid var(--border); }

/* ── Pricing modal ── */
.pricing-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--text-primary);
}
.pricing-grid {
    display: grid;
    gap: 12px;
    width: 100%;
}
.pricing-card {
    background: #faf9f7;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}
.pricing-card.featured { border-color: var(--accent-blue); }
.badge-featured {
    position: absolute; top: 12px; right: -30px;
    background: var(--accent-blue); color: #fff;
    padding: 4px 36px; font-size: 10px; font-weight: 700;
    transform: rotate(45deg); letter-spacing: 0.5px;
}
.tier-name { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.tier-price { font-size: 30px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.tier-price span { font-size: 13px; font-weight: 400; color: var(--text-secondary); }
.tier-description { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }
.tier-features { list-style: none; margin: 0 0 20px; text-align: left; }
.tier-features li { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; color: var(--text-primary); }
.tier-features li::before { content: "✓"; color: var(--accent-green); margin-right: 8px; font-weight: 700; }

.btn-plan {
    width: 100%; padding: 11px;
    border-radius: 8px; border: none;
    font-size: 13px; font-weight: 600;
    cursor: pointer; transition: opacity 0.15s, transform 0.1s;
    font-family: inherit;
}
.btn-plan:hover { opacity: 0.88; }
.btn-plan:active { transform: scale(0.97); opacity: 1; }
.btn-plan:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-plan-pro { background: var(--accent-blue); color: #fff; }

.btn-outline { background: #f0ede9; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline-green { background: #edf5f1; color: var(--accent-green); border: 1px solid #b7d9c9; }
.btn-addon {
    background: #f7f5f2; border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-primary); cursor: pointer; font-family: inherit;
    transition: background 0.15s;
}
.btn-addon:hover { background: #efecea; }

.feedback-link {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    text-decoration: underline;
    padding: 6px 0;
}
.feedback-link:hover { color: var(--accent-blue); }
