/* PLTrans 0.1 - Dark Glassmorphism Design */
/* (c) 2026 Synesthesia.codes Andrzej Dobrucki */

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

:root {
    --bg-dark: #0f111a;
    --bg-gradient-from: #1a1c2e;
    --bg-gradient-via: #0f111a;
    --bg-gradient-to: #251b36;
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --indigo-400: #818cf8;
    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;
    
    --purple-400: #c084fc;
    
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    
    --rose-400: #fb7185;
    --rose-500: #f43f5e;
    
    --slate-100: #f1f5f9;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-from) 0%, var(--bg-gradient-via) 50%, var(--bg-gradient-to) 100%);
    min-height: 100vh;
    color: var(--slate-100);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
}

/* ========== SIDEBAR ========== */
.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Logo Section */
.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--indigo-500);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, white, var(--slate-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 0.625rem;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* Navigation */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 3rem;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--slate-400);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--indigo-400);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item svg {
    flex-shrink: 0;
}

/* Status Card */
.status-card {
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--indigo-400);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-description {
    font-size: 0.6875rem;
    color: var(--slate-400);
    line-height: 1.4;
}

/* ========== MAIN PANEL ========== */
.main-panel {
    display: flex;
    flex-direction: column;
}

.translator-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
}

.lang-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lang-button svg {
    color: var(--slate-500);
    transition: color 0.2s;
}

.lang-button:hover svg {
    color: white;
}

.lang-divider {
    width: 1px;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
}

/* Custom Glassmorphism Language Dropdown */
.lang-dropdown {
    flex: 1;
    position: relative;
}

.lang-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--slate-100);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.lang-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--indigo-400);
}

.lang-dropdown-btn:hover .lang-dropdown-chevron {
    stroke: var(--indigo-400);
}

.lang-dropdown.open .lang-dropdown-btn {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--indigo-400);
}

.lang-dropdown.open .lang-dropdown-chevron {
    transform: rotate(180deg);
    stroke: var(--indigo-400);
}

.lang-dropdown-chevron {
    stroke: var(--slate-400);
    flex-shrink: 0;
    transition: transform 0.2s, stroke 0.2s;
}

.lang-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    min-width: 140px;
    background: rgba(26, 28, 46, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99,102,241,0.1);
    padding: 0.375rem;
    z-index: 100;
    animation: dropdownIn 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-dropdown.open .lang-dropdown-menu {
    display: block;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.lang-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.625rem;
    border: none;
    background: transparent;
    color: var(--slate-400);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    white-space: nowrap;
}

.lang-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--slate-100);
}

.lang-dropdown-item.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--indigo-400);
    font-weight: 600;
}

.swap-button {
    margin: 0 0.5rem;
    padding: 0.5rem;
    background: var(--indigo-500);
    border: none;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.swap-button:hover {
    transform: scale(1.1);
}

.swap-button:active {
    transform: scale(0.95);
}

/* Display Area */
.display-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 300px;
    margin-bottom: 2rem;
}

.transcription-section {
    opacity: 0.3;
    transform: translateY(1rem);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.transcription-section.has-text {
    opacity: 1;
    transform: translateY(0);
}

.translation-section {
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.translation-section:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.translation-section.hidden {
    display: none;
}

.section-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

.source-label {
    color: var(--indigo-400);
}

.target-label {
    color: var(--emerald-400);
}

.transcription-text {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--slate-100);
    font-style: italic;
    line-height: 1.6;
}

.translation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.audio-button {
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 9999px;
    color: var(--emerald-400);
    cursor: pointer;
    transition: all 0.2s;
}

.audio-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.translation-text {
    font-size: 1.875rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
}

/* Controls Area */
.controls-area {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Waveform Bars */
.waveform-bars {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 3rem;
}

.wave-bar {
    width: 0.25rem;
    height: 1rem;
    background: linear-gradient(to top, var(--indigo-500), var(--purple-400));
    border-radius: 9999px;
    transition: height 0.15s ease;
}

/* Mic Section */
.mic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mic-button {
    position: relative;
    width: 6rem;
    height: 6rem;
    border-radius: 9999px;
    border: none;
    background: var(--indigo-600);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 30px rgba(79, 70, 229, 0.3);
}

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

.mic-button:not(:disabled):hover {
    transform: scale(1.05);
}

.mic-button.recording {
    background: var(--rose-500);
    box-shadow: 0 0 40px rgba(244, 63, 94, 0.4);
    transform: scale(1.1);
}

.mic-icon {
    display: block;
}

.mic-off-icon {
    display: none;
}

.mic-button.recording .mic-icon {
    display: none;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.mic-button.recording .mic-off-icon {
    display: block;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.mic-ring {
    position: absolute;
    inset: -0.5rem;
    border-radius: 9999px;
    border: 2px solid var(--indigo-500);
    opacity: 0.2;
    transition: all 0.7s;
}

.mic-button.recording .mic-ring {
    border-color: var(--rose-500);
    opacity: 0.5;
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

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

@keyframes ping {
    75%, 100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Status Badge */
.status-badge {
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s;
}

.status-badge.ready {
    background: rgba(16, 185, 129, 0.2);
    color: var(--emerald-400);
}

.status-badge.listening {
    background: rgba(244, 63, 94, 0.2);
    color: var(--rose-400);
}

.status-badge.processing,
.status-badge.loading {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: var(--emerald-500);
}

.status-badge.listening .status-dot {
    background: var(--rose-500);
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-badge.processing .status-dot,
.status-badge.loading .status-dot {
    background: #f97316;
    animation: pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-hint {
    margin-top: 0.5rem;
    font-size: 0.6875rem;
    color: var(--slate-500);
    font-weight: 500;
}

/* Latency Display */
.latency-display {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.1), rgba(220, 252, 231, 0.1));
    border-radius: 0.75rem;
    color: var(--emerald-400);
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 1;
    transition: opacity 0.4s;
}

.latency-display.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 26, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 3.75rem;
    height: 3.75rem;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 9999px;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 1.25rem;
    font-size: 1.25rem;
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 2;
    }
    
    .main-panel {
        order: 1;
    }
}

@media (max-width: 640px) {
    body {
        padding: 0.5rem;
    }
    
    .translator-panel {
        padding: 1.5rem;
    }
    
    .transcription-text {
        font-size: 1.125rem;
    }
    
    .translation-text {
        font-size: 1.5rem;
    }
    
    .mic-button {
        width: 5rem;
        height: 5rem;
    }
    
    .mic-button svg {
        width: 32px;
        height: 32px;
    }
}
