/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f0f0f;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #222;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4a9eff;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: #888;
    font-weight: 400;
}

/* Panels */
.panel {
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.panel h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

.panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Connection Controls */
.connection-controls {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #aaa;
}

.optional-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 400;
}

input[type="text"] {
    background-color: #0f0f0f;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: #e0e0e0;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #4a9eff;
}

input[type="text"]::placeholder {
    color: #555;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background-color: #4a9eff;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #3a8eef;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #3a3a3a;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status */
.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #0f0f0f;
    border-radius: 6px;
}

.status-label {
    font-weight: 500;
    color: #888;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #555;
    transition: background-color 0.3s;
}

.status-dot.connected {
    background-color: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

#status-text {
    font-weight: 600;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #aaa;
    display: flex;
    justify-content: space-between;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #2a2a2a;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #3a8eef;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    border: none;
}

/* Toggle Switch */
.reading-control {
    padding: 1rem;
    background-color: #0f0f0f;
    border-radius: 6px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #2a2a2a;
    border-radius: 13px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-switch input[type="checkbox"]:checked+.toggle-slider {
    background-color: #4a9eff;
}

.toggle-switch input[type="checkbox"]:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    font-weight: 500;
    color: #e0e0e0;
}

/* Chat Log */
.chat-log {
    background-color: #0f0f0f;
    border-radius: 6px;
    padding: 1rem;
    height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-log::-webkit-scrollbar {
    width: 8px;
}

.chat-log::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.chat-log::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.chat-log::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.chat-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #555;
    text-align: center;
}

.chat-message {
    padding: 0.75rem;
    background-color: #1a1a1a;
    border-left: 3px solid #4a9eff;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.chat-username {
    font-weight: 600;
    color: #4a9eff;
}

.chat-voice {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.chat-text {
    color: #e0e0e0;
    word-wrap: break-word;
}

.chat-timestamp {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Stats Panel */
.stats-panel {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    background-color: #1a1a1a;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #2a2a2a;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #4a9eff;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #555;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .connection-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chat-log {
        height: 300px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}