/* CSS Variables for theming */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --error-bg: #fef2f2;
    --success-color: #22c55e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --error-bg: #450a0a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.theme-toggle button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.theme-toggle button:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.sun-icon { display: none; }
.moon-icon { display: inline; }

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 1rem;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Content layout */
.content-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.main-content {
    width: 100%;
}

/* Form styles */
form {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea::placeholder {
    color: var(--text-secondary);
}

.char-count {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 1rem;
}

/* Buttons */
button[type="submit"] {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

button[type="submit"]:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button[type="submit"]:active:not(:disabled) {
    transform: translateY(0);
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

.secondary-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--accent-primary);
    background: transparent;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

/* Response container */
.response-container {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
    animation: fadeIn 0.5s ease;
}

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

.response-header h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.advice-text {
    font-size: 1.25rem;
    line-height: 1.8;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-primary);
    margin-bottom: 1rem;
}

/* Typewriter animation */
.advice-text.typing::after {
    content: '|';
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.disclaimer {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

/* Error container */
.error-container {
    background: var(--error-bg);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-top: 1.5rem;
    text-align: center;
}

.error-container p {
    margin-bottom: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
}

.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

[data-theme="dark"] .warning {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    color: #fcd34d;
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Hide elements */
[hidden] {
    display: none !important;
}
