/* main.css - Estilo Sims Diorama & Cozy Developer Sanctuary */

:root {
    --bg-dark: #0f131a;
    --text-main: #f3f6fa;
    --text-muted: #9aa5b5;
    --accent-cyan: #00f0ff;
    --accent-emerald: #39ff14;
    --accent-amber: #ffaa33;
    --accent-pink: #ff3366;
    --sims-green: #2ecc71;
    --sims-blue: #3498db;
    --sims-orange: #e67e22;
    --glass-bg: rgba(18, 23, 33, 0.82);
    --glass-border: rgba(255, 255, 255, 0.14);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-sans);
    color: var(--text-main);
    user-select: none;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* HUD Superior */
#hud-header {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.brand-plumbob {
    font-size: 1.2rem;
    animation: plumbobSpin 4s infinite linear;
    display: inline-block;
}

@keyframes plumbobSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.hud-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    pointer-events: auto;
}

#btn-toggle-lofi {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    padding: 0.5rem 1.1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

#btn-toggle-lofi:hover {
    border-color: var(--accent-pink);
}

#btn-toggle-lofi.playing {
    border-color: var(--accent-pink);
    box-shadow: 0 0 16px rgba(255, 51, 102, 0.4);
    color: var(--accent-pink);
}

#status-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.85rem;
}

.pill-badge {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
}

.pill-time {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-weight: 600;
}

/* Bocadillo de Pensamiento (Thought Bubble) Flotante */
#thought-bubble {
    position: absolute;
    top: 32%;
    left: 49%;
    transform: translate(-50%, -50%) scale(0.5);
    background: #ffffff;
    color: #111;
    font-size: 1.8rem;
    padding: 0.6rem 1rem;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 255, 255, 0.3);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#thought-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 35%;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
}

#thought-bubble::before {
    content: '';
    position: absolute;
    bottom: -18px;
    left: 28%;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
}

#thought-bubble.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* HUD Inferior Estilo Los Sims */
#sims-hud {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    padding: 0.65rem 1.4rem;
    border-radius: 24px;
    display: flex;
    gap: 1.4rem;
    align-items: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.sims-avatar-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 14px;
    transition: background 0.2s;
}

.sims-avatar-pill:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sims-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #008f7a, #00f0ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 2px solid var(--accent-emerald);
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.5);
}

.sims-avatar-info {
    display: flex;
    flex-direction: column;
}

.sims-name {
    font-weight: 700;
    font-size: 0.88rem;
}

.sims-status {
    font-size: 0.75rem;
    color: var(--accent-emerald);
}

.sims-quick-nav {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.hud-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.45rem 0.85rem;
    border-radius: 12px;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.hud-btn:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: translateY(-2px);
}

/* Modales y Detalle */
#view-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(880px, 92vw);
    max-height: 85vh;
    background: rgba(18, 23, 33, 0.94);
    border: 1px solid rgba(0, 240, 255, 0.3);
    backdrop-filter: blur(24px);
    border-radius: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 240, 255, 0.15);
    overflow: hidden;
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--glass-border);
}

#modal-title {
    font-size: 1.15rem;
    font-weight: 600;
}

#btn-close-modal {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#btn-close-modal:hover {
    background: rgba(255, 60, 60, 0.3);
    color: #fff;
}

.modal-content {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Perfil Sims del Dev */
.sims-profile-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.sims-avatar-large {
    font-size: 3rem;
    background: rgba(0, 240, 255, 0.1);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-emerald);
}

.sims-mood-badge {
    color: var(--accent-emerald);
    font-weight: 600;
    margin-top: 0.3rem;
}

.sims-needs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.need-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.need-bar-bg {
    background: rgba(0, 0, 0, 0.5);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.need-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.need-caffeine { background: linear-gradient(90deg, #d35400, #e67e22); }
.need-focus { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.need-social { background: linear-gradient(90deg, #8e44ad, #9b59b6); }
.need-cat { background: linear-gradient(90deg, #e91e63, #ff4081); }

.sims-actions-row {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.sims-btn {
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.35);
    color: var(--accent-cyan);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s;
}

.sims-btn:hover {
    background: rgba(0, 240, 255, 0.25);
    transform: scale(1.03);
}

/* Notificación Flotante (Toast) */
.sims-toast {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(46, 204, 113, 0.95);
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.88rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 200;
    animation: toastPop 0.3s ease;
}

@keyframes toastPop {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Tabs & Componentes del Modal */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.1);
    font-weight: 600;
}

.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-critical { background: rgba(255, 59, 48, 0.25); color: #ff453a; }
.badge-warning { background: rgba(255, 159, 10, 0.25); color: #ff9f0a; }
.badge-info { background: rgba(0, 191, 255, 0.25); color: #00bfff; }
.badge-baseline { background: rgba(50, 215, 75, 0.25); color: #32d74b; }

.card-desc {
    color: #c9d1d9;
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
}

.card-mitigation {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #9aa5b5;
}

code, pre {
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.4);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: var(--accent-cyan);
}

pre {
    padding: 0.75rem;
    margin: 0.5rem 0;
    overflow-x: auto;
}

textarea, input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.65rem 0.85rem;
    margin: 0.5rem 0;
    outline: none;
}

.input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-btn {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: var(--accent-cyan);
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.result-box {
    margin-top: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    padding: 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.grid-2, .observatory-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.hidden {
    display: none !important;
}

/* Responsivo en móviles */
@media (max-width: 768px) {
    #hud-header {
        flex-direction: column;
        gap: 0.5rem;
        top: 0.75rem;
    }
    #sims-hud {
        width: 92vw;
        overflow-x: auto;
        bottom: 1rem;
        padding: 0.5rem 0.8rem;
    }
    .grid-2, .observatory-grid, .sims-needs-grid {
        grid-template-columns: 1fr;
    }
}
