:root {
    /* Light Theme (Default) */
    --bg-main: #f8fafc;
    --header-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --primary-blue: #2563eb;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --card-bg: #ffffff;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --border-soft: #e2e8f0;
    --chip-bg: #f1f5f9;
    --chip-hover: #e2e8f0;
    --chip-active-bg: #eff6ff;
    --textarea-bg: #f8fafc;
    
    --radius-xl: 32px;
    --radius-md: 16px;
    --whatsapp-green: #22c55e;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg-main: #0b0e14;
    --header-bg: #0f121a;
    --text-dark: #f1f5f9;
    --text-muted: #94a3b8;
    --primary-blue: #a855f7;
    --primary-gradient: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
    --card-bg: #151b23;
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --border-soft: rgba(255, 255, 255, 0.1);
    --chip-bg: #1e2530;
    --chip-hover: #2d3646;
    --chip-active-bg: rgba(168, 85, 247, 0.15);
    --textarea-bg: #0b0e14;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

body {
    background-color: var(--bg-main);
    font-family: var(--font-body);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background: var(--header-bg);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    width: 90%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-box {
    background: #14b8a6;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-back {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.nav-back:hover {
    color: var(--primary-blue);
}

/* Theme Switch Toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sun-icon { color: #f59e0b; }
.moon-icon { color: #8b5cf6; }

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 44px;
}

.theme-switch input { display: none; }

.slider {
    background-color: #cbd5e1;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 16px;
}

input:checked + .slider { background-color: var(--primary-blue); }

input:checked + .slider:before { transform: translateX(20px); }

.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Steps & Content */
.content {
    flex: 1;
    width: 90%;
    max-width: 900px;
    margin: 3rem auto;
}

.step {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.step.active {
    display: block;
}

.intro {
    text-align: center;
    margin-bottom: 3rem;
}

.intro h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.intro p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-style: italic;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0 1rem;
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 2.5rem 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-soft);
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-blue);
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 1.5rem;
}

.bg-pink { background: #fee2e2; color: #ef4444; }
.bg-blue { background: #dbeafe; color: #3b82f6; }
.bg-red { background: #fef2f2; color: #f43f5e; }
.bg-grey { background: #f1f5f9; color: #64748b; }
.bg-yellow { background: #fef9c3; color: #ca8a04; }
.bg-purple { background: #f3e8ff; color: #9333ea; }

/* Dark mode icon circle adjustments if needed */
body.dark-mode .bg-pink { background: rgba(239, 68, 68, 0.15); }
body.dark-mode .bg-blue { background: rgba(59, 130, 246, 0.15); }
body.dark-mode .bg-red { background: rgba(244, 63, 94, 0.15); }
body.dark-mode .bg-grey { background: rgba(148, 163, 184, 0.15); }
body.dark-mode .bg-yellow { background: rgba(254, 249, 195, 0.05); }
body.dark-mode .bg-purple { background: rgba(147, 51, 234, 0.15); }

.category-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.3rem;
}

.category-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.category-card .arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Configuration Panel */
.card-panel {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 3rem;
    box-shadow: var(--card-shadow);
    max-width: 650px;
    margin: 0 auto;
    border: 1px solid var(--border-soft);
}

.panel-title {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 2.5rem;
    font-weight: 800;
}

.config-group {
    margin-bottom: 2rem;
}

.config-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.chip {
    background: var(--chip-bg);
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
}

.chip:hover { background: var(--chip-hover); }

.chip.active {
    background: var(--chip-active-bg);
    color: var(--primary-blue);
    box-shadow: 0 0 0 2px var(--primary-blue);
}

textarea {
    width: 100%;
    min-height: 120px;
    background: var(--textarea-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-dark);
    resize: none;
    outline: none;
}

textarea:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.05);
}

.btn-primary {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.2);
}

/* Loading / Writing State */
.writing-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.indicator-header {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 2rem;
}

.writing-box {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 500px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-soft);
}

.writing-box p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.cursor {
    animation: blink 1s step-end infinite;
    color: var(--primary-blue);
    font-weight: 200;
}

@keyframes blink { 50% { opacity: 0; } }

/* Results */
.results-intro {
    text-align: center;
    margin-bottom: 3rem;
}

.results-intro h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.result-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    position: relative;
    border: 1px solid var(--border-soft);
}

.result-card.highlight {
    border-color: var(--primary-blue);
}

.result-number {
    position: absolute;
    top: -10px;
    left: -10px;
    background: var(--primary-blue);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

.result-text {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    border-top: 1px solid var(--border-soft);
    padding-top: 1.5rem;
}

.action-btn {
    border-radius: 12px;
    padding: 0.8rem;
    border: none;
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-copy { background: var(--chip-bg); color: var(--text-dark); }
.btn-whatsapp { background: var(--whatsapp-green); color: white; }

.action-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.btn-outline {
    background: var(--card-bg);
    border: 2px solid var(--border-soft);
    color: var(--primary-blue);
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-small {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 800;
    z-index: 1000;
    opacity: 0;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

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

/* Theme Icons pointer */
.sun-icon, .moon-icon { cursor: pointer; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .content { margin: 1.5rem auto; }
    
    .intro h2 { font-size: 1.5rem; }
    .intro p { font-size: 0.9rem; }

    .category-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
        padding: 0 0.5rem;
    }

    .category-card {
        padding: 1.5rem 0.8rem;
        border-radius: 20px;
    }

    .icon-circle {
        width: 44px;
        height: 44px;
        font-size: 18px;
        margin-bottom: 0.8rem;
        border-radius: 12px;
    }

    .category-card h3 { font-size: 0.95rem; }
    .category-card p { font-size: 0.8rem; display: none; } /* Hide desc on mobile for 2-column grid */
    
    .category-card .arrow { display: none; }

    .card-panel { padding: 1.5rem; }
    .panel-title { font-size: 1.4rem; margin-bottom: 1.5rem; }

    .results-actions { flex-direction: column; padding: 0 1rem; gap: 1rem; }
}

@media (max-width: 480px) {
    .logo-text p { display: none; }
    .logo-text h1 { font-size: 1.1rem; }
    .header-container { width: 95%; }
    .header-actions { gap: 0.8rem; }
}
