/* PollyGlot - AI Language Translation App Styles */

/* CSS Variables for easy theming */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem 1rem;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

img.header-image {
    object-fit: none;
    width: -webkit-fill-available;
    height: 250px;
}

.logo h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

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

/* Main Content */
.main-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* Character Counter */
.char-counter {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    transition: var(--transition);
}

.char-counter.warning {
    color: var(--warning-color);
}

.char-counter.danger {
    color: var(--error-color);
}

/* Input Section */
.input-section {
    margin-bottom: 1.5rem;
}

.text-input {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
}

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

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

/* Language Selection */
.language-section {
    margin-bottom: 1.5rem;
}

.language-label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.language-option {
    cursor: pointer;
}

.language-option input[type="radio"] {
    display: none;
}

.language-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface);
    transition: var(--transition);
    min-height: 120px;
}

.language-card:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.language-option input[type="radio"]:checked + .language-card {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.flag-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.flag-emoji {
    font-size: 3rem;
    line-height: 1;
}

.language-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.language-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    cursor: pointer;
    transition: var(--transition);
}

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

/* Buttons */
.button-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* Output Section */
.output-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    animation: fadeIn 0.5s ease;
}

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

.language-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.text-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.original-text-container,
.translated-text-container {
    margin-bottom: 1.5rem;
}

.original-text,
.translated-text {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--border-radius);
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.translated-text {
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.25rem;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    padding: 1rem;
    background: #fef2f2;
    border: 2px solid var(--error-color);
    border-radius: var(--border-radius);
    color: var(--error-color);
    margin-top: 1rem;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer p {
    margin: 0.25rem 0;
}

/* Dev Mode Badge */
.dev-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--warning-color);
    color: white;
    border-radius: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Responsive Design */

/* Tablet: 2 columns (641px to 768px) */
@media (max-width: 768px) {
    .language-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 1 column (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .logo h1 {
        font-size: 2rem;
    }
    
    .language-grid {
        grid-template-columns: 1fr;
    }

    .button-container {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

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

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .button-container,
    .footer {
        display: none;
    }
}
