/* ============================================================
   diary.css — Diario de Aprendizaje: Growth Hacking
   Growth City Serious Game
   ============================================================ */

/* ── Overlay ─────────────────────────────────────────────── */
#diary-overlay {
    position: fixed;
    inset: 0;
    z-index: 550;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    transition: background .25s ease;
}
#diary-overlay.visible {
    background: rgba(0,0,0,.8);
    pointer-events: all;
}

/* ── Panel principal ─────────────────────────────────────── */
#diary-panel {
    background: #080d12;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    width: 100%;
    max-width: 660px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.9) translateY(18px);
    opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
    box-shadow: 0 28px 72px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.04);
}
#diary-panel.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Header ──────────────────────────────────────────────── */
#diary-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,.055);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
#diary-header-left { flex: 1; min-width: 0; }
#diary-title {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 3px;
}
#diary-chain-label {
    font-size: 11px;
    color: rgba(255,255,255,.32);
    letter-spacing: .3px;
    transition: color .3s;
}
#diary-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
#diary-progress-wrap {
    display: flex;
    align-items: baseline;
    gap: 3px;
}
#diary-progress-num {
    font-size: 22px;
    font-weight: 800;
    color: #ffd93d;
    line-height: 1;
}
#diary-progress-sep  { font-size: 14px; color: rgba(255,255,255,.3); }
#diary-progress-label { font-size: 10px; color: rgba(255,255,255,.3); text-transform: uppercase; letter-spacing: .5px; }
#diary-close {
    background: none; border: none;
    color: rgba(255,255,255,.28); font-size: 20px;
    cursor: pointer; padding: 2px 6px; line-height: 1;
    transition: color .2s; flex-shrink: 0;
}
#diary-close:hover { color: rgba(255,255,255,.65); }

/* ── Barra de progreso total ─────────────────────────────── */
#diary-progress-bar-wrap {
    height: 3px;
    background: rgba(255,255,255,.06);
    flex-shrink: 0;
}
#diary-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #74c8ff, #a78bfa, #22c55e);
    transition: width .5s ease;
    border-radius: 0 3px 3px 0;
}

/* ── Búsqueda ────────────────────────────────────────────── */
#diary-search-wrap {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    flex-shrink: 0;
}
#diary-search {
    width: 100%;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 8px 13px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    color: #fff;
    outline: none;
    transition: border-color .2s, background .2s;
    caret-color: #74c8ff;
}
#diary-search::placeholder { color: rgba(255,255,255,.28); }
#diary-search:focus {
    border-color: rgba(116,200,255,.4);
    background: rgba(116,200,255,.06);
}

