/* --- CSS Variables & Theme Configuration --- */
:root[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: rgba(0, 0, 0, 0.05);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --accent: #14b8a6;
    --success: #10b981;
    --card-bg: #ffffff;
    --divider: #e2e8f0;
    --input-bg: #f8fafc;
    --badge-bg: rgba(99, 102, 241, 0.1);
    --badge-text: #4f46e5;
    
    /* Shapes */
    --shape-1: #c7d2fe;
    --shape-2: #fbcfe8;
    --shape-3: #ccfbf1;
}

:root[data-theme="dark"] {
    --bg-primary: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --secondary-color: #f472b6;
    --accent: #2dd4bf;
    --success: #34d399;
    --card-bg: #1e293b;
    --divider: #334155;
    --input-bg: #0f172a;
    --badge-bg: rgba(129, 140, 248, 0.2);
    --badge-text: #a5b4fc;
    
    /* Shapes */
    --shape-1: #3730a3;
    --shape-2: #831843;
    --shape-3: #115e59;
}

/* --- Base Reset & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    outline: none;
}

/* --- Animated Background Shapes --- */
.bg-shape {
    position: absolute;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    border-radius: 50%;
    animation: float 20s infinite ease-in-out alternate;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--shape-1);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--shape-2);
    top: 20%;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 500px;
    height: 500px;
    background: var(--shape-3);
    bottom: -150px;
    left: 20%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -50px) scale(1.1); }
    100% { transform: translate(-20px, 30px) scale(0.9); }
}

/* --- Glassmorphism Utilities --- */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px var(--glass-shadow);
}

/* --- Layout Structure --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    flex: 1;
}

/* --- Navigation --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0 0 24px 24px;
    margin-bottom: 40px;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    color: var(--text-main);
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    font-size: 1rem;
    position: relative;
}

.nav-links a.active {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

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

.icon-btn {
    background: transparent;
    color: var(--text-main);
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--input-bg);
    transform: translateY(-2px);
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* --- Hero Section --- */
.hero-section {
    padding: 60px 0 40px;
}

.text-center {
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--badge-bg);
    color: var(--badge-text);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

.main-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 24px;
}

.text-gradient {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Generator Form & Card --- */
.generator-wrapper {
    max-width: 800px;
    margin: 0 auto 60px;
}

.generator-card {
    padding: 40px;
    border-radius: 24px;
}

.generator-controls {
    margin-bottom: 30px;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-main);
}

.custom-select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    appearance: none;
    background-color: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.select-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

.generator-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
}

.btn {
    padding: 16px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
    animation: sweep 3s infinite;
}

@keyframes sweep {
    0% { left: -100%; top: -100%;}
    100% { left: 100%; top: 100%;}
}

.btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background-color: var(--divider);
    transform: translateY(-2px);
}

/* --- Results Area --- */
.result-box {
    margin-top: 30px;
    border-top: 1px solid var(--glass-border);
    padding-top: 30px;
    transition: all 0.5s ease;
}

.result-box.hidden {
    display: none;
}

.capture-area {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin-bottom: 24px;
    position: relative;
}

.result-header {
    margin-bottom: 16px;
}

.result-badge {
    background-color: var(--accent);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.result-title {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--text-main);
}

.result-content {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.watermark-footer {
    display: none; /* Only visible during image capture */
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    font-weight: 600;
}

/* Plot Expansion */
.plot-expansion {
    margin-top: 30px;
    transition: all 0.5s ease;
}

.plot-expansion.hidden {
    display: none;
}

.plot-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 20px;
}

.plot-divider::before, .plot-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px dashed var(--primary-color);
    opacity: 0.3;
}

.plot-divider span {
    padding: 0 16px;
}

.plot-content-wrapper {
    background-color: var(--badge-bg);
    padding: 24px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.plot-text {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.8;
}

/* --- Action Bar --- */
.result-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.outline-btn {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.outline-btn:hover {
    background: var(--primary-color);
    color: white;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.utility-btns {
    display: flex;
    gap: 12px;
}

.utility-btns .icon-btn {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.utility-btns .icon-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Tooltips */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background-color: var(--text-main);
    color: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}

.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* --- Content Section --- */
.content-section {
    padding: 60px;
    border-radius: 24px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    background: var(--badge-bg);
    color: var(--primary-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.content-block h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.content-block p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.feature-list {
    list-style: none;
}

.feature-list li {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.text-success {
    color: var(--success);
    margin-top: 4px;
}

/* --- Ads --- */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-placeholder {
    width: 728px;
    height: 90px;
    background-color: var(--glass-border);
    border: 1px dashed var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-radius: 8px;
    max-width: 100%;
}

/* --- Utilities --- */
.margin-top-lg { margin-top: 40px; }
.margin-top-xl { margin-top: 80px; }
.margin-bottom-xl { margin-bottom: 80px; }
.text-center { text-align: center; }

/* --- Footer --- */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--divider);
    padding: 60px 24px 40px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.footer-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-muted);
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 16px;
}

/* --- Animations --- */
.text-focus-in {
    animation: text-focus-in 1s cubic-bezier(0.550, 0.085, 0.680, 0.530) both;
}

@keyframes text-focus-in {
    0% { filter: blur(12px); opacity: 0; }
    100% { filter: blur(0px); opacity: 1; }
}

.slide-in-bottom {
    animation: slide-in-bottom 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
    animation-delay: 0.2s;
}

@keyframes slide-in-bottom {
    0% { transform: translateY(50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.fade-in {
    animation: fade-in 1s cubic-bezier(0.390, 0.575, 0.565, 1.000) both;
    animation-delay: 0.4s;
}

@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .main-title {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .generator-actions {
        flex-direction: column;
    }
    
    .nav-links {
        display: none; /* In a real app, implement hamburger menu */
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .content-section {
        padding: 40px 24px;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .result-title {
        font-size: 1.5rem;
    }

    .ad-placeholder {
        height: 250px;
        width: 300px;
    }
}
