:root {
    --bg-dark: #2d2d2d;
    --bg-panel: #f5f5f5;
    --bg-card: #ffffff;
    --text-dark: #333333;
    --text-light: #ffffff;
    --text-muted: #666666;
    --accent: #4a90e2;
    --accent-hover: #357abd;
    --success: #28a745;
    --success-hover: #218838;
    --warning: #ffc107;
    --error: #dc3545;
    --error-hover: #c82333;
    --border: #dee2e6;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--bg-panel);
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
}

header h1 {
    font-size: 20px;
    color: var(--accent);
    font-weight: bold;
}

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

.lang-select {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
}

.status-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.connected {
    background: rgba(40, 167, 69, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-badge.disconnected {
    background: rgba(220, 53, 69, 0.15);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.panel:hover {
    box-shadow: var(--shadow);
}

.panel h2 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    color: var(--text-dark);
}

/* Form rows */
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 4px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.15);
}

.form-control.mono {
    font-family: 'Consolas', 'Courier New', monospace;
}

select.form-control {
    cursor: pointer;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Radio labels (display mode) */
.radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 10px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.radio-label:hover {
    border-color: var(--accent);
}

.radio-label input[type="radio"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.btn-small {
    padding: 5px 12px;
    font-size: 11px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #3498db);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover), #2980b9);
    transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
    border-color: var(--accent);
}

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

/* Record button active state */
.btn-recording {
    background: var(--error) !important;
    color: white !important;
    animation: pulse 1.5s infinite;
}

/* History container */
.history-container {
    background: #1a1a1a;
    border-radius: var(--radius);
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
}

.log-entry {
    padding: 3px 6px;
    margin: 1px 0;
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-all;
    flex-shrink: 0;
}

.log-entry.info {
    background: #3a3a3a;
    color: #d4d4d4;
}

.log-entry.rx {
    background: #1a2a1a;
    color: #8fbc8f;
}

.log-entry.tx {
    background: #1a1a2a;
    color: #8f8fbc;
}

.log-entry.error {
    background: #662222;
    color: #ff6b6b;
}

.log-entry.system {
    background: #3a3a30;
    color: #cccc88;
}

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

.log-entry:last-child {
    animation: fadeIn 0.2s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* Pulse animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Footer */
.footer {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--accent);
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.footer-copy {
    font-weight: 500;
}

.footer-desc {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .header-controls {
        flex-direction: column;
        gap: 8px;
    }

    .form-row {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-group {
        flex-direction: column;
    }
}