/* ============================================
   Haiku Maker - JustAddAI Theme
   ============================================ */

:root {
    --warm-cream: #FDF8F3;
    --bg-secondary: #F5EDE3;
    --bg-card: #ffffff;
    --bg-elevated: #f0ebe4;

    --forest-green: #2D4A3E;
    --deep-sage: #5B7B6D;
    --faith-gold: #D4AF37;
    --soft-gold: #E8D5B7;
    --rich-amber: #C4956A;
    --warm-brown: #6B4E3D;
    --soft-coral: #E8B4A0;
    --sky-blue: #89B4C8;
    --hope-green: #4A7C59;

    --text-primary: #3D3229;
    --text-secondary: #5A4D42;
    --text-muted: #8a7e73;

    --accent: #2D4A3E;
    --accent-hover: #234035;
    --accent-glow: rgba(45, 74, 62, 0.1);
    --accent-success: #4A7C59;
    --accent-danger: #b05050;

    --border: rgba(232, 213, 183, 0.5);
    --border-subtle: rgba(232, 213, 183, 0.3);

    --shadow-sm: 0 2px 8px rgba(107, 78, 61, 0.05);
    --shadow-md: 0 10px 40px rgba(107, 78, 61, 0.08);
    --shadow-lg: 0 20px 50px rgba(107, 78, 61, 0.12);
    --shadow-card: 0 4px 20px rgba(107, 78, 61, 0.06);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --transition: 200ms ease;
}


/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Source Sans Pro', Georgia, serif;
    background: var(--warm-cream);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    font-size: 18px;
}

/* ============================================
   Navigation Bar
   ============================================ */

.nav {
    background: var(--forest-green);
    padding: 15px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}


.nav-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--warm-cream);
    text-decoration: none;
}

.nav-brand span {
    color: var(--faith-gold);
}


.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-links a {
    color: rgba(253, 248, 243, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--faith-gold);
}

.nav-icon-btn {
    background: none;
    border: none;
    color: rgba(253, 248, 243, 0.7);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-icon-btn:hover {
    color: var(--faith-gold);
    background: rgba(253, 248, 243, 0.1);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--sky-blue) 0%, var(--deep-sage) 100%);
    text-align: center;
    padding: 80px 30px 60px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}


.hero-content {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.page-tag {
    display: inline-block;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: white;
    background: rgba(255, 255, 255, 0.25);
    padding: 8px 24px;
    border-radius: 30px;
    margin-bottom: 20px;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
}

.hero-message {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================
   Main Content - Single Column
   ============================================ */

.main-content {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 60px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Haiku Stage - The Heart
   ============================================ */

.haiku-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 40px 0 24px;
}

/* Placeholder */
.haiku-placeholder {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.placeholder-brush {
    color: var(--soft-gold);
    opacity: 0.5;
}

.placeholder-text {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* Haiku Display */
.haiku-display {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeInUp 0.6s ease;
}

.haiku-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 56px 48px 44px;
    max-width: 460px;
    width: 100%;
    box-shadow: var(--shadow-card);
    text-align: center;
    border: 1px solid var(--border);
    overflow: hidden;
}

.haiku-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--faith-gold), var(--rich-amber));
}

/* Corner decorations */
.haiku-decoration {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--faith-gold);
    opacity: 0.3;
}
.haiku-decoration.top-left     { top: 18px; left: 14px; border-left: 1.5px solid; border-top: 1.5px solid; }
.haiku-decoration.top-right    { top: 18px; right: 14px; border-right: 1.5px solid; border-top: 1.5px solid; }
.haiku-decoration.bottom-left  { bottom: 14px; left: 14px; border-left: 1.5px solid; border-bottom: 1.5px solid; }
.haiku-decoration.bottom-right { bottom: 14px; right: 14px; border-right: 1.5px solid; border-bottom: 1.5px solid; }

/* Haiku lines */
.haiku-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.haiku-line {
    font-family: 'Playfair Display', 'Noto Serif JP', Georgia, serif;
    font-size: 1.4rem;
    line-height: 2;
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: lineReveal 0.6s ease forwards;
}

