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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    padding-top: 10px;
}

.logo-container {
    margin-bottom: 10px;
}

.company-logo {
    max-height: 60px;
    width: auto;
}

header h1 {
    font-size: 1.5rem;
    color: var(--company-color, #B82C39);
}

/* Settings Cog Icon */
.settings-icon {
    position: absolute;
    top: 10px;
    right: 0;
    font-size: 1.5rem;
    color: #888;
    text-decoration: none;
    transition: color 0.2s;
}

.settings-icon:hover {
    color: var(--company-color, #B82C39);
}

section {
    background: #16213e;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

h2 {
    font-size: 1rem;
    color: #888;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

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

.label {
    color: #888;
    font-size: 0.9rem;
}

.status-indicator {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-indicator.connected {
    background: #00c853;
    color: #fff;
}

.status-indicator.disconnected {
    background: #ff5252;
    color: #fff;
}

.status-indicator.pending {
    background: #ffc107;
    color: #000;
}

.quick-dial {
    margin-bottom: 15px;
}

.btn-quick {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    background: #0f3460;
    border: 2px solid #00d4ff;
    color: #00d4ff;
}

.btn-quick:hover {
    background: #00d4ff;
    color: #000;
}

.call-state {
    text-align: center;
    margin-bottom: 20px;
}

.state-display {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

.state-display.idle {
    color: #888;
}

.state-display.ringing_in {
    color: #ffc107;
    animation: pulse 1s infinite;
}

.state-display.ringing_out {
    color: #00d4ff;
}

.state-display.in_call {
    color: #00c853;
}

.state-display.blocked {
    color: #ff4444;
    animation: pulse 0.5s infinite;
}

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

.call-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #0f3460;
    border-radius: 8px;
}

.call-info span {
    margin: 0 10px;
}

.dial-section {
    margin-bottom: 20px;
}

#phone-number {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: center;
    background: #0f3460;
    border: 2px solid #1a1a2e;
    border-radius: 8px;
    color: #fff;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

#phone-number:focus {
    outline: none;
    border-color: #00d4ff;
}

.dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.key {
    padding: 20px;
    font-size: 1.5rem;
    background: #0f3460;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.key:hover {
    background: #1a4a7a;
}

.key:active {
    background: #00d4ff;
}

.call-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-dial {
    background: #00c853;
    color: #fff;
}

.btn-dial:hover {
    background: #00e676;
}

.btn-answer {
    background: #00c853;
    color: #fff;
    animation: pulse-answer 1s infinite;
    grid-column: span 2;
}

.btn-answer:hover {
    background: #00e676;
}

@keyframes pulse-answer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 0 20px #00c853; }
}

.btn-hangup {
    background: #ff5252;
    color: #fff;
}

.btn-hangup:hover {
    background: #ff6e6e;
}

.btn-clear {
    background: #555;
    color: #fff;
}

.btn-clear:hover {
    background: #777;
}

.btn-mute {
    background: #0f3460;
    color: #ff9800;
    border: 2px solid #ff9800;
}

.btn-mute:hover {
    background: #ff9800;
    color: #000;
}

.btn-mute.active {
    background: #ff5252;
    border-color: #ff5252;
    color: #fff;
    animation: mute-pulse 1s infinite;
}

@keyframes mute-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

.event-log {
    background: #0a0a15;
    border-radius: 8px;
    padding: 15px;
    height: 150px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 3px 0;
    border-bottom: 1px solid #1a1a2e;
}

.log-entry .time {
    color: #666;
    margin-right: 10px;
}

.log-entry.info {
    color: #00d4ff;
}

.log-entry.success {
    color: #00c853;
}

.log-entry.warning {
    color: #ffc107;
}

.log-entry.error {
    color: #ff5252;
}

/* Incoming Call Display */
.incoming-call-display {
    background: linear-gradient(135deg, #0f3460, #1a1a2e);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    animation: incoming-pulse 1.5s infinite;
}

.caller-label {
    color: #ffc107;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.caller-id {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
}

@keyframes incoming-pulse {
    0%, 100% { border-color: #ffc107; box-shadow: 0 0 10px rgba(255, 193, 7, 0.3); }
    50% { border-color: #ff9800; box-shadow: 0 0 20px rgba(255, 152, 0, 0.5); }
}

/* Time Remaining */
.time-remaining {
    text-align: center;
    padding: 10px;
    background: #0f3460;
    border-radius: 8px;
    margin-bottom: 15px;
}

.time-remaining .time-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #00c853;
    margin-left: 10px;
}

.time-remaining.warning {
    background: linear-gradient(135deg, #ff5252, #0f3460);
    animation: warning-flash 0.5s infinite;
}

.time-remaining.warning .time-value {
    color: #fff;
}

@keyframes warning-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* VU Meters */
.vu-meters {
    background: #0a0a15;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.vu-meter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.vu-meter-row:last-child {
    margin-bottom: 0;
}

.vu-label {
    width: 70px;
    font-size: 0.8rem;
    color: #888;
    text-align: right;
}

.vu-meter {
    flex: 1;
    height: 12px;
    background: #1a1a2e;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.vu-meter-fill {
    height: 100%;
    background: linear-gradient(to right, #00c853 0%, #00c853 60%, #ffc107 80%, #ff5252 100%);
    border-radius: 6px;
    transition: width 0.1s ease-out;
    width: 0;
}

.vu-meter-peak {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: #fff;
    border-radius: 1px;
    transition: left 0.05s ease-out;
    left: 0;
}

/* VAD Panel */
.vad-panel {
    background: #0a0a15;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #1a1a2e;
}

.vad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.vad-title {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.vad-indicator-container {
    flex-shrink: 0;
}

.vad-indicator {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #333;
    transition: all 0.15s ease;
}

.vad-indicator.silence {
    border-color: #555;
    background: #1a1a2e;
}

.vad-indicator.speech-pending {
    border-color: #ffc107;
    background: linear-gradient(135deg, #1a1a2e 0%, #3d3400 100%);
    animation: vad-pending-pulse 0.5s infinite;
}

.vad-indicator.speech {
    border-color: #00c853;
    background: linear-gradient(135deg, #00c853 0%, #004d1f 100%);
    box-shadow: 0 0 20px rgba(0, 200, 83, 0.5);
}

.vad-indicator.speech-ending {
    border-color: #ff9800;
    background: linear-gradient(135deg, #1a1a2e 0%, #3d2600 100%);
}

@keyframes vad-pending-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.vad-indicator-text {
    font-size: 0.65rem;
    font-weight: bold;
    color: #888;
    text-align: center;
    line-height: 1.2;
}

.vad-indicator.speech .vad-indicator-text {
    color: #fff;
}

.vad-indicator.speech-pending .vad-indicator-text {
    color: #ffc107;
}

.vad-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vad-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vad-info-label {
    font-size: 0.8rem;
    color: #888;
    min-width: 70px;
}

.vad-info-value {
    font-size: 0.9rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    background: #1a1a2e;
}

.vad-info-value.ptt-on {
    background: #00c853;
    color: #fff;
}

.vad-info-value.ptt-off {
    background: #333;
    color: #888;
}

.vad-confidence-bar {
    flex: 1;
    height: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
    max-width: 150px;
}

.vad-confidence-fill {
    height: 100%;
    background: linear-gradient(to right, #00d4ff 0%, #00c853 50%, #ffc107 100%);
    border-radius: 4px;
    transition: width 0.1s ease-out;
    width: 0;
}

/* Small toggle switch for VAD */
.toggle-switch.small {
    transform: scale(0.8);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #888;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #00c853;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
    background-color: #fff;
}
