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

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.header h1 {
    font-size: 18px;
    color: #38bdf8;
    font-weight: 600;
}

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

#agent-name {
    font-size: 14px;
    color: #94a3b8;
}

/* Status Badge */
.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-offline { background: #475569; color: #94a3b8; }
.status-ready { background: #065f46; color: #34d399; }
.status-notready { background: #92400e; color: #fbbf24; }
.status-oncall { background: #7c2d12; color: #fb923c; }
.status-acw { background: #1e3a5f; color: #60a5fa; }
.status-ringing { background: #581c87; color: #c084fc; animation: pulse 1s infinite; }

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

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-bottom: 8px; }
.btn-primary { background: #3b82f6; color: white; }
.btn-success { background: #22c55e; color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-warning { background: #f59e0b; color: #1e293b; }
.btn-info { background: #06b6d4; color: white; }

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Panels */
.panel {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 20px;
}

.panel h3 {
    font-size: 14px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #334155;
}

.panel-wide {
    grid-column: 1 / -1;
}

/* Login */
.login-panel {
    max-width: 400px;
    margin: 100px auto;
}

.login-panel h2 {
    text-align: center;
    margin-bottom: 24px;
    color: #38bdf8;
}

/* Form */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px;
}

/* Call Info */
.call-info {
    margin-top: 16px;
    padding: 16px;
    background: #0f172a;
    border-radius: 6px;
    text-align: center;
}

.call-state {
    font-size: 24px;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 4px;
}

#call-detail {
    font-size: 13px;
    color: #64748b;
}

.call-timer {
    font-size: 32px;
    font-weight: 300;
    color: #94a3b8;
    font-family: 'Courier New', monospace;
    margin-top: 8px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #0f172a;
    border-radius: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #38bdf8;
}

.stat-label {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #334155;
    font-size: 13px;
}

.table th {
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
}

.table td {
    color: #e2e8f0;
}

/* Event Log */
.event-log {
    height: 200px;
    overflow-y: auto;
    background: #0f172a;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

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

.event-log .event-time {
    color: #64748b;
}

.event-log .event-info { color: #38bdf8; }
.event-log .event-call { color: #22c55e; }
.event-log .event-warn { color: #f59e0b; }
.event-log .event-error { color: #ef4444; }

/* Agent Controls */
.agent-controls {
    display: flex;
    flex-direction: column;
}

/* Incoming Call Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: #1e293b;
    border: 2px solid #22c55e;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    min-width: 360px;
    box-shadow: 0 0 60px rgba(34,197,94,0.3);
    animation: modalPulse 2s ease-in-out infinite;
}

@keyframes modalPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(34,197,94,0.2); }
    50% { box-shadow: 0 0 60px rgba(34,197,94,0.5); }
}

.modal-ring-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ringShake 0.5s ease-in-out infinite;
}

.modal-ring-icon::after {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

@keyframes ringShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.modal-title {
    font-size: 14px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.modal-caller {
    font-size: 28px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.modal-ext {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 28px;
}

.modal-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-lg {
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
}