.haiku-line:nth-child(1) { animation-delay: 0.15s; }
.haiku-line:nth-child(2) { animation-delay: 0.5s; font-size: 1.5rem; color: var(--forest-green); }
.haiku-line:nth-child(3) { animation-delay: 0.85s; }


.haiku-line-divider {
    width: 32px;
    height: 1px;
    background: var(--faith-gold);
    opacity: 0;
    animation: lineReveal 0.5s ease forwards;
}
.haiku-line-divider:nth-of-type(2) { animation-delay: 0.3s; }
.haiku-line-divider:nth-of-type(4) { animation-delay: 0.65s; }

/* Syllable whisper */
.haiku-syllables {
    margin-top: 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.25em;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 400;
}

/* Action buttons row */
.haiku-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============================================
   Icon & Action Buttons
   ============================================ */

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.btn-action {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px);
}

/* Text button */
.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: var(--transition);
}

.btn-text:hover {
    color: var(--accent);
}

/* Standard buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-family: inherit;
    text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--forest-green);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }


.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-small { padding: 6px 12px; font-size: 0.82rem; }
.btn-danger { background: var(--accent-danger); color: white; }

/* ============================================
   Compose Area
   ============================================ */

.compose-area {
    padding: 0 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.compose-input-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid var(--soft-gold);
    transition: var(--transition);
    padding-bottom: 2px;
}

.compose-input-wrap:focus-within {
    border-bottom-color: var(--forest-green);
}


.compose-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    padding: 12px 0;
    outline: none;
    letter-spacing: 0.01em;
}

.compose-input-wrap input::placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.7;
}

.compose-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
}

.compose-btn:hover {
    color: var(--forest-green);
    background: var(--accent-glow);
}


.compose-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.compose-hint {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* ============================================
   History
   ============================================ */

.history-section {
    margin-top: 40px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-title {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.empty-state {
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.history-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: var(--accent-glow);
}

.history-item .history-haiku {
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-line;
}

.history-item .history-theme {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer styles defined in index.html inline <style> to match JustAddAI site */

/* ============================================
   Modals
   ============================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(61, 50, 41, 0.3);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
}


.modal.active { display: flex; }

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
    animation: modalIn 0.25s ease-out;
    border: 1px solid var(--border);
    overflow: hidden;
}

.modal-large { max-width: 640px; }

.modal-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--forest-green);
    letter-spacing: 0.02em;
}


.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-subtle);
}

/* Settings Status */
.settings-status {
    text-align: center;
    padding: 16px 0;
}

.settings-status .status-provider {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--forest-green);
    margin-bottom: 4px;
}


.settings-status .status-mode {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.settings-status .status-not-configured {
    color: var(--accent-danger);
    font-size: 0.9rem;
}

.modal-footer a.btn {
    text-decoration: none;
}

/* Form elements */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ============================================
   Favorites
   ============================================ */

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.favorite-item {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.favorite-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.favorite-haiku {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    line-height: 1.9;
    text-align: center;
    padding: 8px 0;
    white-space: pre-line;
    color: var(--text-primary);
}

.favorite-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.favorite-theme {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 0.88rem;
    max-width: 320px;
    animation: slideInRight 0.3s ease;
}

.toast.success { border-left: 3px solid var(--accent-success); }
.toast.error { border-left: 3px solid var(--accent-danger); }

/* ============================================
   Animations
   ============================================ */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes lineReveal {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .hero { padding: 60px 20px 40px; }
    .hero h1 { font-size: 2rem; }
    .main-content { padding: 0 20px 40px; }

    .haiku-card {
        padding: 40px 28px 32px;
    }

    .haiku-line {
        font-size: 1.2rem;
    }

    .haiku-line:nth-child(2) {
        font-size: 1.3rem;
    }

    .nav-links a {
        font-size: 0.85rem;
    }

    .nav-links {
        gap: 12px;
    }

    .site-footer { padding: 30px 20px; }
}
