/* ============================================
   EL ANALİZİ — Premium Styling
   ============================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

/* ── CSS Variables ── */
:root {
    --gold: #d4a853;
    --gold-light: #f0d68a;
    --gold-glow: rgba(212, 168, 83, 0.4);
    --deep-purple: #1a0a2e;
    --deep-blue: #0f0c29;
    --card-bg: rgba(26, 10, 46, 0.75);
    --card-border: rgba(212, 168, 83, 0.25);
    --text-primary: #f5f0eb;
    --text-secondary: #c4b5a0;
    --text-muted: #8a7a6a;
    --shadow-color: rgba(212, 168, 83, 0.15);
    --font-heading: 'Playfair Display', 'Georgia', serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
    --font-elegant: 'Cormorant Garamond', 'Georgia', serif;
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 20px;
    background: var(--deep-blue);
    overflow-x: hidden;
    position: relative;
}

/* ── Animated Background ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(120, 50, 180, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(212, 168, 83, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(60, 30, 120, 0.15) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

/* ── Floating Particles ── */
#particles-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ── Main Container ── */
.container {
    position: relative;
    z-index: 1;
    max-width: 820px;
    width: 100%;
    padding: 3rem 2.5rem;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow:
        0 0 60px var(--shadow-color),
        0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: box-shadow 0.5s ease;
}

.container:hover {
    box-shadow:
        0 0 80px var(--shadow-color),
        0 20px 80px rgba(0, 0, 0, 0.5);
}

/* ── Language Selector ── */
.lang-selector {
    position: fixed;
    top: 1.2rem;
    right: 1.5rem;
    left: auto;
    display: flex;
    flex-direction: row;
    gap: 6px;
    z-index: 1000;
}

.lang-selector button {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 6px 14px;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.lang-selector button:hover {
    background: var(--gold);
    color: var(--deep-purple);
    border-color: var(--gold);
    box-shadow: 0 0 20px var(--gold-glow);
    transform: translateY(-1px);
}

.lang-selector button.active {
    background: var(--gold);
    color: var(--deep-purple);
    border-color: var(--gold);
}

/* ── Config Selector ── */
.config-selector {
    margin-bottom: 0.5rem;
    text-align: left;
}

.config-selector select {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

.config-selector select:hover {
    border-color: var(--gold);
    color: var(--gold-light);
    box-shadow: 0 0 20px var(--gold-glow);
}

.config-selector select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 20px var(--gold-glow);
}

.config-selector select option {
    background: var(--deep-purple);
    color: var(--text-primary);
}

/* ── Title ── */
.main-title {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.5rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-shadow: 0 0 40px rgba(212, 168, 83, 0.3);
}

.main-title .icon {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ── Subtitle ── */
.subtitle {
    font-family: var(--font-elegant);
    font-size: 1.3rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    letter-spacing: 0.3px;
}

/* ── Upload Section ── */
.upload-section {
    margin: 2rem 0 1.5rem;
    padding: 2rem 1.5rem;
    border: 1.5px dashed rgba(212, 168, 83, 0.3);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.4s ease;
    position: relative;
}

.upload-section.drag-over {
    border-color: var(--gold);
    background: rgba(212, 168, 83, 0.05);
    box-shadow: inset 0 0 30px rgba(212, 168, 83, 0.08);
}

.upload-section.has-image {
    border-style: solid;
    border-color: rgba(212, 168, 83, 0.2);
}

.upload-hint {
    font-family: var(--font-elegant);
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* ── Buttons ── */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.btn {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 12px 28px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold-light);
    box-shadow: 0 0 25px var(--gold-glow);
    transform: translateY(-2px);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, #c99a3e 100%);
    color: var(--deep-purple);
    font-weight: 600;
    box-shadow: 0 4px 20px var(--gold-glow);
}

.btn-gold:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px var(--gold-glow);
}

.btn-gold:active {
    transform: translateY(-1px);
}

.btn-gold:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-gold.analyze-btn {
    padding: 14px 40px;
    font-size: 1.05rem;
    margin-top: 0.5rem;
    letter-spacing: 1px;
}

.btn-gold.analyze-btn .btn-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.btn-gold.analyze-btn:hover .btn-icon {
    transform: rotate(15deg) scale(1.1);
}

/* ── Camera Container ── */
#cameraContainer {
    margin: 1rem auto;
    max-width: 400px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid rgba(212, 168, 83, 0.15);
}

