/* ========================================
   ATG Translator - Modern UI Design System
   Version: 3.0.0 - Ultra Modern Edition
   ======================================== */

/* CSS Custom Properties - Modern Design Tokens */
:root {
    /* Primary Colors - Vibrant Gradient System */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    
    /* Secondary Colors - Purple Accent */
    --secondary-400: #a78bfa;
    --secondary-500: #8b5cf6;
    --secondary-600: #7c3aed;
    
    /* Accent Colors - Modern Palette */
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-pink: #ec4899;
    
    /* Neutral Colors - Refined Grays */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Gradients - Premium Look */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --gradient-secondary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-aurora: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #667eea 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, hsla(240,100%,74%,0.3) 0px, transparent 50%),
                     radial-gradient(at 80% 0%, hsla(280,100%,70%,0.3) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, hsla(340,100%,76%,0.3) 0px, transparent 50%);
    
    /* Shadows - Layered Depth */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    --shadow-glow: 0 0 40px rgba(102,126,234,0.3);
    --shadow-glow-lg: 0 0 60px rgba(102,126,234,0.4), 0 0 100px rgba(118,75,162,0.2);
    
    /* Border Radius - Smooth Curves */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;
    
    /* Transitions - Smooth & Snappy */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --transition-fast: 150ms var(--ease-smooth);
    --transition-base: 300ms var(--ease-smooth);
    --transition-slow: 500ms var(--ease-smooth);
    --transition-spring: 400ms var(--ease-spring);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-modal: 1050;
    --z-toast: 1080;
    --z-tooltip: 1090;
}

/* Reset and Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--gradient-primary);
    background-size: 400% 400%;
    animation: gradientFlow 20s ease infinite;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-mesh);
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 50% 0%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 100%; }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* ========================================
   HEADER STYLES - Modern Glass Design
   ======================================== */
.header {
    text-align: center;
    margin-bottom: 32px;
    animation: slideDown 0.8s var(--ease-spring) forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-content {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-3xl);
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.header-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

.header-content::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.03), transparent);
    transform: rotate(45deg);
    animation: shimmerHeader 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmerHeader {
    0%, 100% { transform: rotate(45deg) translate(-100%, -100%); }
    50% { transform: rotate(45deg) translate(100%, 100%); }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.logo i {
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: floatIcon 4s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(2deg); }
    75% { transform: translateY(-4px) rotate(-2deg); }
}

.logo h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #fff 0%, #f0f9ff 50%, #e0f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
    overflow: visible;
}

/* ========================================
   TRANSLATION CARD - Premium Glass
   ======================================== */
.translation-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-3xl);
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-2xl);
    transition: all var(--transition-base);
    overflow: visible;
    position: relative;
    animation: cardAppear 0.6s var(--ease-spring) 0.2s backwards;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.translation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-3xl) var(--radius-3xl) 0 0;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.translation-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2xl), var(--shadow-glow);
}

.translation-card:hover::before {
    opacity: 1;
}

/* ========================================
   LANGUAGE SELECTION - Modern Dropdown
   ======================================== */
.language-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
    padding: 28px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06), rgba(118, 75, 162, 0.06));
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(102, 126, 234, 0.12);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), 0 4px 20px rgba(102, 126, 234, 0.06);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: visible;
    z-index: 1;
    transition: all var(--transition-base);
}

.language-selection:hover {
    border-color: rgba(102, 126, 234, 0.2);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02), 0 8px 30px rgba(102, 126, 234, 0.1);
}

.language-group {
    flex: 1;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.language-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 12px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    transition: color var(--transition-fast);
}

.language-group label i {
    color: var(--primary-500);
    font-size: 1rem;
}

.language-group:hover label {
    color: var(--primary-600);
}

.language-select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12), 0 8px 20px rgba(102, 126, 234, 0.08);
    transform: translateY(-2px);
}

.language-select:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.08);
    transform: translateY(-1px);
}

