/* ============================================================
   SkyLine Logic WebPhone — Base Styles
   ============================================================ */

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #111827;
    background: #f3f4f6;
}

/* ── Layout ─────────────────────────────────────────────── */
.softphone-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    background: #1a2236;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .875rem;
    transition: background .15s, color .15s;
    border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(59,130,246,.2); color: #93c5fd; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name  { color: #fff; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { color: rgba(255,255,255,.45); font-size: .72rem; }

.logout-btn {
    color: rgba(255,255,255,.4);
    transition: color .15s;
    display: flex;
    align-items: center;
}
.logout-btn:hover { color: #f87171; }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    max-width: 900px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

/* ── Status controls ──────────────────────────────────────── */
.status-controls { display: flex; align-items: center; gap: 8px; }
.status-label    { font-size: .8rem; color: #6b7280; }
.status-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: .8rem;
    background: #fff;
    cursor: pointer;
}

/* ── Device status banner ─────────────────────────────────── */
.device-status {
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: .85rem;
    font-weight: 500;
}
.device-status.connecting { background: #fef9c3; color: #854d0e; }
.device-status.ready      { background: #dcfce7; color: #166534; }
.device-status.error      { background: #fee2e2; color: #991b1b; }

/* ── Call panels ──────────────────────────────────────────── */
.call-panel {
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.incoming-panel {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    animation: pulse-border 1.5s ease-in-out infinite;
}
@keyframes pulse-border {
    0%, 100% { border-color: #bfdbfe; }
    50%       { border-color: #3b82f6; }
}

.active-panel {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
}

.call-panel-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.incoming-icon { background: #3b82f6; color: #fff; }
.active-icon   { background: #22c55e; color: #fff; }

.call-info { flex: 1; }
.call-label  { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; margin-bottom: 4px; }
.call-number { font-size: 1.2rem; font-weight: 700; color: #111827; }
.call-timer  { font-size: .85rem; color: #6b7280; margin-top: 2px; font-variant-numeric: tabular-nums; }

.call-actions { display: flex; gap: 10px; }

/* ── Idle panel ───────────────────────────────────────────── */
.idle-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: #9ca3af;
    gap: 16px;
    background: #fff;
    border-radius: 12px;
    border: 2px dashed #e5e7eb;
    margin-bottom: 20px;
}
.idle-panel p { font-size: .95rem; }

/* ── Section card ─────────────────────────────────────────── */
.section-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 20px;
    overflow: hidden;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
}
.section-header h3 { font-size: .95rem; font-weight: 600; }

/* ── Call table ───────────────────────────────────────────── */
.call-table {
    width: 100%;
    border-collapse: collapse;
}
.call-table th {
    text-align: left;
    padding: 10px 20px;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.call-table td {
    padding: 11px 20px;
    font-size: .85rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.call-table tr:last-child td { border-bottom: none; }
.call-table tr:hover td { background: #f9fafb; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-in    { background: #dbeafe; color: #1e40af; }
.badge-out   { background: #fce7f3; color: #9d174d; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-agent { background: #e0e7ff; color: #3730a3; }

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 600;
}
.status-completed { background: #dcfce7; color: #166534; }
.status-failed    { background: #fee2e2; color: #991b1b; }
.status-ringing   { background: #fef9c3; color: #854d0e; }
.status-in-progress { background: #dbeafe; color: #1e40af; }
.status-busy      { background: #fed7aa; color: #92400e; }
.status-no-answer { background: #f3f4f6; color: #6b7280; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: .85rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; }

.btn-primary { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }

.btn-answer { background: #22c55e; border-color: #22c55e; color: #fff; }
.btn-answer:hover { background: #16a34a; }

.btn-reject { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn-reject:hover { background: #dc2626; }

.btn-mute { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-mute:hover { background: #d97706; }
.btn-mute.muted { background: #6b7280; border-color: #6b7280; }

.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-change { margin-left: 8px; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: .875rem;
    background: #fff;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: .875rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    padding: 32px;
    text-align: center;
    color: #9ca3af;
    font-size: .875rem;
}

.hidden { display: none !important; }