/* ── Pestañas de fase ────────────────────────────────────── */
#diary-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
    gap: 0;
}
.diary-tab {
    flex: 1;
    padding: 10px 8px 9px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: rgba(255,255,255,.28);
    letter-spacing: .3px;
    text-transform: uppercase;
    transition: color .2s, border-color .2s, background .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.diary-tab:hover:not(.active) { color: rgba(255,255,255,.55); }
.diary-tab.active {
    color: var(--phase-color, #74c8ff);
    border-bottom-color: var(--phase-color, #74c8ff);
    background: color-mix(in srgb, var(--phase-color, #74c8ff) 6%, transparent);
}
.diary-tab-label { font-size: 11px; }
.diary-tab-count {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,.25);
    background: rgba(255,255,255,.06);
    border-radius: 10px;
    padding: 1px 7px;
    transition: color .3s, background .3s;
}
.diary-tab-count.complete {
    color: #4ade80;
    background: rgba(74,222,128,.12);
}

/* ── Cuerpo scrollable ───────────────────────────────────── */
#diary-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#diary-body::-webkit-scrollbar { width: 3px; }
#diary-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

/* ── Cadena causal ───────────────────────────────────────── */
.diary-chain-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 4px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.diary-chain-row::-webkit-scrollbar { display: none; }
.diary-chain-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.03);
    opacity: .35;
    transition: opacity .3s;
    min-width: 52px;
}
.diary-chain-dot.owned {
    opacity: 1;
    background: color-mix(in srgb, var(--dot-color) 8%, transparent);
    border-color: color-mix(in srgb, var(--dot-color) 30%, transparent);
}
.diary-chain-emoji { font-size: 16px; line-height: 1; }
.diary-chain-name  { font-size: 9px; color: rgba(255,255,255,.5); text-align: center; white-space: nowrap; }
.diary-chain-arrow { font-size: 12px; color: rgba(255,255,255,.18); flex-shrink: 0; }

/* ── Ficha de artefacto ──────────────────────────────────── */
.diary-card {
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.07);
    font-family: 'Segoe UI', Arial, sans-serif;
    overflow: hidden;
    transition: border-color .2s;
}
.diary-card.owned {
    border-color: color-mix(in srgb, var(--card-color) 20%, rgba(255,255,255,.07));
    cursor: pointer;
}
.diary-card.owned:hover {
    border-color: color-mix(in srgb, var(--card-color) 40%, transparent);
}
.diary-card.locked { opacity: .52; }

/* ── Header de la ficha ──────────────────────────────────── */
.diary-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,.025);
    user-select: none;
}
.diary-card-seq {
    width: 22px; height: 22px;
    border-radius: 6px;
    border: 1px solid;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800;
    flex-shrink: 0;
    line-height: 1;
}
.diary-card-emoji { font-size: 20px; flex-shrink: 0; line-height: 1; }
.diary-card-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.diary-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.diary-card-concept {
    font-size: 11px;
    color: rgba(255,255,255,.38);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.diary-card-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.diary-card-status.owned {
    background: rgba(74,222,128,.12);
    color: #4ade80;
    border: 1px solid rgba(74,222,128,.25);
}
.diary-card-status.locked {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.25);
    border: 1px solid rgba(255,255,255,.1);
}
.diary-card-chevron {
    font-size: 12px;
    color: rgba(255,255,255,.22);
    flex-shrink: 0;
    transition: transform .25s ease;
}
.diary-card.open .diary-card-chevron { transform: rotate(180deg); }

/* ── Cuerpo expandible ───────────────────────────────────── */
.diary-card-body {
    display: none;
    padding: 0 14px 14px;
    border-top: 1px solid rgba(255,255,255,.05);
}
.diary-card.open .diary-card-body { display: block; }

/* ── Secciones del cuerpo ────────────────────────────────── */
.diary-section { margin-top: 14px; }
.diary-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.32);
    margin-bottom: 6px;
}
.diary-section-text {
    font-size: 13px;
    color: #b0bcc8;
    line-height: 1.72;
}

/* Decisión clave destacada */
.diary-decision {
    font-size: 13px;
    font-weight: 600;
    color: #e8f4ff;
    font-style: italic;
    line-height: 1.55;
}

/* Keypoint */
.diary-section-keypoint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(255,215,0,.04);
    border: 1px solid rgba(255,215,0,.12);
    border-left: 3px solid;
    border-radius: 0 8px 8px 0;
    padding: 10px 13px;
    font-size: 12px;
    color: #d8c880;
    line-height: 1.65;
}
.diary-kp-icon { font-size: 14px; flex-shrink: 0; line-height: 1.5; }

/* Ejemplo + anti-ejemplo en dos columnas */
.diary-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.diary-example {
    background: rgba(74,222,128,.04);
    border: 1px solid rgba(74,222,128,.12);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 0;
}
.diary-example .diary-section-label { color: #4ade80; }
.diary-antiexample {
    background: rgba(251,191,36,.04);
    border: 1px solid rgba(251,191,36,.12);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 0;
}
.diary-antiexample .diary-section-label { color: #fbbf24; }

/* Tags de herramientas */
.diary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}
.diary-tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,.04);
    border: 1px solid;
    color: rgba(255,255,255,.5);
    transition: background .15s;
}
.diary-tag:hover { background: rgba(255,255,255,.08); }

