
:root {
    --bg-main: #ffffff;
    --bg-secondary: #f5f3ff;
    --text-main: #1e1b4b;
    --text-muted: #4338ca;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #ec4899;
    --border: #e0e7ff;
    --card-bg: rgba(255, 255, 255, 0.9);
    --input-bg: #ffffff;
    --shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.15);
    --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
}

[data-theme="dark"] {
    --bg-main: #020617;
    --bg-secondary: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --border: #1e293b;
    --card-bg: rgba(15, 23, 42, 0.8);
    --input-bg: #1e293b;
    --shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

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

main {
    padding: 4rem 0;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
}

@media (max-width: 1024px) {
    main { grid-template-columns: 1fr; }
}

.vibrant-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

input, textarea, select {
    padding: 0.875rem 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, ring 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-primary {
    grid-column: 1 / -1;
    background: var(--gradient);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px -5px rgba(168, 85, 247, 0.4);
    margin-top: 1rem;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(168, 85, 247, 0.5);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#result-container {
    position: sticky;
    top: 120px;
    height: fit-content;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

.result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.result-content {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

#text-output {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 1.5rem;
    font-size: 0.95rem;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
    border: 1px dashed var(--primary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden { display: none !important; }

/* Modal Styles */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-main);
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
}
