/* style.css */
:root {
    /* Vibrant modern palette */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.65);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --focus-ring: rgba(99, 102, 241, 0.4);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    /* Subtle noise texture for premium feel */
    background-image: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15), transparent 60%);
}

/* --- Dynamic Background Blobs --- */
.blob {
    position: absolute;
    filter: blur(90px);
    z-index: -1;
    opacity: 0.5;
    animation: float 15s infinite ease-in-out alternate;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: #4f46e5;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    top: -10%;
    left: -5%;
}

.blob-2 {
    width: 550px;
    height: 550px;
    background: #c026d3;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    bottom: -15%;
    right: -10%;
    animation-delay: -5s;
    animation-duration: 20s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #0ea5e9;
    border-radius: 50%;
    top: 40%;
    left: 40%;
    opacity: 0.3;
    animation-delay: -2s;
    animation-duration: 12s;
}

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

/* --- Main Layout --- */
.container {
    width: 100%;
    max-width: 960px;
    padding: 2rem;
    z-index: 1;
    animation: fadeIn 1s ease-out;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
    letter-spacing: -1.5px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.15rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* --- Glassmorphism Card --- */
.glass-effect {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.translator-card {
    display: flex;
    flex-direction: column;
}

/* --- Controls Section --- */
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 2.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.select-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
    position: relative;
}

.select-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

select {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    width: 100%;
    padding-right: 1.5rem;
    transition: color 0.2s ease;
}

select:hover {
    color: #a855f7;
}

/* Custom select arrow */
.select-group::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 10px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    pointer-events: none;
    transition: border-color 0.2s ease;
}

.select-group:hover::after {
    border-color: #a855f7;
}

select option {
    background: var(--bg-color);
    color: var(--text-primary);
    padding: 10px;
}

.swap-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin: 0 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.swap-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(180deg) scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #a855f7;
}

.swap-btn:active {
    transform: rotate(180deg) scale(0.95);
}

/* --- Text Areas Section --- */
.text-areas {
    display: flex;
    min-height: 280px;
    position: relative;
}

.input-area, .output-area {
    flex: 1;
    padding: 2.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.output-area {
    background: rgba(0, 0, 0, 0.15);
}

.divider {
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
}

textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.35rem;
    line-height: 1.6;
    font-family: inherit;
    font-weight: 300;
    resize: none;
    outline: none;
    transition: opacity 0.3s ease;
}

textarea::placeholder {
    color: rgba(148, 163, 184, 0.4);
    font-weight: 300;
}

/* Custom scrollbar for textareas */
textarea::-webkit-scrollbar {
    width: 6px;
}
textarea::-webkit-scrollbar-track {
    background: transparent;
}
textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Actions Section --- */
.actions {
    padding: 1.75rem 2.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.01);
}

.primary-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

/* Button ripple/shine effect */
.primary-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.7);
}

.primary-btn:hover::after {
    transform: rotate(45deg) translateX(100%);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 5px 15px -5px rgba(99, 102, 241, 0.5);
}

.primary-btn:hover svg {
    transform: translateX(4px);
}

.secondary-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
}

.secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.7);
}

.secondary-btn.copied {
    background: #10b981;
    color: white !important;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

.secondary-btn svg {
    transition: transform 0.3s ease;
}

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

/* --- Loading State --- */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-indicator.active {
    opacity: 1;
}

.output-area.is-loading textarea {
    opacity: 0.3;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-left-color: #a855f7;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- Responsive Design --- */
@media (max-width: 800px) {
    .container {
        padding: 1.5rem;
    }

    header h1 {
        font-size: 2.8rem;
    }

    .controls {
        padding: 1.25rem 1.5rem;
    }

    .swap-btn {
        margin: 0 1rem;
        width: 44px;
        height: 44px;
    }

    .text-areas {
        flex-direction: column;
    }
    
    .divider {
        width: 100%;
        height: 1px;
        background: linear-gradient(to right, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
    }
    
    .input-area, .output-area {
        padding: 1.5rem;
        min-height: 200px;
    }

    .actions {
        padding: 1.25rem 1.5rem;
    }

    .primary-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2.2rem;
    }
    .controls {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
        padding: 1.5rem;
    }
    .swap-btn {
        margin: 0 auto;
        transform: rotate(90deg);
        width: 40px;
        height: 40px;
    }
    .swap-btn:hover {
        transform: rotate(270deg) scale(1.05);
    }
    .select-group {
        width: 100%;
    }
}
