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

:root {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #252532;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #f1f1f3;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #2d2d3a;
    --success: #10b981;
    --warning: #f59e0b;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
    50% { box-shadow: 0 0 40px var(--accent-glow); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== PREVIEW BANNER ========== */
.preview-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
    flex-wrap: wrap;
}

.preview-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--warning);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.preview-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.github-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ========== APP LAYOUT ========== */
.app {
    display: flex;
    min-height: 100vh;
    padding-top: 60px;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.5s ease-out;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo span {
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-bottom: 6px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    color: var(--text-muted);
}

.history-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.history-empty svg {
    margin-bottom: 15px;
    opacity: 0.5;
}

.history-empty p {
    font-size: 0.85rem;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.model-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.model-icon {
    font-size: 1.5rem;
}

.model-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.model-version {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    animation: fadeIn 0.6s ease-out;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ========== TRANSLATOR ========== */
.translator-container {
    max-width: 1000px;
    margin: 0 auto;
}

.language-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.language-select {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.lang-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.swap-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: rotate(180deg);
}

.translation-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-panel,
.output-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.input-panel:focus-within,
.output-panel:hover {
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--accent);
    color: white;
}

.text-input {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    resize: none;
    outline: none;
}

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

.text-output {
    min-height: 200px;
    padding: 20px;
}

.demo-output {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.7;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--accent);
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
}

.panel-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ai-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--accent-light);
}

.ai-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.translate-actions {
    display: flex;
    justify-content: center;
}

.translate-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: glow 3s ease-in-out infinite;
}

.translate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 40px var(--accent-glow);
}

/* ========== FEATURES ========== */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 60px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeIn 0.6s ease-out both;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 40px var(--accent-glow);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
}

.modal-btn.secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-btn.secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .sidebar {
        display: none;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .preview-banner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .main-content {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .language-bar {
        flex-direction: column;
    }

    .translation-area {
        grid-template-columns: 1fr;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .swap-btn {
        transform: rotate(90deg);
    }

    .swap-btn:hover {
        transform: rotate(270deg);
    }
}

@media (max-width: 480px) {
    .language-select {
        justify-content: center;
    }

    .lang-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
