/* ===================================================================
   style.css - Sistema de Design do Robô Fofoqueiro Premium
   ===================================================================
   Tema oscuro/claro, animações suaves, layout responsivo,
   glassmorphism, neumorfismo e microinterações.
   =================================================================== */

/* ===== VARIÁVEIS GLOBAIS ===== */
:root {
    /* Cores principais - Tema Escuro (padrão) */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2332;
    --surface: #1e293b;
    --surface-hover: #2d3a4f;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-primary: #f59e0b;
    --accent-secondary: #ef4444;
    --accent-success: #10b981;
    --accent-info: #3b82f6;
    --border-color: #334155;
    --glow-green: 0 0 15px rgba(16, 185, 129, 0.5);
    --glow-red: 0 0 20px rgba(239, 68, 68, 0.6);
    --glow-orange: 0 0 15px rgba(245, 158, 11, 0.5);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Tema Claro */
:root[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #cbd5e1;
}

/* ===== RESET E BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hide {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
}

.robot-loader {
    background: var(--surface);
    padding: 2rem;
    border-radius: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.loader-head {
    font-size: 4rem;
    animation: bounce 1s ease infinite;
}

.loader-text {
    margin: 1rem 0;
    font-weight: 600;
    color: var(--accent-primary);
}

.loader-bar {
    width: 300px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.loader-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    transition: width 0.3s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* ===== NOTIFICAÇÕES ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: var(--surface);
    border-left: 4px solid var(--accent-primary);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    backdrop-filter: blur(10px);
}

.notification.success {
    border-left-color: var(--accent-success);
}

.notification.error {
    border-left-color: var(--accent-secondary);
}

.notification.warning {
    border-left-color: var(--accent-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== HEADER ===== */
.main-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-robot {
    font-size: 2.5rem;
    animation: wave 2s ease infinite;
    transform-origin: 70% 70%;
}

@keyframes wave {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(15deg);
    }

    75% {
        transform: rotate(-10deg);
    }
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badges-area {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge.bncc {
    background: #3b82f6;
    color: white;
}

.badge.rcp {
    background: #10b981;
    color: white;
}

.badge.offline {
    background: #8b5cf6;
    color: white;
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    transform: scale(1.05);
    background: var(--surface-hover);
}

/* ===== CONTAINER PRINCIPAL ===== */
.main-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1.5rem;
}

/* ===== SIDEBARS ===== */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stats-card,
.achievements-card,
.ia-panel,
.control-panel,
.dictionary-card {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-card:hover,
.achievements-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stats-card h3,
.achievements-card h3,
.control-panel h3,
.dictionary-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
    padding-left: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    color: var(--accent-primary);
}

.achievement {
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 10px;
    background: var(--bg-tertiary);
    font-size: 0.8rem;
    transition: all 0.2s;
    cursor: default;
}

.achievement.unlocked {
    background: linear-gradient(135deg, #f59e0b20, #ef444420);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

.achievement.locked {
    opacity: 0.5;
    filter: grayscale(0.3);
}

/* ===== ROBÔ CENTRAL ===== */
.robot-central {
    background: var(--bg-secondary);
    border-radius: 2rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2);
}

.robot-head {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--surface));
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    position: relative;
    border-bottom: 3px solid var(--accent-primary);
}

