/* 🌈 CSS Variables for FUN & COLORFUL theming! */
:root {
    /* 🎨 Vibrant Primary Colors */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;

    /* 🌈 Fun Gradient Backgrounds */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    --bg-card: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    --bg-button: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --bg-error: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --bg-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* 🎨 Surface Colors with Transparency */
    --surface-color: rgba(255, 255, 255, 0.12);
    --surface-hover: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-accent: #fbbf24;
    --border-color: rgba(255, 255, 255, 0.25);
    --input-bg: rgba(255, 255, 255, 0.1);
    --hover-color: rgba(255, 255, 255, 0.15);

    /* ✨ Enhanced Shadows with Color */
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
    --shadow-colorful: 0 8px 32px rgba(102, 126, 234, 0.2);

    /* 🎯 Border Radius */
    --border-radius-fun: 20px;
    --border-radius-full: 50px;

    /* 🎮 Animation Variables */
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    animation: backgroundShift 20s ease-in-out infinite;
    -moz-osx-font-smoothing: grayscale;
}

/* Background overlay for visual depth */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Main app container */
#app {
    max-width: 375px;
    margin: 0 auto;
    padding: 20px 20px 100px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-separator {
    color: var(--text-secondary);
    font-weight: 300;
}

.logo-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
}

.version-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 6px 12px;
    transition: all 0.3s ease;
}

.plan-badge:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.plan-icon {
    font-size: 0.9rem;
}

.plan-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.current-plan-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 6px 12px;
}

.plan-icon {
    font-size: 0.9rem;
}

.current-plan-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.upgrade-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 12px;
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Remove old subscription plans CSS - now in UpgradeOverlay component */

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 🎨 FUN Welcome section */
.welcome-section {
    text-align: center;
    padding: 80px 30px;
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-fun);
    margin-bottom: 30px;
    box-shadow: var(--shadow-colorful);
    position: relative;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.05), transparent);
    animation: float 8s ease-in-out infinite;
    pointer-events: none;
}

.welcome-icon {
    font-size: 5rem;
    margin-bottom: 30px;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
}

.welcome-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow 10s linear infinite;
    text-shadow: 0 0 30px rgba(96, 165, 250, 0.5);
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1.7;
    margin-bottom: 40px;
    font-weight: 500;
}

/* Buttons */
.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
}

.icon-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

/* History section */
.history-section {
    flex: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.translation-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr;
}

/* 📱 Mobile-First Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 15px 35px 15px; /* Extra bottom padding for iPhone home indicator */
    background: var(--bg-card);
    backdrop-filter: blur(30px);
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 400px;
    gap: 15px; /* Proper spacing between buttons */
    padding: 0 10px;
}

/* 📱 Mobile-Optimized Navigation Buttons */
.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s var(--transition-bounce);
    min-width: 65px;
    min-height: 65px;
    backdrop-filter: blur(25px);
    position: relative;
    overflow: hidden;
    flex: 1;
    max-width: 80px;
    /* Touch-friendly sizing for mobile */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Ripple effect for mobile touches */
.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
    pointer-events: none;
}

/* Active state for mobile touches */
.nav-btn:active::before {
    width: 120px;
    height: 120px;
}

.nav-btn:hover,
.nav-btn:active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

/* 🎯 Primary Action Buttons (Voice & Camera) */
.nav-btn.primary {
    background: var(--bg-button);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-colorful);
    min-width: 75px;
    min-height: 75px;
    position: relative;
    overflow: hidden;
    flex: 1.2; /* Slightly larger than other buttons */
    max-width: 90px;
}

/* Shimmer effect for primary buttons */
.nav-btn.primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s ease;
}

.nav-btn.primary:hover,
.nav-btn.primary:active {
    transform: translateY(-4px) scale(1.08);
    box-shadow: var(--shadow-glow), 0 15px 35px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.nav-btn.primary:hover::after {
    left: 100%;
}

/* Pulsing animation for primary buttons */
.nav-btn.primary {
    animation: pulse 4s ease-in-out infinite;
}

/* 📱 Mobile-Optimized Icons & Labels */
.nav-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 12px rgba(102, 126, 234, 0.6));
    transition: all 0.3s ease;
    line-height: 1;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.nav-btn:hover .nav-icon,
.nav-btn:active .nav-icon {
    transform: scale(1.15);
    filter: drop-shadow(0 0 18px rgba(102, 126, 234, 1));
}

.nav-btn:hover .nav-label,
.nav-btn:active .nav-label {
    opacity: 1;
    transform: translateY(-1px);
}

.nav-btn.primary .nav-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.9));
}

.nav-btn.primary .nav-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}

.nav-btn.primary:hover .nav-icon,
.nav-btn.primary:active .nav-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 1));
}

/* 👤 Profile Button Logged-In State */
.nav-btn.logged-in {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.nav-btn.logged-in:hover,
.nav-btn.logged-in:active {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.nav-btn.logged-in .nav-icon {
    filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.8));
}