#cameraContainer video {
    width: 100%;
    border-radius: 12px;
    display: block;
}

#cameraContainer .btn {
    margin-top: 1rem;
}

/* ── Dual Preview Layout ── */
.dual-previews {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: 1.2rem auto 0;
    max-width: 100%;
}

.preview-slot {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-badge {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--gold);
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 12px var(--gold-glow);
}

.slot-image {
    max-width: 100%;
    max-height: 340px;
    border-radius: 14px;
    display: none;
    box-shadow:
        0 0 30px rgba(212, 168, 83, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 168, 83, 0.15);
    object-fit: contain;
}

.preview-divider {
    width: 1px;
    margin: 2rem 1.5rem;
    background: linear-gradient(to bottom, transparent, rgba(212, 168, 83, 0.25), transparent);
    flex-shrink: 0;
}

/* ── Preview Image (legacy, kept for compat) ── */
#preview {
    display: none;
}

/* ── Loading ── */
.loading {
    display: none;
    margin: 2rem 0;
    padding: 1.5rem;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(212, 168, 83, 0.15);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-elegant);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-secondary);
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ── Result Area ── */
#result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    text-align: left;
    line-height: 1.8;
    font-size: 0.98rem;
    border: 1px solid rgba(212, 168, 83, 0.1);
    animation: fadeInUp 0.6s ease;
}

#result:empty {
    display: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Result Inner Styles (from LLM HTML) ── */
#result .palm-reading h2 {
    font-family: var(--font-heading);
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    text-shadow: 0 0 20px var(--gold-glow);
}

#result .reading-section {
    margin-bottom: 1.8rem;
    padding: 1.2rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(212, 168, 83, 0.08);
    transition: all 0.3s ease;
}

#result .reading-section:hover {
    border-color: rgba(212, 168, 83, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

#result .reading-section h3 {
    font-family: var(--font-heading);
    color: var(--gold-light);
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

#result .reading-section p {
    margin-bottom: 0.5rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

#result .reading-section strong {
    color: var(--text-primary);
    font-weight: 500;
}

#result .reading-section ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

#result .reading-section ul li {
    position: relative;
    padding: 0.4rem 0 0.4rem 1.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

#result .reading-section ul li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: 0.8rem;
}

/* ── Download Button ── */
#downloadSection {
    animation: fadeInUp 0.6s ease;
}

.download-btn {
    padding: 14px 40px;
    font-size: 1.05rem;
    letter-spacing: 1px;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px var(--gold-glow);
}

/* ── Footer ── */
.footer {
    margin-top: 2.5rem;
    font-family: var(--font-elegant);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(212, 168, 83, 0.1);
    padding-top: 1.5rem;
}

.footer strong {
    color: var(--text-secondary);
    font-style: normal;
    font-family: var(--font-body);
    font-weight: 400;
}

/* ── Error State ── */
.error-message {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .container {
        padding: 2rem 1.2rem;
        border-radius: 18px;
    }

    .main-title {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1.05rem;
    }

    .lang-selector {
        top: 0.8rem;
        right: 0.8rem;
        left: auto;
        flex-direction: row;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .btn-gold.analyze-btn {
        padding: 12px 32px;
        font-size: 0.95rem;
    }

    .upload-section {
        padding: 1.2rem 1rem;
    }

    .dual-previews {
        flex-direction: column;
        align-items: center;
    }

    .preview-divider {
        width: 60%;
        height: 1px;
        margin: 1rem 0;
        background: linear-gradient(to right, transparent, rgba(212, 168, 83, 0.25), transparent);
    }

    .slot-image {
        max-height: 240px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.8rem;
    }

    .btn-group {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .slot-image {
        max-height: 180px;
    }
}
