:root {
    --bg-primary: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --glass-blur: 12px;
}

body {
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 50% -20%, #1e293b, var(--bg-primary));
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
}

.card.bg-secondary {
    background: var(--card-bg) !important;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

h3, h4, h5, h6 {
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.form-label {
    color: #cbd5e1;
    font-weight: 500;
    margin-left: 1rem;
    font-size: 0.9rem;
}

.form-control {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
    padding: 0.8rem 1.5rem !important;
    transition: all 0.3s ease;
}

.form-control:focus {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2) !important;
}

.order-details b {
    color: var(--text-secondary);
    font-weight: 500;
}

.order-details span {
    color: var(--text-primary);
    font-weight: 600;
}

.badge {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.bg-dark {
    background-color: rgba(15, 23, 42, 0.5) !important;
}

.btn-primary { 
    background: linear-gradient(135deg, var(--accent-color), #2563eb);
    border: none;
    transition: transform 0.2s;
}

.btn-success { 
    background: linear-gradient(135deg, var(--success-color), #059669);
    border: none;
}

.btn-danger { 
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.rounded-5 { border-radius: 1.5rem !important; }
.rounded-pill { border-radius: 50rem !important; }

/* Legibilidad: textos claros sobre fondos oscuros */
.agent-portal-body {
    color: #f1f5f9 !important;
}

.agent-portal-body .text-muted {
    color: #cbd5e1 !important;
}

.agent-portal-hint {
    color: #e2e8f0 !important;
}

.agent-booking-detail {
    padding: 0.65rem 0.85rem;
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.agent-booking-detail .list-unstyled li:last-child {
    margin-bottom: 0 !important;
}

.agent-portal-body .form-check-label {
    color: #f8fafc !important;
}

.agent-activities-box {
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Campo "Nueva actividad": fondo claro y texto oscuro (contraste con el panel) */
.agent-portal-body .agent-activity-new-input,
.agent-activities-box .agent-activity-new-input {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.2) !important;
    padding: 0.5rem 0.75rem !important;
}

.agent-portal-body .agent-activity-new-input::placeholder {
    color: #64748b !important;
    opacity: 1;
}

.agent-portal-body .agent-activity-new-input:focus {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

.agent-modal-textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* Temporizador estilo “Matrix”: alto contraste y números legibles */
.agent-matrix-timer {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #030806;
    border: 1px solid #145214;
    box-shadow:
        inset 0 0 40px rgba(0, 40, 10, 0.85),
        0 0 0 1px rgba(0, 255, 65, 0.12),
        0 8px 32px rgba(0, 0, 0, 0.6);
    transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
}

.agent-matrix-timer__scan {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 2px,
        rgba(0, 255, 65, 0.03) 4px
    );
    opacity: 0.9;
}

.agent-matrix-timer__inner {
    position: relative;
    z-index: 1;
    padding: 1.1rem 1.25rem 1.15rem;
}

.agent-matrix-timer__title {
    font-family: 'Share Tech Mono', ui-monospace, monospace;
    font-size: clamp(1.05rem, 3.2vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    color: rgba(0, 255, 100, 0.65);
    margin-bottom: 1rem;
}

.agent-matrix-timer__times {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.agent-matrix-timer__time-block {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.agent-matrix-timer__time-block--first {
    padding-top: 0;
    border-bottom: 1px solid rgba(0, 255, 65, 0.12);
    margin-bottom: 0.35rem;
    padding-bottom: 0.85rem;
}

.agent-matrix-timer__label {
    font-family: 'Share Tech Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(0, 255, 80, 0.45);
    margin-bottom: 0.35rem;
}

.agent-matrix-timer__value {
    font-family: 'Share Tech Mono', ui-monospace, monospace;
    font-size: clamp(1.5rem, 4.5vw, 2.15rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    color: #39ff14;
    text-shadow:
        0 0 6px rgba(57, 255, 20, 0.95),
        0 0 14px rgba(0, 255, 65, 0.45),
        0 0 1px #000;
    -webkit-font-smoothing: antialiased;
}

.agent-matrix-timer__value--secondary {
    font-size: clamp(1.15rem, 3.5vw, 1.65rem);
    letter-spacing: 0.06em;
    color: #7dff9a;
    text-shadow:
        0 0 5px rgba(125, 255, 154, 0.75),
        0 0 12px rgba(0, 200, 80, 0.35),
        0 0 1px #000;
}

.agent-matrix-timer__catalog {
    font-family: 'Share Tech Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: rgba(0, 255, 100, 0.5);
    border-top: 1px solid rgba(0, 255, 65, 0.12);
    padding-top: 0.75rem;
}

/* Estados: ≤10 min ámbar, ≤5 min rojo “terminal” */
.agent-service-timer-wrap.agent-timer-warn {
    border-color: #b45309;
    background: #0c0802;
    box-shadow:
        inset 0 0 40px rgba(180, 83, 9, 0.15),
        0 0 0 2px rgba(245, 158, 11, 0.35),
        0 0 24px rgba(245, 158, 11, 0.12);
}

.agent-service-timer-wrap.agent-timer-warn .agent-matrix-timer__value {
    color: #fbbf24;
    text-shadow:
        0 0 8px rgba(251, 191, 36, 0.9),
        0 0 16px rgba(245, 158, 11, 0.4),
        0 0 1px #000;
}

.agent-service-timer-wrap.agent-timer-warn .agent-matrix-timer__value--secondary {
    color: #fcd34d;
    text-shadow:
        0 0 6px rgba(252, 211, 77, 0.75),
        0 0 14px rgba(245, 158, 11, 0.35),
        0 0 1px #000;
}

.agent-service-timer-wrap.agent-timer-warn .agent-matrix-timer__title,
.agent-service-timer-wrap.agent-timer-warn .agent-matrix-timer__label {
    color: rgba(251, 191, 36, 0.55);
}

.agent-service-timer-wrap.agent-timer-danger {
    border-color: #dc2626;
    background: #100505;
    box-shadow:
        inset 0 0 48px rgba(220, 38, 38, 0.2),
        0 0 0 2px rgba(239, 68, 68, 0.45),
        0 0 28px rgba(239, 68, 68, 0.2);
}

.agent-service-timer-wrap.agent-timer-danger .agent-matrix-timer__value,
.agent-service-timer-wrap.agent-timer-danger .agent-matrix-timer__value--secondary {
    color: #ff6b6b;
    text-shadow:
        0 0 10px rgba(255, 107, 107, 0.95),
        0 0 20px rgba(239, 68, 68, 0.45),
        0 0 1px #000;
}

.agent-service-timer-wrap.agent-timer-danger .agent-matrix-timer__title,
.agent-service-timer-wrap.agent-timer-danger .agent-matrix-timer__label {
    color: rgba(255, 150, 150, 0.65);
}

.agent-extra-alert {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #e0f2fe !important;
}

.agent-extra-alert-secondary {
    background: rgba(100, 116, 139, 0.35) !important;
    color: #f1f5f9 !important;
}

.agent-portal-body .table-dark {
    --bs-table-bg: rgba(30, 41, 59, 0.9);
    --bs-table-color: #f8fafc;
    color: #f8fafc !important;
}

.agent-portal-body .table-dark th,
.agent-portal-body .table-dark td {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

.agent-portal-body .modal .list-group-item {
    color: #f8fafc !important;
    background: rgba(15, 23, 42, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.agent-portal-body .modal .list-group-item:hover {
    background: rgba(59, 130, 246, 0.25) !important;
}

/* Pedido adicional: filas en texto (abrir modal al pulsar) — texto claro (los <button> no heredan bien el color del body) */
.agent-portal-body #extra-order-items-list,
.agent-portal-body #extra-order-items-list .agent-extra-lines {
    color: #f8fafc;
}
.agent-extra-lines .agent-extra-line-row {
    cursor: pointer;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.45);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
    text-align: left;
    color: #f8fafc !important;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.agent-extra-lines .agent-extra-line-row:hover,
.agent-extra-lines .agent-extra-line-row:focus {
    color: #f8fafc !important;
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(30, 41, 59, 0.75);
}
.agent-extra-lines .agent-extra-line-row:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.agent-extra-lines .agent-extra-line-row .fw-semibold,
.agent-extra-lines .agent-extra-line-row .fw-bold {
    color: #f8fafc !important;
}
.agent-extra-lines .agent-extra-line-meta {
    font-variant-numeric: tabular-nums;
}

/* Resumen «Pedido / Total» sobre la lista del pedido adicional */
.agent-portal-body #agent-extra-order-active > .d-flex.small {
    color: rgba(248, 250, 252, 0.9);
}
.agent-portal-body #agent-extra-order-active > .d-flex.small strong {
    color: #f8fafc;
}

/* Modal «Agregar producto»: ítems del catálogo (list-group-action fuerza color oscuro en BS5) */
.agent-portal-body #upsellModal .list-group-item,
.agent-portal-body #upsellModal .list-group-item-action,
.agent-portal-body #upsellModal .list-group-item:focus,
.agent-portal-body #upsellModal .list-group-item:hover {
    color: #f8fafc !important;
}
.agent-portal-body #upsellModal .list-group-item.active {
    background-color: rgba(56, 189, 248, 0.22) !important;
    border-color: rgba(56, 189, 248, 0.55) !important;
    color: #f8fafc !important;
}
.agent-portal-body #upsellModal .list-group-item:disabled,
.agent-portal-body #upsellModal .list-group-item[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