.nav-btn.logged-in:hover .nav-icon,
.nav-btn.logged-in:active .nav-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 18px rgba(16, 185, 129, 1));
}

/* Profile Avatar Image Styling */
.profile-avatar-img {
    transition: all 0.3s ease;
    animation: pulse 3s ease-in-out infinite;
}

.nav-btn.logged-in:hover .profile-avatar-img {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8) !important;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 20, 69, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-left {
        justify-content: center;
    }

    .header-right {
        justify-content: center;
    }
}

@media (max-width: 375px) {
    #app {
        padding: 15px 15px 90px 15px;
    }

    .header {
        padding: 15px;
        margin-bottom: 20px;
    }
}
    
    .welcome-section {
        padding: 40px 15px;
    }
    
    .bottom-nav {
        padding: 12px 15px 20px 15px;
    }
    
    .nav-btn {
        min-width: 50px;
        padding: 8px 10px;
    }
    
    .nav-icon {
        font-size: 1.3rem;
    }
    
    .nav-label {
        font-size: 0.6rem;
    }
}

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

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

/* 🎨 FUN ANIMATIONS & EFFECTS */
@keyframes backgroundShift {
    0%, 100% {
        filter: hue-rotate(0deg) brightness(1);
    }
    25% {
        filter: hue-rotate(10deg) brightness(1.1);
    }
    50% {
        filter: hue-rotate(-5deg) brightness(0.95);
    }
    75% {
        filter: hue-rotate(15deg) brightness(1.05);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0, -15px, 0);
    }
    70% {
        transform: translate3d(0, -7px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Dropdown/Select styling */
select {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    padding: 12px !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(10px) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 40px !important;
}

select:hover {
    background: var(--hover-color) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2) !important;
}

select:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
    background: var(--hover-color) !important;
}

/* Dropdown options styling - the list that appears when you click */
select option {
    background: rgba(12, 20, 69, 0.95) !important;
    color: white !important;
    padding: 12px 16px !important;
    border: none !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

select option:hover {
    background: rgba(59, 130, 246, 0.8) !important;
    color: white !important;
}

select option:checked,
select option:selected {
    background: linear-gradient(135deg, #3b82f6, #60a5fa) !important;
    color: white !important;
    font-weight: 600 !important;
}

/* Style the dropdown list container */
select[size],
select[multiple] {
    background: rgba(12, 20, 69, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

/* Language selector specific styling */
.language-group select {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    font-family: inherit !important;
}

.language-group select:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #3b82f6 !important;
}

.language-group select:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

/* Custom scrollbar for dropdown */
select::-webkit-scrollbar {
    width: 8px;
}

select::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

select::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

select::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Enhanced dropdown styling for better UX */
.language-selector {
    margin-bottom: 25px;
}

.language-group {
    position: relative;
}

.language-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Add a subtle glow effect to focused selects */
.language-group select:focus {
    box-shadow:
        0 0 0 2px rgba(59, 130, 246, 0.2),
        0 4px 12px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* Single dropdown arrow - no duplicates */

/* 📱 MOBILE-FIRST RESPONSIVE STYLES */

/* Mobile Optimizations */
@media (max-width: 480px) {
    /* Bottom Navigation Mobile */
    .bottom-nav {
        padding: 15px 10px 30px 10px;
    }

    .nav-container {
        gap: 12px;
        padding: 0 5px;
    }

    .nav-btn {
        min-width: 60px;
        min-height: 60px;
        padding: 10px 6px;
    }

    .nav-btn.primary {
        min-width: 70px;
        min-height: 70px;
        max-width: 85px;
    }

    .nav-icon {
        font-size: 1.4rem;
    }

    .nav-btn.primary .nav-icon {
        font-size: 1.6rem;
    }

    .nav-label {
        font-size: 0.65rem;
    }

    /* Welcome Section Mobile */
    .welcome-section {
        padding: 60px 20px;
        margin-bottom: 25px;
    }

    .welcome-section h1 {
        font-size: 2rem;
    }

    .welcome-icon {
        font-size: 4rem;
    }

    /* Main Content Mobile */
    .main-content {
        padding-bottom: 120px; /* Account for bottom nav */
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 360px) {
    .nav-container {
        gap: 8px;
        padding: 0 2px;
    }

    .nav-btn {
        min-width: 55px;
        min-height: 55px;
    }

    .nav-btn.primary {
        min-width: 65px;
        min-height: 65px;
        max-width: 75px;
    }

    .nav-label {
        font-size: 0.6rem;
    }

    .welcome-section h1 {
        font-size: 1.8rem;
    }
}

/* iPhone Safe Area Support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: calc(25px + env(safe-area-inset-bottom));
    }
}

/* 🎓 ENHANCED TRANSLATION DISPLAY STYLES */

.translation-display {
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-fun);
    padding: 25px;
    margin: 20px 0;
    box-shadow: var(--shadow-colorful);
    position: relative;
    overflow: hidden;
}

.translation-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bg-button);
    border-radius: var(--border-radius-fun) var(--border-radius-fun) 0 0;
}

/* Translation Header */
.translation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.language-pair {
    display: flex;
    align-items: center;
    gap: 15px;
}

.source-lang, .target-lang {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.lang-flag {
    font-size: 1.2rem;
}

.lang-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.translation-arrow {
    font-size: 1.5rem;
    color: var(--text-accent);
    font-weight: bold;
    animation: pulse 3s ease-in-out infinite;
}

.translation-type {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.type-icon {
    font-size: 1rem;
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.6));
}

/* Text Sections */
.text-section {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    position: relative;
    transition: all 0.3s ease;
}

.text-section:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.6));
}