/* Nota personal */
.diary-note-section { margin-top: 14px; }
.diary-note-input {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 9px 12px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 12px;
    color: rgba(255,255,255,.7);
    resize: vertical;
    min-height: 64px;
    outline: none;
    transition: border-color .2s;
    line-height: 1.6;
    caret-color: #74c8ff;
}
.diary-note-input::placeholder { color: rgba(255,255,255,.2); }
.diary-note-input:focus { border-color: rgba(116,200,255,.3); }

/* Enlace a siguiente en la cadena */
.diary-chain-next {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 8px 12px;
    background: rgba(255,255,255,.03);
    border-radius: 8px;
    font-size: 12px;
}
.diary-chain-next-label { color: rgba(255,255,255,.3); }
.diary-chain-next-art {
    font-weight: 700;
    transition: opacity .15s;
}
.diary-chain-next-art:hover { opacity: .7; }
.diary-chain-complete {
    margin-top: 14px;
    text-align: center;
    font-size: 12px;
    color: rgba(74,222,128,.7);
    padding: 8px;
    background: rgba(74,222,128,.04);
    border-radius: 8px;
}

/* ── Ficha bloqueada ─────────────────────────────────────── */
.diary-locked-body {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,.04);
}
.diary-locked-hint {
    font-size: 12px;
    color: rgba(255,255,255,.22);
    font-style: italic;
    margin-bottom: 6px;
}
.diary-locked-preview {
    font-size: 11px;
    color: rgba(255,255,255,.35);
}

/* ── Estado vacío ────────────────────────────────────────── */
.diary-empty {
    text-align: center;
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.diary-empty-icon { font-size: 38px; }
.diary-empty-msg  { font-size: 14px; color: rgba(255,255,255,.45); line-height: 1.5; }
.diary-empty-hint { font-size: 12px; color: rgba(255,255,255,.2); }

/* ── Footer de navegación ────────────────────────────────── */
#diary-footer {
    padding: 10px 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,.05);
    flex-shrink: 0;
    gap: 8px;
}
.diary-nav-btn {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 7px;
    color: rgba(255,255,255,.45);
    padding: 7px 14px;
    cursor: pointer;
    transition: background .15s, color .15s;
    min-height: 34px;
}
.diary-nav-btn:hover {
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.75);
}
#diary-footer-phase {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,.28);
    text-transform: uppercase;
    letter-spacing: .5px;
    text-align: center;
    flex: 1;
}

/* ── Botón de apertura en HUD ────────────────────────────── */
#diary-open-btn {
    display: block;
    width: 100%;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    color: rgba(255,255,255,.6);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
    cursor: pointer;
    margin-top: 10px;
    text-align: center;
    transition: background .2s, border-color .2s;
    pointer-events: all;
}
#diary-open-btn:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.2);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    #diary-panel      { border-radius: 16px 16px 0 0; }
    .diary-two-col    { grid-template-columns: 1fr; }
    #diary-title      { font-size: 15px; }
    .diary-tab        { font-size: 10px; padding: 8px 4px; }
    .diary-tab-label  { display: none; } /* solo mostrar el emoji en mobile */
    #diary-body       { padding: 12px 12px; }
    #diary-footer     { padding: 8px 12px 12px; }
    .diary-nav-btn    { font-size: 11px; padding: 6px 10px; }
    .diary-chain-row  { padding: 6px 2px 10px; gap: 4px; }
    .diary-chain-dot  { min-width: 44px; padding: 5px 5px; }
    .diary-chain-name { display: none; }
}
@media (max-width: 380px) {
    .diary-tab-count  { display: none; }
}

/* ── Ajuste al design system ─────────────────────────────── */
#diary-panel, .diary-nav-btn, .diary-tab,
.diary-card-name, .diary-section-text {
    font-family: var(--font, 'Inter', sans-serif);
}
