:root {
    /* Color Palette */
    --bg-color: #08090d;
    --card-bg: rgba(18, 20, 29, 0.55);
    --card-border: rgba(139, 92, 246, 0.15);
    --card-border-active: rgba(139, 92, 246, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-placeholder: #4b5563;
    
    --accent-primary: #8b5cf6; /* Neon Violet */
    --accent-primary-hover: #7c3aed;
    --accent-success: #10b981; /* Emerald */
    --accent-mic: #ec4899; /* Neon Pink */
    --accent-mic-glow: rgba(236, 72, 153, 0.4);
    
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 1rem;
}

/* Background Effects */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(20, 10, 45, 0.4) 0%, rgba(8, 9, 13, 1) 100%);
    z-index: -2;
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.35;
    pointer-events: none;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 450px;
    height: 450px;
    background: #ec4899;
    bottom: -150px;
    right: -100px;
}

/* Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
.app-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.install-btn {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.install-btn svg {
    width: 1rem;
    height: 1rem;
}

.hidden {
    display: none !important;
}

/* Main Card */
.main-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Mode Selector Tabs */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-tab:hover {
    color: var(--text-primary);
}

.mode-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.flag {
    font-size: 1.2rem;
}

/* Translation Flow Grid */
.flow-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Individual Step Cards */
.flow-step {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color 0.3s ease;
}

.flow-step:hover {
    border-color: rgba(139, 92, 246, 0.1);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-badge {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.step-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Mic Area */
.mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    gap: 0.5rem;
}

.mic-button {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mic-button:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.05);
}

.mic-icon {
    width: 1.75rem;
    height: 1.75rem;
    z-index: 1;
}

.mic-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Mic active pulse animation */
.mic-button.listening {
    background: var(--accent-mic);
    border-color: var(--accent-mic);
    color: white;
    box-shadow: 0 0 20px var(--accent-mic-glow);
}

.pulse-ring {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--accent-mic);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.mic-button.listening .pulse-ring {
    animation: micPulse 1.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes micPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.mic-button.listening + .mic-status {
    color: var(--accent-mic);
}

/* Text Areas */
.text-area-wrapper {
    position: relative;
    width: 100%;
}

textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 2.5rem 0.85rem 0.85rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
}

textarea:focus {
    border-color: var(--accent-primary-hover);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.clear-button {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.clear-button svg {
    width: 1.15rem;
    height: 1.15rem;
}

.clear-button:hover {
    color: var(--text-primary);
}

.text-area-wrapper:focus-within .clear-button,
.text-area-wrapper:hover .clear-button {
    opacity: 1;
}

/* Loading Spinner */
.translation-loader {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 1rem 0.5rem;
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Results Display */
.result-box {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
}

.result-box p {
    font-size: 0.95rem;
    line-height: 1.5;
    width: 100%;
}

.result-box.highlighted {
    border-color: rgba(16, 185, 129, 0.15);
    background: rgba(16, 185, 129, 0.02);
}

.placeholder-text {
    color: var(--text-placeholder);
    font-style: italic;
}

.action-bar {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.action-bar .btn {
    flex: 1;
}

.action-bar svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Footer styling */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sw-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.sw-badge.offline {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.sw-badge.online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

/* Desktop & Tablet Layout Adjustments */
@media (min-width: 768px) {
    body {
        padding: 2rem;
    }
    
    .app-header h1 {
        font-size: 2.75rem;
    }
    
    .main-card {
        padding: 2rem;
        gap: 2rem;
    }
    
    .flow-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.5rem;
    }
    
    .flow-step {
        height: 100%;
    }
    
    .card-body {
        height: 100%;
        justify-content: space-between;
    }
    
    .text-area-wrapper {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    
    textarea {
        flex-grow: 1;
    }
    
    .result-box {
        flex-grow: 1;
    }
}
