:root {
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --secondary: #059669;
    --bg-dark: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(16, 185, 129, 0.1);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.background-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    z-index: -1;
    filter: blur(100px);
    opacity: 0.5;
}

.container {
    width: 95%;
    max-width: 1200px;
    padding: 3rem 0;
}

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

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 12px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h1 span {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 2rem;
}

/* Mode Toggle Tabs */
.mode-toggle-container {
    display: inline-flex;
    background: white;
    padding: 0.4rem;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    gap: 0.25rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.mode-tab {
    background: transparent;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.mode-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2.5rem;
    align-items: start;
}

/* Side Column Layout for History */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Translator Card */
.translator-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.subtitle-overlay {
    position: absolute;
    bottom: 20px;
    left: 10%;
    right: 10%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#live-subtitle {
    color: white;
    font-size: 1.4rem;
    text-align: center;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem 1.75rem;
    border-radius: 20px;
    border: 1px solid #f1f5f9;
    margin-bottom: 2rem;
}

.active-mode-display {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.2rem;
}

.language-selection {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.select-group {
    display: flex;
    flex-direction: column;
}

.select-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

select {
    border: none;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.swap-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

.dot.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.content-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    min-height: 150px;
    margin-bottom: 2rem;
}

#transcript-text, #translated-text {
    font-size: 1.4rem;
    line-height: 1.5;
    color: var(--text-main);
}

.placeholder {
    color: var(--text-muted);
}

.divider {
    width: 1px;
    background: #f1f5f9;
}

.action-bar {
    display: flex;
    justify-content: center;
}

.record-btn {
    position: relative;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1.25rem 3.5rem;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px var(--primary-glow);
}

.record-btn.recording {
    background: #f43f5e;
    box-shadow: 0 10px 20px rgba(244, 63, 94, 0.3);
}

/* History Card */
.history-card {
    background: white;
    border-radius: 28px;
    height: 700px;
    display: flex;
    flex-direction: column;
    border: 1px solid #f1f5f9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.history-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.history-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 20px;
}

.history-lang-pair {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.history-original {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.history-translated {
    font-weight: 600;
    color: var(--text-main);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
}

.icon-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Text Translator */
.text-translator-section {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid #f1f5f9;
}

textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 1rem;
    font-family: inherit;
    font-size: 1.1rem;
    resize: none;
    outline: none;
    margin-bottom: 1rem;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-btn {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.main-translate-btn {
    margin-left: auto;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

footer {
    text-align: center;
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
