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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    text-align: center;
}

h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.header-content {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 50px;
}

.header-content img {
    max-height: 80px;
    margin-bottom: 0;
}

.header-text {
    text-align: left;
}

/* Settings toggle button */
.settings-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    color: white;
    background-color: white;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.3s ease, background 0.3s ease;
}

.settings-toggle:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.settings-toggle:active {
    transform: scale(0.95);
}

/* Controls section with collapsible state */
.controls-wrapper {
    margin-bottom: 30px;
}

.controls.collapsed {
    display: none;
}

.controls {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
}

.status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #10b981;
}

.status-indicator.disconnected {
    background: #ef4444;
    animation: none;
}

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

.language-selector {
    flex: 1;
    min-width: 250px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

select:focus {
    outline: none;
    border-color: #667eea;
}

.translation-feed {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-height: 500px;
    max-height: 600px;
    overflow-y: auto;
}

.feed-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.feed-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.message {
    padding: 20px;
    margin-bottom: 15px;
    background: #f9fafb;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-timestamp {
    color: #9ca3af;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.message-text {
    color: #1f2937;
    font-size: 1.125rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.message-original {
    color: #6b7280;
    font-size: 0.875rem;
    font-style: italic;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

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

.empty-state-text {
    font-size: 1.25rem;
}

.warning-banner {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #92400e;
}

.warning-banner strong {
    display: block;
    margin-bottom: 5px;
}

/* Reconnect banner styling */
.reconnect-banner {
    background: #fee2e2;
    border: 2px solid #ef4444;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    color: #991b1b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reconnect-banner strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.reconnect-banner p {
    margin: 0;
    line-height: 1.5;
}

.reconnect-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
}

.reconnect-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

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

footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    padding: 20px;
    opacity: 0.9;
}

/* Scrollbar styling */
.translation-feed::-webkit-scrollbar {
    width: 8px;
}

.translation-feed::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.translation-feed::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.translation-feed::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Clear button in the top-right of the header */
.clear-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    transition: transform 0.08s ease, opacity 0.12s ease;
    align-self: flex-start;
}

.clear-btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

/* Undo toast */
.undo-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: rgba(17,24,39,0.98);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 9999;
    font-weight: 600;
}

.undo-toast .undo-btn {
    background: transparent;
    color: #67e8f9;
    border: 1px solid rgba(103,232,249,0.2);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 15px;
        margin-bottom: 15px;
    }

    .header-content {
        gap: 12px;
    }

    .header-content img {
        max-height: 50px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .settings-toggle {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .controls {
        padding: 15px;
        margin-bottom: 15px;
        gap: 15px;
    }

    .translation-feed {
        padding: 15px;
        min-height: 400px;
        max-height: 500px;
    }

    .feed-header h2 {
        font-size: 1.25rem;
    }

    .message {
        padding: 15px;
        margin-bottom: 10px;
    }

    .message-text {
        font-size: 1rem;
    }

    footer {
        margin-top: 15px;
        padding: 15px;
        font-size: 0.9rem;
    }

    .warning-banner {
        padding: 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .controls {
        padding: 12px;
    }

    .translation-feed {
        padding: 12px;
    }
}

