/* NocPABX - Tema escuro: vermelho, preto e branco */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --border: #2a2a2a;
    --text-primary: #f0f0f0;
    --text-secondary: #999999;
    --text-muted: #666666;
    --red-primary: #dc2626;
    --red-dark: #991b1b;
    --red-light: #ef4444;
    --red-glow: rgba(220, 38, 38, 0.3);
    --green: #22c55e;
    --green-dark: #166534;
    --yellow: #eab308;
    --yellow-dark: #854d0e;
    --gray: #6b7280;
    --white: #ffffff;
    --font-mono: 'Courier New', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--red-primary);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-noc {
    color: var(--white);
}

.logo-pabx {
    color: var(--red-primary);
}

.tagline {
    color: var(--text-muted);
    font-size: 12px;
    display: none;
}

@media (min-width: 768px) {
    .tagline { display: inline; }
}

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

.ami-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ami-hint {
    color: var(--yellow);
    cursor: help;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s infinite;
}

.status-dot.disconnected {
    background: var(--red-primary);
    box-shadow: 0 0 8px var(--red-glow);
}

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

.clock {
    font-family: var(--font-mono);
    font-size: 16px;
    color: var(--white);
    font-weight: 600;
}

/* Métricas */
.metrics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s;
}

.metric-card:hover {
    border-color: var(--red-primary);
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-answered .metric-value { color: var(--green); }
.metric-abandoned .metric-value { color: var(--red-light); }
.metric-sla .metric-value { color: var(--yellow); }

/* Operação */
.operation-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
    padding: 0 24px 16px;
}

@media (max-width: 1024px) {
    .operation-section {
        grid-template-columns: 1fr;
    }
}

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

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    background: var(--red-primary);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    font-family: var(--font-mono);
}

/* Fila */
.queue-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.queue-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--red-primary);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.queue-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.queue-caller {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
}

.queue-position {
    font-size: 11px;
    color: var(--text-muted);
}

.queue-wait {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--red-light);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 32px 16px;
    font-size: 14px;
}

/* Agentes */
.agents-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.agent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.agent-card.available::before { background: var(--green); }
.agent-card.in_call::before,
.agent-card.busy::before,
.agent-card.ringing::before { background: var(--red-primary); }
.agent-card.paused::before { background: var(--yellow); }
.agent-card.unavailable::before,
.agent-card.logged_out::before,
.agent-card.unknown::before { background: var(--gray); }

.agent-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
}

.agent-ext {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.agent-status-label {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.agent-card.available .agent-status-label {
    background: var(--green-dark);
    color: var(--green);
}
.agent-card.in_call .agent-status-label,
.agent-card.busy .agent-status-label,
.agent-card.ringing .agent-status-label {
    background: var(--red-dark);
    color: var(--red-light);
}
.agent-card.paused .agent-status-label {
    background: var(--yellow-dark);
    color: var(--yellow);
}
.agent-card.unavailable .agent-status-label,
.agent-card.logged_out .agent-status-label,
.agent-card.unknown .agent-status-label {
    background: #374151;
    color: var(--gray);
}

.agent-call-info {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.agent-call-timer {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--red-light);
    margin-top: 4px;
}

/* Histórico */
.history-section {
    padding: 0 24px 24px;
}

.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.history-filters input,
.history-filters select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    outline: none;
}

.history-filters input:focus,
.history-filters select:focus {
    border-color: var(--red-primary);
}

.btn-filter {
    background: var(--red-primary);
    color: var(--white);
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-filter:hover {
    background: var(--red-light);
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table thead {
    background: var(--bg-secondary);
}

.history-table th {
    padding: 10px 12px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.history-table tr:hover td {
    background: var(--bg-card-hover);
}

.history-table .mono {
    font-family: var(--font-mono);
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.status-badge.answered {
    background: var(--green-dark);
    color: var(--green);
}

.status-badge.abandoned {
    background: var(--red-dark);
    color: var(--red-light);
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}

.pagination button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination button:hover {
    border-color: var(--red-primary);
}

.pagination button.active {
    background: var(--red-primary);
    border-color: var(--red-primary);
    color: var(--white);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* User info no header */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: var(--red-primary);
    color: var(--red-light);
}

.btn-admin {
    background: transparent;
    border: 1px solid var(--red-primary);
    color: var(--red-light);
    padding: 4px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-admin:hover { background: var(--red-primary); color: var(--white); }
