/* ===========================
   ORB Tutor AI - Estilos base
   =========================== */

/* --------- Variables --------- */
:root {
    --bt-bg: #050814;
    --bt-bg-alt: #070b18;
    --bt-surface: rgba(13, 18, 35, 0.92);
    --bt-border-subtle: rgba(255, 255, 255, 0.06);
    --bt-border-strong: rgba(255, 255, 255, 0.16);
    --bt-primary: #4ea8ff;
    --bt-primary-soft: rgba(78, 168, 255, 0.18);
    --bt-accent: #00e0ff;
    --bt-text-main: #f8f9fa;
    --bt-text-muted: #868e96;
    --bt-radius-lg: 18px;
    --bt-radius-md: 12px;
    --bt-radius-pill: 999px;
}

/* --------- Body & layout --------- */

body,
.bt-body {
    background:
        radial-gradient(circle at top, #202840 0, #050814 55%, #000 100%);
    color: var(--bt-text-main);
    min-height: 100vh;
}

/* Corregir color por defecto de Bootstrap */
body,
.bt-body,
.bt-body p,
.bt-body span,
.bt-body label,
.bt-body small {
    color: var(--bt-text-main);
}

/* Contenedor general debajo del navbar */
.bt-main {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* --------- Navbar --------- */

.bt-navbar {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--bt-border-subtle);
}

.bt-navbar .navbar-brand {
    font-weight: 600;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.bt-navbar .navbar-brand .bt-orb-logo {
    flex-shrink: 0;
}

.bt-navbar .nav-link {
    font-size: 0.9rem;
    color: var(--bt-text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.bt-navbar .nav-link:hover {
    color: var(--bt-text-main);
}

.bt-navbar .nav-link.active,
.bt-navbar .nav-link:focus.active {
    color: var(--bt-primary);
    font-weight: 500;
}

.bt-navbar .navbar-text {
    font-size: 0.85rem;
}

/* --------- Orb logo pequeño (en navbar, etc.) --------- */

.bt-orb-logo {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background:
        radial-gradient(circle at 30% 20%, #ffffff 0, rgba(255, 255, 255, 0) 35%),
        radial-gradient(circle at 30% 30%, var(--bt-accent), #0044ff 55%, #000 100%);
    box-shadow:
        0 0 10px rgba(0, 224, 255, 0.8),
        0 0 26px rgba(0, 64, 255, 0.7);
    display: inline-block;
}

/* --------- Tarjetas tipo Glassmorphism --------- */

.bt-glass,
.card.bt-glass {
    background: var(--bt-surface);
    border-radius: var(--bt-radius-lg);
    border: 1px solid var(--bt-border-subtle);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02),
        0 22px 45px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.card.bg-transparent {
    background: rgba(10, 14, 30, 0.75) !important;
    border-radius: var(--bt-radius-md);
}

/* --------- Textos & Badges --------- */

.text-muted {
    color: var(--bt-text-muted) !important;
}

.badge-level {
    font-size: 0.85rem;
    border-radius: var(--bt-radius-pill);
    padding: 0.2rem 0.7rem;
}

/* Mensajes tipo burbuja para ayuda / instrucciones */
.message-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    color: var(--bt-text-main);
    text-align: left;
}

/* Notas pequeñas */
.small-note {
    font-size: 0.75rem;
    color: var(--bt-text-muted);
}

/* --------- ORB principal (voz) --------- */

.orb {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    position: relative;
    background:
        radial-gradient(circle at 30% 20%, #ffffff 0px, rgba(255, 255, 255, 0) 40%),
        radial-gradient(circle at 30% 30%, #00e0ff, #0040ff 55%, #000 100%);
    box-shadow:
        0 0 25px rgba(0, 224, 255, 0.5),
        0 0 80px rgba(0, 64, 255, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
}

.orb-idle {
    opacity: 0.9;
}

.orb-listening {
    animation: orbPulse 1.2s infinite;
}

.orb-speaking,
.orb-thinking {
    animation: orbBreath 1.6s infinite;
}

.orb:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 35px rgba(0, 224, 255, 0.75),
        0 0 100px rgba(0, 64, 255, 0.7);
}

/* Estados del ORB */
.orb-status {
    font-size: 0.9rem;
    color: #adb5bd;
}

/* Animaciones */
@keyframes orbPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 224, 255, 0.5);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 60px rgba(0, 224, 255, 0.95);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 224, 255, 0.5);
    }
}

@keyframes orbBreath {
    0% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 150, 255, 0.5);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 70px rgba(0, 150, 255, 0.95);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 150, 255, 0.5);
    }
}

/* Wrapper genérico donde se coloca el ORB centrado */
.orb-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-container {
    text-align: center;
    max-width: 700px;
}

/* --------- KPI cards (dashboard) --------- */

.card .card-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
    color: var(--bt-text-muted);
}

.card .card-body h3,
.card .card-body .display-5 {
    color: var(--bt-text-main);
}

/* --------- Tablas (historial de créditos, etc.) --------- */

.table {
    color: var(--bt-text-main);
    margin-bottom: 0;
}

.table thead tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table tbody tr {
    border-color: rgba(255, 255, 255, 0.04);
}

.table.table-sm > :not(caption) > * > * {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.table .text-success {
    color: #5cd68a !important;
}

.table .text-danger {
    color: #ff6b6b !important;
}

/* Badges para tipos de transacción */
.badge.bg-success,
.badge.bg-danger,
.badge.bg-secondary {
    border-radius: var(--bt-radius-pill);
    font-weight: 500;
}

/* --------- Progreso (accordion) --------- */

.accordion-button.bg-transparent {
    background: transparent;
}

.accordion-button {
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background: rgba(255, 255, 255, 0.02);
    color: var(--bt-text-main);
}

.accordion-item {
    background-color: transparent;
}

/* --------- Formularios (profile, login, etc.) --------- */

.form-control,
.form-select {
    background-color: rgba(10, 14, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--bt-text-main);
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(10, 14, 30, 0.95);
    border-color: var(--bt-primary);
    box-shadow: 0 0 0 0.1rem rgba(78, 168, 255, 0.35);
    color: var(--bt-text-main);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* Botones */

.btn-primary {
    background: linear-gradient(135deg, #4ea8ff, #00e0ff);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #66b7ff, #21f0ff);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--bt-text-main);
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-outline-warning {
    border-color: #ffd43b;
    color: #ffd43b;
}

.btn-outline-warning:hover {
    background-color: rgba(255, 212, 59, 0.1);
}

/* --------- Créditos pill en la navbar / header --------- */

.credits-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: var(--bt-radius-pill);
    padding: 0.2rem 0.7rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
}

/* --------- Chart.js canvas --------- */

#chartMinutes,
#chartTopics,
canvas {
    max-width: 100%;
}

/* --------- Footer (por si lo usas) --------- */

.bt-footer {
    border-top: 1px solid var(--bt-border-subtle);
    font-size: 0.8rem;
    color: var(--bt-text-muted);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* --------- Responsivo --------- */

@media (max-width: 768px) {
    .orb {
        width: 150px;
        height: 150px;
    }

    .bt-main {
        padding-top: 1rem;
        padding-bottom: 1.5rem;
    }
}