/* =========================================================
   VARIABLES DE COLOR Y ESTILOS GLOBALES
   ========================================================= */
:root {
    --rojo-dnd: #E22822;
    --fondo-gris: #f4f4f5;
    --borde-suave: #d1d5db;
    --texto-oscuro: #1f2937;
    --texto-claro: #6b7280;
}

* { box-sizing: border-box; }
body { 
    font-family: 'Roboto', sans-serif; 
    background-color: #e5e7eb; 
    color: var(--texto-oscuro); 
    padding: 0; /* Removido el padding global para el nuevo layout */
    font-size: 13px; 
    margin: 0;
}

/* =========================================================
   CONTENEDORES PRINCIPALES (NUEVO LAYOUT LATERAL)
   ========================================================= */
.main-layout {
    display: flex;
    gap: 20px;
    max-width: 1450px;
    margin: 40px auto;
    align-items: flex-start; /* Permite que la consola "flote" */
    padding: 0 20px;
}

/* La hoja ocupa el espacio izquierdo */
.sheet { 
    flex: 3;
    background: white; 
    padding: 30px; 
    border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 25px; 
}

/* La consola ocupa el espacio derecho (Flotante) */
.sidebar-log {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background: #111827;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 20px; 
    height: calc(100vh - 40px); 
}

.sidebar-log h3 {
    color: #10b981;
    margin-top: 0;
    border-bottom: 1px solid #374151;
    padding-bottom: 10px;
    font-family: 'Cinzel', serif;
    text-align: center;
    font-size: 16px;
}

.log-container {
    flex: 1;
    overflow-y: auto;
    color: #34d399; /* Verde Hacker */
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    padding-right: 5px;
}

/* Menú Superior de Guardado */
.action-menu {
    position: absolute; 
    top: 15px; 
    right: 20px; 
    display: flex; 
    gap: 8px; 
    z-index: 100;
}

/* =========================================================
   INPUTS Y TEXTOS GLOBALES
   ========================================================= */
