/**
 * WebPhone Styles
 * Diseño moderno y responsivo para el cliente WebRTC
 */

:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --secondary-color: #757575;
    --background: #f5f5f5;
    --surface: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 400px;
}

.webphone {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header */
.header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--secondary-color);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--warning-color);
}

.status-dot.registered {
    background: var(--success-color);
}

.status-dot.connecting {
    background: var(--warning-color);
    animation: blink 1s infinite;
}

.status-dot.error {
    background: var(--danger-color);
}

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

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

/* Config Panel */
.config-panel {
    padding: 24px;
}

.config-panel h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

/* Call Panel */
.call-panel {
    padding: 24px;
}

.hidden {
    display: none !important;
}

/* Display */
.display {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    min-height: 80px;
}

.call-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.call-timer {
    font-weight: 600;
    color: var(--success-color);
}

.number-display {
    font-size: 28px;
    font-weight: 300;
    color: var(--text-primary);
    text-align: right;
    min-height: 36px;
    word-break: break-all;
}

/* Dialpad */
.dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.key {
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: 50%;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--shadow);
}

.key:hover {
    background: var(--background);
    transform: scale(1.05);
}

.key:active {
    transform: scale(0.95);
    box-shadow: none;
}

.key span {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-secondary);
    position: absolute;
    bottom: 12px;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-disconnect {
    width: 100%;
    margin-top: 16px;
}

/* Call Controls */
.call-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.btn-call,
.btn-hangup {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 0;
}

.btn-mute {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
}

.btn-mute.active {
    background: var(--danger-color);
}

.call-controls button:not(.btn-call):not(.btn-hangup):not(.btn-mute) {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
}

/* Log Panel */
.log-panel {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    background: var(--background);
}

.log-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log {
    max-height: 150px;
    overflow-y: auto;
    font-size: 12px;
}

.log-entry {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-secondary);
    font-size: 11px;
    margin-right: 8px;
}

.log-info {
    color: var(--text-primary);
}

.log-success {
    color: var(--success-color);
}

.log-error {
    color: var(--danger-color);
}

.log-warn {
    color: var(--warning-color);
}

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

.log::-webkit-scrollbar-track {
    background: var(--background);
}

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

.log::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .webphone {
        border-radius: 12px;
    }

    .header h1 {
        font-size: 20px;
    }

    .number-display {
        font-size: 24px;
    }

    .key {
        font-size: 20px;
    }

    .dialpad {
        gap: 8px;
    }
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.config-panel,
.call-panel {
    animation: slideIn 0.3s ease-out;
}
