:root {
    /* Base Font */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Default (Light Mode) Variables */
    --primary-color: #b8860b; /* Darker Gold for Light bg */
    --primary-hover: #9c7209;
    --primary-glow: rgba(184, 134, 11, 0.2);
    
    --bg-main: radial-gradient(circle at 50% 0%, #ffffff 0%, #f1f5f9 100%);
    --blob-1: radial-gradient(circle, rgba(212,175,55,0.15) 0%, rgba(255,255,255,0) 70%);
    --blob-2: radial-gradient(circle, rgba(16,185,129,0.08) 0%, rgba(255,255,255,0) 70%);
    --blob-3: radial-gradient(circle, rgba(79,70,229,0.08) 0%, rgba(255,255,255,0) 70%);
    
    --text-main: #1e293b;
    --text-heading: #0f172a;
    --text-muted: #64748b;
    --success-color: #059669;
    
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.9);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 1);
    --card-shadow-hover: 0 30px 60px -12px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1);
    
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-border: rgba(0, 0, 0, 0.1);
    --input-focus-bg: rgba(255, 255, 255, 1);
    --input-text: #1e293b;
    --input-placeholder: rgba(30, 41, 59, 0.4);
    
    --btn-secondary-bg: rgba(255, 255, 255, 0.5);
    --btn-secondary-border: rgba(0, 0, 0, 0.1);
    --btn-secondary-hover: rgba(255, 255, 255, 0.8);
    --btn-secondary-text: #1e293b;
    
    --preview-bg: rgba(255, 255, 255, 0.6);
    --preview-border: rgba(0, 0, 0, 0.1);
    --preview-text: #334155;
    
    --divider-grad: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    --heading-grad: linear-gradient(to right, #0f172a, var(--primary-color), #0f172a);
    
    --theme-btn-bg: rgba(255, 255, 255, 0.8);
    --theme-btn-color: #1e293b;
    --theme-btn-border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --primary-color: #d4af37; /* Elegant Gold */
    --primary-hover: #c59f2a;
    --primary-glow: rgba(212, 175, 55, 0.3);
    
    --bg-main: radial-gradient(circle at 50% 0%, #1e293b 0%, #020617 100%);
    --blob-1: radial-gradient(circle, rgba(212,175,55,0.3) 0%, rgba(15,23,42,0) 70%);
    --blob-2: radial-gradient(circle, rgba(16,185,129,0.15) 0%, rgba(15,23,42,0) 70%);
    --blob-3: radial-gradient(circle, rgba(79,70,229,0.2) 0%, rgba(15,23,42,0) 70%);
    
    --text-main: #ffffff;
    --text-heading: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --success-color: #10b981;
    
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    --card-shadow-hover: 0 30px 60px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: rgba(255, 255, 255, 0.15);
    --input-focus-bg: rgba(0, 0, 0, 0.3);
    --input-text: #ffffff;
    --input-placeholder: rgba(255, 255, 255, 0.3);
    
    --btn-secondary-bg: rgba(255, 255, 255, 0.05);
    --btn-secondary-border: rgba(255, 255, 255, 0.15);
    --btn-secondary-hover: rgba(255, 255, 255, 0.1);
    --btn-secondary-text: #ffffff;
    
    --preview-bg: rgba(0, 0, 0, 0.2);
    --preview-border: rgba(255, 255, 255, 0.15);
    --preview-text: rgba(255, 255, 255, 0.9);
    
    --heading-grad: linear-gradient(to right, #fff, var(--primary-color), #fff);
    
    --theme-btn-bg: rgba(255, 255, 255, 0.1);
    --theme-btn-color: #ffffff;
    --theme-btn-border: rgba(255, 255, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-image: var(--bg-main);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
    transition: background-image 0.5s ease, color 0.3s ease;
}

/* Top Controls */
.top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 100;
}

.icon-btn {
    background: var(--theme-btn-bg);
    color: var(--theme-btn-color);
    border: 1px solid var(--theme-btn-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.icon-btn:hover {
    transform: scale(1.1);
}

.ui-lang-toggle {
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

[data-theme="light"] {
    /* Need to set this if we want specific explicit light state, but :root handles it */
}

/* Fallbacks for toggle icons logic */
.icon-sun, .icon-moon {
    transition: transform 0.3s ease;
}

/* Background Animated Blobs */
.blob {
    position: absolute;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.8;
    animation: float 20s infinite alternate ease-in-out;
    transition: background 0.5s ease;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: var(--blob-1);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: var(--blob-2);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 60%;
    width: 300px;
    height: 300px;
    background: var(--blob-3);
    animation-delay: -10s;
}

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

.container {
    width: 100%;
    max-width: 540px;
    z-index: 1;
    perspective: 1000px;
}

/* Glassmorphism Card */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: cardAppear 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform-origin: center bottom;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

@keyframes cardAppear {
    0% { opacity: 0; transform: translateY(40px) scale(0.95) rotateX(5deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0); }
}

.header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    width: 80px;
    height: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
    animation: pulseLogo 4s infinite ease-in-out;
}

@keyframes pulseLogo {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    background: var(--heading-grad);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 5s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.divider {
    width: 60px;
    height: 2px;
    background: var(--divider-grad);
    margin: 20px auto 0;
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--input-text);
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input[type="text"]::placeholder {
    color: var(--input-placeholder);
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    background: var(--input-focus-bg);
}

.input-focus-border {
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease, left 0.3s ease;
    border-radius: 2px;
}

input[type="text"]:focus ~ .input-focus-border {
    width: 100%;
    left: 0;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.5px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #ffffff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.primary-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px var(--primary-glow);
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.secondary-btn {
    flex: 1;
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
    margin-top: 0;
}

.secondary-btn:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--primary-color);
}

.wa-btn {
    color: #059669;
    border-color: rgba(5, 150, 105, 0.3);
}

.wa-btn:hover {
    background: rgba(5, 150, 105, 0.1);
    border-color: #059669;
}

[data-theme="dark"] .wa-btn {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
}

[data-theme="dark"] .wa-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
}

.preview-section {
    margin-top: 32px;
    padding-top: 24px;
    position: relative;
    animation: slideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.preview-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--divider-grad);
    opacity: 0.5;
}

.preview-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.language-selection {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.3s ease;
}

.radio-label:hover {
    color: var(--primary-color);
}

.radio-label input[type="radio"] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.preview-box {
    background: var(--preview-bg);
    border-radius: 12px;
    padding: 20px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--preview-border);
    text-align: left;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

pre {
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--preview-text);
}

.hidden {
    display: none;
}

.icon {
    transition: transform 0.3s ease;
}

.btn:hover .icon {
    transform: translateX(3px);
}

.secondary-btn:hover .icon {
    transform: scale(1.1);
}

/* Scrollbar styling for preview box */
.preview-box::-webkit-scrollbar {
    width: 6px;
}
.preview-box::-webkit-scrollbar-track {
    background: transparent;
}
.preview-box::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}
.preview-box::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--success-color);
    backdrop-filter: blur(8px);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

@media (max-width: 480px) {
    .glass-panel {
        padding: 30px 20px;
        border-radius: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .blob {
        display: none; /* Hide blobs on very small screens for performance */
    }
}
