/* WebRTC Softphone - Modern Design */

* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    overflow: hidden;
    min-height: 680px;
}

/* Login Screen */
#login-screen {
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

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

/* Phone Screen */
#phone-screen {
    padding: 24px;
}

/* Phone Header */
.phone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 20px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-btn {
    background: #f5f5f5;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.icon-btn svg {
    color: #666;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-connected {
    background: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.status-connecting {
    background: #ff9800;
    animation: pulse 1.5s infinite;
}

.status-disconnected {
    background: #f44336;
}

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

.status-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.logout-btn {
    background: #f44336;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

/* Number Input */
.number-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.number-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 1px;
    transition: border-color 0.3s;
}

.number-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.call-btn-main {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 4px;
    background: #4caf50;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.call-btn-main:hover {
    background: #45a049;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

.call-btn-main:active {
    transform: scale(0.98);
}

/* Dialpad - Modern iPhone Style */
.dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 16px;
    max-width: 280px;
    margin: 0 auto;
}

.dialpad-btn {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 4px;
    background: #4a5568;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin: 0 auto;
}

.dialpad-btn:hover {
    background: #5a6678;
    transform: scale(1.05);
}

.dialpad-btn:active {
    transform: scale(0.95);
    background: #667eea;
}

.dialpad-btn:active .digit {
    color: white;
}

.dialpad-btn:active .letters {
    color: rgba(255, 255, 255, 0.9);
}

.dialpad-btn .digit {
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

.dialpad-btn .letters {
    font-size: 8px;
    font-weight: 500;
    color: #a0aec0;
    margin-top: 1px;
    letter-spacing: 1.5px;
}



/* Call Controls */
.call-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 4px;
}

.control-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    font-weight: 600;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.answer-btn {
    background: #4caf50;
    color: white;
}

.answer-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.reject-btn {
    background: #f44336;
    color: white;
}

.reject-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.hangup-btn {
    background: #f44336;
    color: white;
}

.hangup-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.transfer-btn {
    background: #2196f3;
    color: white;
}

.transfer-btn:hover {
    background: #1976d2;
    transform: translateY(-2px);
}

/* Call History Tabs */
.call-history-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    transition: all 0.2s;
    position: relative;
}

.tab-btn.active {
    color: #667eea;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.tab-btn:hover {
    color: #667eea;
}

/* Call History Content */
.call-history-content {
    min-height: 280px;
    max-height: 350px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.call-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.call-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 12px;
}

.call-item:hover {
    background: #e8e8e8;
    transform: translateX(4px);
}

.call-icon {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.call-icon.answered {
    background: #e8f5e9;
    color: #4caf50;
}

.call-icon.dialed {
    background: #e3f2fd;
    color: #2196f3;
}

.call-icon.missed {
    background: #ffebee;
    color: #f44336;
}

.call-icon svg {
    width: 18px;
    height: 18px;
}

.call-details {
    flex: 1;
    min-width: 0;
}

.call-number {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    margin-bottom: 2px;
}

.call-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.call-uuid {
    font-size: 10px;
    color: #888;
    font-family: monospace;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: help;
}

.call-time {
    font-size: 12px;
    color: #888;
}

.call-duration {
    font-size: 11px;
    color: #666;
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.play-recording-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #4caf50;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.play-recording-btn:hover {
    background: #45a049;
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* Extensions Monitor Window */
.extensions-window {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    max-height: 80vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 1000;
}

.extensions-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.extensions-window-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.extensions-window-toolbar {
    padding: 12px 16px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.online-count {
    font-size: 13px;
    font-weight: 600;
    color: #4caf50;
}

.search-input {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    width: 120px;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.extensions-grid {
    padding: 16px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.extension-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.extension-item:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.extension-item.online {
    background: #e8f5e9;
}

.extension-item.calling {
    background: #fff3e0;
    border-color: #ff9800;
}

.extension-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    margin-bottom: 8px;
}

.extension-item.online .extension-status {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.extension-item.calling .extension-status {
    background: #ff9800;
    animation: pulse 1.5s infinite;
}

.extension-number {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Transfer Dialog */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.dialog-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.dialog-content h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 20px;
}

.dialog-content p {
    margin-bottom: 16px;
    color: #666;
    font-size: 14px;
}

.dialog-content input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    margin-bottom: 20px;
}

.dialog-content input:focus {
    outline: none;
    border-color: #667eea;
}

.dialog-buttons {
    display: flex;
    gap: 12px;
}

.dialog-buttons .btn {
    flex: 1;
}

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

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .extensions-window {
        right: 10px;
        width: 280px;
    }
    
    .extensions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Audio Player - Spotify Style Footer */
.audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #1e3a8a 0%, #3b82f6 100%);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    color: white;
    gap: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.player-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.player-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.player-controls {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
}

.player-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.player-close {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.player-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-time {
    font-size: 12px;
    font-weight: 500;
    min-width: 40px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.progress-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.progress-bar::-moz-range-thumb:hover {
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .audio-player {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    
    .player-info {
        width: 100%;
    }
    
    .player-controls {
        width: 100%;
    }
}