.language-select option {
    background: #ffffff;
    color: var(--gray-800);
    padding: 14px;
    font-weight: 500;
}

/* Custom Dropdown Components */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
    transition: all var(--transition-spring);
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}

.dropdown-selected:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.dropdown-text {
    flex: 1;
    text-align: left;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--primary-500);
    transition: transform var(--transition-spring);
    margin-left: 12px;
}

.dropdown-selected.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-selected.active {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12), 0 12px 32px rgba(102, 126, 234, 0.12);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.95));
}

/* Dropdown Menu - Premium Design */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: var(--radius-2xl);
    box-shadow: 
        0 24px 80px rgba(0, 0, 0, 0.15),
        0 12px 40px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 999999;
    max-height: 380px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-16px) scale(0.95);
    transition: all var(--transition-spring);
    margin-top: 6px;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.dropdown-menu.show {
    pointer-events: all;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown Search */
.dropdown-search {
    padding: 16px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02), rgba(118, 75, 162, 0.02));
    position: relative;
}

.search-input {
    width: 100%;
    padding: 14px 18px 14px 48px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    color: var(--gray-800);
    transition: all var(--transition-base);
    outline: none;
    font-weight: 400;
}

.search-input:focus {
    border-color: var(--primary-500);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.08);
}

.search-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.search-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-500);
    font-size: 1rem;
    pointer-events: none;
    transition: color var(--transition-fast);
}

/* Dropdown Items Container */
.dropdown-items {
    overflow-y: auto;
    max-height: calc(380px - 80px);
    padding: 10px;
}

.dropdown-item {
    padding: 14px 18px;
    cursor: pointer;
    transition: all var(--transition-spring);
    border-radius: var(--radius-lg);
    font-weight: 500;
    color: var(--gray-600);
    position: relative;
    margin: 3px 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    overflow: hidden;
}

.dropdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transition: left 0.6s ease;
}

.dropdown-item:hover::before {
    left: 100%;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: var(--primary-600);
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.15);
}

.dropdown-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    color: var(--primary-600);
    font-weight: 600;
    transform: translateX(4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.2);
}

.dropdown-item.active::after {
    content: '✓';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-500);
    font-weight: bold;
    font-size: 1.1rem;
    animation: checkmarkPop 0.3s var(--ease-spring);
}

@keyframes checkmarkPop {
    0% { opacity: 0; transform: translateY(-50%) scale(0.5); }
    50% { transform: translateY(-50%) scale(1.2); }
    100% { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* Custom scrollbar for dropdown */
.dropdown-items::-webkit-scrollbar {
    width: 6px;
}

.dropdown-items::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 3px;
}

.dropdown-items::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.25);
    border-radius: 3px;
}

.dropdown-items::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.4);
}

/* Hide the original select */
.language-select.hidden {
    display: none;
}

/* Swap Button - Animated */
.swap-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gradient-secondary);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition-spring);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.swap-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.swap-btn:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.45);
}

.swap-btn:hover::before {
    opacity: 1;
}

.swap-btn:active {
    transform: scale(1.05) rotate(180deg);
}

/* ========================================
   TRANSLATION AREAS - Modern Design
   ======================================== */
.translation-areas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 32px;
}

.text-area-container,
.translation-result {
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-2xl);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all var(--transition-base);
}

.text-area-container:hover,
.translation-result:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: rgba(102, 126, 234, 0.15);
}

.text-area-header,
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.detected-lang {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.translation-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 8px;
}

.translation-label i {
    color: var(--primary-500);
}

.text-area-actions,
.result-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-lg);
    background: rgba(102, 126, 234, 0.08);
    color: var(--primary-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-spring);
}

.icon-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.1);
    color: var(--primary-600);
}

.icon-btn:active {
    transform: scale(0.95);
}

#source-text {
    width: 100%;
    min-height: 180px;
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1.7;
    resize: vertical;
    color: var(--gray-800);
    font-family: inherit;
    outline: none;
}