input, textarea, select { 
    font-family: inherit; 
    border: 1px solid transparent; 
    border-bottom: 1px solid var(--borde-suave); 
    padding: 5px; 
    outline: none; 
    background: transparent; 
    transition: all 0.3s ease; 
    width: 100%;
}
input:focus, textarea:focus, select:focus { border-bottom-color: var(--rojo-dnd); }
textarea { resize: vertical; background: #fafafa; border: 1px solid var(--borde-suave); border-radius: 6px; padding: 10px; }
textarea:focus { border-color: var(--rojo-dnd); background: white; box-shadow: 0 0 5px rgba(226, 40, 34, 0.2); }

.label-title { 
    font-weight: bold; 
    font-size: 10px; 
    text-transform: uppercase; 
    text-align: center; 
    display: block; 
    margin-top: 5px; 
    color: var(--texto-claro); 
}

/* =========================================================
   CABECERA DEL PERSONAJE
   ========================================================= */
.header { grid-column: 1 / -1; display: flex; border-bottom: 4px solid var(--rojo-dnd); padding-bottom: 20px; gap: 30px; flex-wrap: wrap; }
.char-name { flex: 1 1 300px; display: flex; flex-direction: column; justify-content: flex-end; }
.char-name input { font-family: 'Cinzel', serif; font-size: 32px; color: var(--rojo-dnd); border-bottom: 2px solid var(--texto-oscuro); }
.char-details { flex: 2 1 500px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; background: var(--fondo-gris); padding: 15px; border-radius: 10px; border: 1px solid var(--borde-suave); }
.detail-box { display: flex; flex-direction: column; }
.detail-box input { font-size: 14px; font-weight: bold; }

/* COLUMNAS INTERNAS */
.col { display: flex; flex-direction: column; gap: 20px; }

/* =========================================================
   ATRIBUTOS Y HABILIDADES
   ========================================================= */
.stat-container { display: grid; grid-template-columns: 1fr; gap: 15px; width: 90px; float: left; margin-right: 20px; }
.stat-box { border: 2px solid var(--borde-suave); border-radius: 12px; text-align: center; padding: 10px 5px 25px 5px; background: white; position: relative; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.stat-box:hover { border-color: var(--rojo-dnd); transform: translateY(-2px); box-shadow: 0 5px 10px rgba(226, 40, 34, 0.15); }
.stat-name { font-size: 10px; font-weight: bold; text-transform: uppercase; color: var(--texto-oscuro); }
.stat-mod { font-size: 28px; font-weight: bold; margin: 5px 0; font-family: 'Cinzel', serif; }
.stat-score { width: 45px; text-align: center; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); border-radius: 20px; border: 2px solid var(--borde-suave); font-size: 15px; background: white; font-weight: bold; }

.skills-container { display: flex; flex-direction: column; gap: 15px; }
.skills-list { border: 1px solid var(--borde-suave); border-radius: 10px; padding: 12px; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.skill-row { display: flex; align-items: center; padding: 6px 8px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: all 0.1s ease; border-radius: 4px; }
.skill-row:last-child { border-bottom: none; }
.skill-row:hover { background: #fdf2f2; border-left: 4px solid var(--rojo-dnd); padding-left: 4px; }
.skill-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.skill-mod-input { width: 40px; text-align: center; border: none; border-bottom: 2px solid var(--borde-suave); font-weight: bold; font-size: 15px; background: transparent; margin: 0 12px; padding: 2px 0; }
.skill-stat { color: var(--texto-claro); font-size: 10px; width: 32px; text-align: center; display: inline-block; margin-right: 5px; }
.skill-name { flex: 1; font-size: 13px; line-height: 1.2; }

.prof-box { display: flex; align-items: center; justify-content: center; gap: 10px; border: 2px solid var(--borde-suave); padding: 10px; border-radius: 20px; background: white; width: 100%; }
.prof-box input { width: 40px; text-align: center; font-size: 20px; font-weight: bold; border: none; }

/* =========================================================
   COMBATE (VIDA, INICIATIVA, DADOS)
   ========================================================= */
.combat-row { display: flex; gap: 15px; flex-wrap: wrap; }
.combat-box { border: 2px solid var(--borde-suave); border-radius: 10px; padding: 15px; text-align: center; flex: 1; min-width: 80px; background: white; transition: all 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.combat-box.clickable:hover { border-color: var(--rojo-dnd); transform: translateY(-2px); box-shadow: 0 5px 10px rgba(226, 40, 34, 0.15); }
.combat-box input { text-align: center; font-size: 26px; font-weight: bold; font-family: 'Cinzel', serif; border: none; }

.hp-box { border: 2px solid var(--borde-suave); border-radius: 10px; padding: 15px; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.hp-current { text-align: center; font-size: 40px; border: none; font-weight: bold; font-family: 'Cinzel', serif; padding: 10px 0; color: var(--texto-oscuro); width: 100%; }

.attacks-box { border: 2px solid var(--borde-suave); border-radius: 10px; padding: 15px; background: white; }

/* CAJAS DE TEXTO GRANDES (IDEALES, DEFECTOS, ETC) */
.text-box { display: flex; flex-direction: column; flex: 1; }
.text-box textarea { flex: 1; min-height: 90px; }

/* =========================================================
   INVENTARIO Y MONEDERO PREMIUM
   ========================================================= */
.inventory-box { border: 2px solid var(--borde-suave); border-radius: 10px; padding: 15px; background: white; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.02);}

.monedero-container { display: flex; gap: 10px; margin-bottom: 20px; }
.coin-slot { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 5px; border-radius: 8px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.05); border: 2px solid transparent; }
.coin-slot.oro { background: linear-gradient(to bottom, #fef3c7, #fde68a); border-color: #fbbf24; }
.coin-slot.plata { background: linear-gradient(to bottom, #f3f4f6, #e5e7eb); border-color: #9ca3af; }
.coin-slot.cobre { background: linear-gradient(to bottom, #fff7ed, #ffedd5); border-color: #f59e0b; }
.coin-slot .coin-label { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
.coin-slot.oro .coin-label { color: #b45309; }
.coin-slot.plata .coin-label { color: #4b5563; }
.coin-slot.cobre .coin-label { color: #92400e; }
.coin-slot input { width: 80%; text-align: center; border: none; background: rgba(255, 255, 255, 0.6); font-size: 20px; font-weight: bold; color: #111827; border-radius: 6px; outline: none; padding: 6px 0; transition: all 0.2s; }
.coin-slot input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.1); }

.items-list { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: flex; align-items: center; gap: 5px; background: var(--fondo-gris); padding: 5px; border-radius: 5px; border: 1px solid var(--borde-suave);}
.item-name { flex: 2; font-size: 13px; font-weight: bold; border: none !important; background: transparent !important; color: var(--texto-oscuro); }
.item-qty { flex: 1; max-width: 45px; text-align: center; font-weight: bold; border: 1px solid #ccc !important; border-radius: 4px; background: white !important; }

/* Botones de acción en inventario */
.btn-usar { background: var(--rojo-dnd); color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-usar:hover { opacity: 0.8; }
.btn-eliminar { background: #ef4444; color: white; border: none; padding: 5px 8px; border-radius: 5px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-eliminar:hover { background: #991b1b; }

/* Creador de objetos */
.add-item-box { display: flex; gap: 5px; margin-bottom: 15px; flex-wrap: wrap; background: #e5e7eb; padding: 10px; border-radius: 8px; border: 1px dashed #9ca3af; }
.add-item-box input, .add-item-box select { padding: 5px; font-size: 12px; border: 1px solid #ccc !important; border-radius: 4px; background: white !important; }
.add-item-box button { background: #10b981; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-weight: bold; }
.add-item-box button:hover { background: #059669; }

/* =========================================================
   DISEÑO RESPONSIVO (MÓVILES Y TABLETS)
   ========================================================= */
@media (max-width: 1200px) { 
    .main-layout { flex-direction: column; } 
    .sidebar-log { position: static; width: 100%; max-width: 100%; height: 300px; margin-bottom: 20px;}
}
@media (max-width: 950px) { 
    .sheet { grid-template-columns: repeat(2, 1fr); } 
    .col:nth-child(4) { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } 
}
@media (max-width: 650px) { 
    .sheet { grid-template-columns: 1fr; padding: 15px; gap: 15px; } 
    .header { flex-direction: column; gap: 15px; } 
    .char-name input { font-size: 24px; } 
    .char-details { grid-template-columns: 1fr 1fr; } 
    .stat-container { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); float: none; margin-right: 0; margin-bottom: 15px; } 
    .col:nth-child(4) { grid-template-columns: 1fr; } 
    .prof-box { margin-bottom: 15px; } 
    .action-menu { position: relative; justify-content: center; margin-bottom: 15px; right: 0; top: 0;}
}

/* =========================================================
   BARRITAS DE SALVACIÓN / VIDAS (NUEVO)
   ========================================================= */
.vida-bar { 
    height: 12px; 
    background-color: #e5e7eb; /* Color Gris (Vida Perdida) */
    border-radius: 6px; 
    transition: all 0.3s ease; 
    border: 1px solid #9ca3af;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
/* Cuando la casilla está activada, la barra se pinta de rojo */
input[type="checkbox"]:checked + .vida-bar { 
    background-color: #ef4444; /* Color Rojo (Vida Activa) */
    border-color: #b91c1c;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.3), 0 0 5px rgba(239, 68, 68, 0.4);
}