.antenna {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.antenna-ball {
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: var(--glow-orange);
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.antenna-line {
    width: 2px;
    height: 20px;
    background: var(--accent-primary);
    margin: 0 auto;
}

.eyes-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.eye {
    width: 70px;
    height: 70px;
    background: var(--bg-primary);
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 0, 0, 0.3);
}

.eye-iris {
    width: 35px;
    height: 35px;
    background: radial-gradient(circle at 30% 30%, #2eff7a, #0f9d3a);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
}

.eye-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    pointer-events: none;
}

.eye.alert .eye-iris {
    background: radial-gradient(circle at 30% 30%, #ff4d4d, #b91c1c);
}

.eye.alert .eye-glow {
    box-shadow: var(--glow-red);
    animation: blinkAlert 0.5s ease infinite;
}

@keyframes blinkAlert {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.facial-expression {
    font-size: 2.5rem;
    margin: 0.5rem 0;
    transition: transform 0.2s;
}

.mouth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.left-dot,
.right-dot {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.sound-wave {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 40px;
}

.wave-line {
    width: 4px;
    height: 15px;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: height 0.05s linear;
}

.sound-wave.active .wave-line {
    animation: waveAnim 0.2s ease infinite alternate;
}

@keyframes waveAnim {
    from {
        height: 15px;
    }

    to {
        height: 35px;
    }
}

.sound-wave.active .wave-line:nth-child(1) {
    animation-delay: 0s;
}

.sound-wave.active .wave-line:nth-child(2) {
    animation-delay: 0.05s;
}

.sound-wave.active .wave-line:nth-child(3) {
    animation-delay: 0.1s;
}

.sound-wave.active .wave-line:nth-child(4) {
    animation-delay: 0.15s;
}

.sound-wave.active .wave-line:nth-child(5) {
    animation-delay: 0.2s;
}

.speech-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 1.5s ease infinite;
}

/* TÓRAX */
.robot-chest {
    padding: 1.5rem;
    background: var(--bg-tertiary);
}

.chest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.screen-title {
    font-weight: 700;
    color: var(--accent-primary);
}

.screen-controls {
    display: flex;
    gap: 8px;
}

.screen-btn {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.screen-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.screen-view {
    min-height: 300px;
}

/* GRÁFICO */
#realTimeGraph {
    width: 100%;
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 10px;
}

.graph-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.7rem;
}

/* MAPA DE CALOR */
.heatmap-container {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1rem;
}

.school-map {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 1rem;
}

.map-cell {
    aspect-ratio: 1;
    background: var(--surface);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.map-cell:hover {
    transform: scale(1.02);
}

.map-cell .cell-db {
    font-size: 0.9rem;
    font-weight: 700;
}

.map-cell.cell-silent {
    background: #10b98140;
    color: #10b981;
}

.map-cell.cell-moderate {
    background: #f59e0b40;
    color: #f59e0b;
}

.map-cell.cell-loud {
    background: #ef444440;
    color: #ef4444;
}

.map-cell.cell-extreme {
    background: #dc262640;
    color: #dc2626;
    box-shadow: 0 0 10px #ef4444;
}

.heatmap-legend {
    display: flex;
    justify-content: space-around;
    font-size: 0.7rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* LOG DE FOFOcas */
.log-container {
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 0.5rem;
}

.log-entry {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.log-entry .log-time {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.7rem;
    min-width: 80px;
}

.log-entry .log-text {
    flex: 1;
}

.clear-log-btn {
    margin-top: 10px;
    width: 100%;
    background: var(--accent-secondary);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
}

/* SENSORES PANEL */
.sensors-panel {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.sensor-item {
    text-align: center;
}

.sensor-icon {
    font-size: 1.2rem;
    display: block;
}

.sensor-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.sensor-value {
    font-weight: 700;
    font-size: 1rem;
}

/* IA PANEL */
.ia-panel {
    position: relative;
}

.ia-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
}

.ia-badge {
    font-size: 0.6rem;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

.ia-message-container {
    max-height: 300px;
    overflow-y: auto;
}

.ia-message {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.ia-avatar {
    font-size: 2rem;
}

.ia-bubble {
    background: var(--bg-tertiary);
    padding: 10px 14px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    flex: 1;
}

.ia-bubble p {
    margin-bottom: 4px;
}

.ia-bubble small {
    font-size: 0.6rem;
    opacity: 0.6;
}

.ia-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    margin-top: 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingAnim 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnim {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* CONTROLES */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.control-btn.primary {
    background: linear-gradient(135deg, var(--accent-primary), #ea580c);
    color: white;
}

.control-btn.voice {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.control-btn.meme {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
}

.control-btn.auto {
    background: linear-gradient(135deg, #10b981, #047857);
    color: white;
}

.control-btn.reset {
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.control-btn:active {
    transform: scale(0.96);
}

/* DICIONÁRIO */
.dictionary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.dialect-word {
    font-weight: 700;
    color: var(--accent-primary);
}

.dialect-meaning {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* FOOTER */
.main-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.footer-content div {
    margin: 5px 0;
}

/* MODAL DE CONQUISTA */
.achievement-modal {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-modal.show {
    transform: translateX(-50%) translateY(0);
}

.achievement-modal-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.3);
    border-left: 5px solid var(--accent-primary);
}

.achievement-icon {
    font-size: 2rem;
}

/* RESPONSIVIDADE */
@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .sidebar-left,
    .sidebar-right {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-left>*,
    .sidebar-right>* {
        flex: 1;
        min-width: 250px;
    }
}

@media (max-width: 640px) {
    .main-container {
        padding: 1rem;
    }

    .eyes-container {
        gap: 1rem;
    }

    .eye {
        width: 50px;
        height: 50px;
    }

    .chest-header {
        flex-direction: column;
    }

    .sensors-panel {
        flex-direction: column;
        gap: 8px;
    }
}

/* BOTÃO ROBÔ FOFOQUEIRO - LINK NO HEADER */
.robo-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-primary), #ea580c);
    color: white;
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
}

.robo-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, #ea580c, var(--accent-primary));
}

.robo-link-btn:active {
    transform: translateY(1px);
}

/* Responsividade para o botão */
@media (max-width: 640px) {
    .robo-link-btn {
        padding: 4px 12px;
        font-size: 0.7rem;
    }
}