#source-text::placeholder {
    color: var(--gray-400);
}

.char-count {
    text-align: right;
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 10px;
    font-weight: 500;
}

.result-content {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--gray-400);
    text-align: center;
}

.placeholder i {
    font-size: 2.5rem;
    opacity: 0.4;
}

.translated-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--gray-800);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ========================================
   ACTION BUTTONS - Modern Style
   ======================================== */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

.primary-btn,
.secondary-btn {
    padding: 14px 36px;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-spring);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.45);
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:active {
    transform: translateY(-1px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-600);
    border: 2px solid rgba(102, 126, 234, 0.15);
}

.secondary-btn:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.25);
    color: var(--primary-600);
}

/* ========================================
   LOADING ANIMATION
   ======================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
    color: var(--primary-500);
    font-weight: 500;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(102, 126, 234, 0.15);
    border-top: 3px solid var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   HISTORY SECTION - Modern Cards
   ======================================== */
.history-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-lg);
    animation: cardAppear 0.6s var(--ease-spring) 0.4s backwards;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.history-header h3 {
    color: var(--gray-700);
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-header h3 i {
    color: var(--primary-500);
}

.clear-history-btn {
    padding: 8px 14px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-lg);
    background: rgba(239, 68, 68, 0.08);
    color: var(--accent-rose);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 6px;
}

.clear-history-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.history-list {
    max-height: 220px;
    overflow-y: auto;
}

.history-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--gray-400);
    padding: 24px;
    text-align: center;
}

.history-item {
    background: rgba(102, 126, 234, 0.04);
    border-radius: var(--radius-xl);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(102, 126, 234, 0.08);
    transition: all var(--transition-spring);
    cursor: pointer;
}

.history-item:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: translateX(6px);
    border-color: rgba(102, 126, 234, 0.15);
}

.history-languages {
    font-size: 0.8rem;
    color: var(--primary-500);
    font-weight: 600;
    margin-bottom: 6px;
}

.history-text {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.history-translation {
    font-size: 0.9rem;
    color: var(--gray-800);
    font-weight: 500;
}

.history-time {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 6px;
}

/* ========================================
   TOAST NOTIFICATIONS - Modern Style
   ======================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 16px 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    transform: translateX(400px);
    animation: toastSlideIn 0.4s var(--ease-spring) forwards;
}

@keyframes toastSlideIn {
    to {
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--accent-emerald);
}

.toast.error {
    border-left: 4px solid var(--accent-rose);
}

.toast.warning {
    border-left: 4px solid var(--accent-amber);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast.success .toast-icon {
    color: var(--accent-emerald);
}

.toast.error .toast-icon {
    color: var(--accent-rose);
}

.toast.warning .toast-icon {
    color: var(--accent-amber);
}

.toast-message {
    flex: 1;
    font-weight: 500;
    color: var(--gray-700);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    text-align: center;
    margin-top: 36px;
    padding: 24px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.hidden {
    display: none !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .language-selection {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }
    
    .swap-btn {
        order: 2;
        transform: rotate(90deg);
    }
    
    .swap-btn:hover {
        transform: rotate(90deg) scale(1.1);
    }
    
    .translation-areas {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .toast {
        min-width: 280px;
        margin: 0 12px;
    }
    
    .logo h1 {
        font-size: 2.2rem;
    }
    
    .logo i {
        font-size: 2.2rem;
    }
    
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    .translation-card {
        padding: 20px;
    }
    
    .language-selection {
        padding: 16px;
    }
    
    .text-area-container,
    .translation-result {
        padding: 16px;
    }
    
    .toast {
        min-width: 260px;
    }
    
    .header-content {
        padding: 28px 20px;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* ========================================
   FOCUS & ACCESSIBILITY
   ======================================== */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

button:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* ========================================
   PAGE LOAD ANIMATION
   ======================================== */
.container {
    animation: pageLoad 0.8s var(--ease-smooth);
}

@keyframes pageLoad {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