/* Difficulty Badge */
.difficulty-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.difficulty-badge.easy {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.difficulty-badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.difficulty-badge.hard {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.difficulty-badge.very-hard {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

/* Text Content */
.text-content {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 15px;
    word-wrap: break-word;
}

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

.translation-text {
    color: var(--text-primary);
    font-weight: 600;
}

.phonetic-text {
    color: var(--text-accent);
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1rem;
    background: rgba(251, 191, 36, 0.1);
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid var(--text-accent);
}

/* Phonetic Section Specific */
.phonetic-section {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
    border-color: rgba(251, 191, 36, 0.3);
}

.phonetic-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.note-icon {
    font-size: 1rem;
}

/* Play Buttons */
.play-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.play-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.play-btn.primary {
    background: var(--bg-button);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.play-btn.primary:hover {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.play-btn.phonetic {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: white;
    border-color: rgba(251, 191, 36, 0.5);
}

.play-btn.phonetic:hover {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.play-btn.playing {
    animation: pulse 1s ease-in-out infinite;
}

.play-icon {
    font-size: 1rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

/* Copy Buttons */
.copy-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    position: absolute;
    bottom: 15px;
    right: 15px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.copy-btn.primary {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    color: var(--primary-color);
}

.copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

/* Learning Controls */
.learning-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.learning-btn {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 10px;
    padding: 8px 12px;
    color: var(--text-accent);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.learning-btn:hover {
    background: rgba(251, 191, 36, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.learning-icon {
    font-size: 1rem;
}

/* Action Section - DEBUGGING MODE */
.action-section {
    display: flex !important;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    /* DEBUG: Make section highly visible */
    background: rgba(255, 0, 0, 0.2) !important;
    border: 3px solid red !important;
    padding: 20px !important;
    min-height: 60px !important;
}

.action-btn {
    flex: 1;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    /* DEBUG: Force visibility */
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 9999 !important;
}

/* DEBUG: Make save button SUPER visible */
.save-btn {
    background: #ff0000 !important;
    border: 3px solid #ffffff !important;
    color: white !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8) !important;
    min-height: 50px !important;
}

/* DEBUG: Make entire translation display visible */
.translation-display {
    background: rgba(0, 255, 0, 0.2) !important;
    border: 3px solid lime !important;
    padding: 20px !important;
    margin: 20px 0 !important;
    min-height: 200px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* DEBUG: Make translation sections visible */
.translation-section {
    background: rgba(0, 0, 255, 0.2) !important;
    border: 2px solid blue !important;
    margin: 10px 0 !important;
    padding: 15px !important;
    display: block !important;
}

/* DEBUG: Make text visible */
.original-text, .translated-text, .phonetic-text {
    color: white !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 10px !important;
    margin: 5px 0 !important;
    display: block !important;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.save-btn {
    background: var(--bg-success);
    border-color: rgba(16, 185, 129, 0.5);
    color: white;
}

.save-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.share-btn {
    background: var(--bg-info);
    border-color: rgba(6, 182, 212, 0.5);
    color: white;
}

.share-btn:hover {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.retry-btn {
    background: var(--bg-warning);
    border-color: rgba(245, 158, 11, 0.5);
    color: white;
}

.retry-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.action-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .translation-display {
        padding: 20px 15px;
        margin: 15px 0;
    }

    .language-pair {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .translation-arrow {
        transform: rotate(90deg);
    }

    .text-section {
        padding: 15px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .action-section {
        flex-direction: column;
    }

    .action-btn {
        min-width: auto;
    }

    .learning-controls {
        justify-content: center;
    }

    .copy-btn {
        position: static;
        margin-top: 10px;
        align-self: flex-start;
    }
}

/* Landscape Mobile Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .bottom-nav {
        padding: 10px 15px 20px 15px;
    }

    .nav-btn {
        min-height: 50px;
    }

    .nav-btn.primary {
        min-height: 55px;
    }

    .nav-icon {
        font-size: 1.3rem;
    }

    .nav-label {
        font-size: 0.6rem;
    }
}

/* Mobile responsive improvements */
@media (max-width: 480px) {
    .language-selector {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }

    .language-group select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 14px 40px 14px 14px !important;
    }
}
