/* === ESTILOS GENERALES === */
body {
    background: url('../imagenes/background1.webp') no-repeat center center fixed;
    background-size: cover;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative; /* Añadido para contexto de posicionamiento */
}

/* === ESTRUCTURA PRINCIPAL === */
.main-content {
    margin-left: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: margin-left 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* === MENÚ LATERAL === */
.sidebar {
    width: 240px; /* Ancho del sidebar aumentado a 240px */
    height: 100vh;
    background: #2c3e50;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    position: fixed;
    left: -230px; /* Ajustado para que queden 10px visibles (240 - 10 = 230) */
    top: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    color: white;
    transition: left 0.3s ease;
    overflow: hidden; /* Asegura que el contenido que se desborda se corte */
}

.sidebar.active {
    left: 0;
}

/* Eliminar el ajuste para el main-content cuando el sidebar está activo */
/* .sidebar.active ~ .main-content {
    margin-left: 200px;
} */

.menu-activator {
    position: fixed;
    left: 0;
    top: 0;
    width: 30px;
    height: 100vh;
    z-index: 999;
}

/* === ESTILOS DEL MENÚ === */
.menu-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

.menu-header img {
    width: 60px;
    height: 60px;
    border-radius: 10%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.menu-title {
    font-weight: 600;
    font-size: 1.7rem;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.menu-container {
    flex-grow: 1;
    overflow-y: auto; /* Permite el scroll si el contenido es demasiado largo */
    padding: 10px 0;
}

.menu-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    user-select: none;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid #5bc0be;
}

.menu-item i {
    margin-right: 8px;
    font-size: 1.3rem;
    width: 18px;
    text-align: center;
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.submenu.show {
    max-height: 500px;
}

.submenu-item {
    padding: 8px 15px 8px 40px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.submenu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #5bc0be;
}

.menu-arrow {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.menu-item.active .menu-arrow {
    transform: rotate(90deg);
}

/* === ESTILOS DEL GENERADOR DE DADOS === */
.dice-roller-container {
    padding: 15px;
    margin: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    box-sizing: border-box; /* Asegura que padding y border se incluyan en el ancho */
    width: 100%; /* Ocupa el 100% del sidebar */
}

.dice-display {
    min-height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.3);
    color: #eee;
    font-size: 0.9em;
}

.dice-display .selected-die {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.dice-display .selected-die.modifier {
    background-color: rgba(91, 192, 190, 0.2);
}


/* Grid para los botones de los dados en 2 columnas */
.dice-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
    /* Nuevo max-width para aprovechar el ancho extra del sidebar */
    max-width: 210px; /* 240px (sidebar) - 30px (padding) = 210px */
    margin-left: auto;
    margin-right: auto;
}

.dice-button {
    background: #5bc0be;
    border: none;
    border-radius: 4px;
    color: #2c3e50;
    font-weight: bold;
    padding: 6px 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 0.9em;
    width: 85%;
}

.dice-button:hover {
    background: #46a2a0;
    transform: translateY(-1px);
}

.dice-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dice-actions .btn-magia {
    padding: 8px 15px;
    font-size: 0.9em;
}

.dice-results {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.4);
    color: #eee;
    font-size: 1em;
    text-align: left;
}

.dice-results p {
    margin-bottom: 5px;
}

.dice-results p:last-child {
    margin-bottom: 0;
}


/* === ESTILOS DE CONTENIDO === */
.seccion-activa {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

/* === ESTILOS UNIFICADOS PARA LA VARITA DE LOS DESEOS === */
.varita-layout-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: 1500px;
    margin: 0 auto;
    gap: 15px;
    padding: 0 20px;
}

.varita-content-container {
    flex: 1;
    min-width: 300px;
    max-width: 1000px;
    margin-right: -50px;
}

.varita-container {
    background-color: rgba(42, 33, 61, 0.6);
    padding: 20px;
    margin-top: 1%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: #f0e6ff;
    backdrop-filter: blur(5px);
    border: 1px solid #6a0dad;
    width: calc(100% + 50px);
}

.eurmal-image-container {
    flex: 0 0 400px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding-top: 0px;
    margin-left: -30px;
}

.eurmal-image {
    max-width: 100%;
    height: auto;
    max-height: 550px;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(106, 13, 173, 0.5));
    transition: transform 0.3s ease;
}

.eurmal-image:hover {
    transform: scale(1.03);
}

.explicacion-varita {
    text-align: center;
    margin-bottom: 0px;
    line-height: 1.7;
    font-size: 1.2rem;
    color: #d9c7ff;
    padding: 0 20px;
}

.controles {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.btn-magia {
    margin-top: 5px;
    margin-right: 10px;
    padding: 8px 10px;
    background: #d69e2e;
    border: none;
    border-radius: 4px;
    color: #1a202c;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
    display: inline-block;
    width: auto;
}

.btn-magia:hover {
    background: #b7791f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#input-valor {
    padding: 15px;
    width: 120px;
    text-align: center;
    border: 2px solid #6a0dad;
    border-radius: 8px;
    font-size: 1.1rem;
    background-color: rgba(205, 205, 205, 0.9);
}

.resultados-container {
    margin-top: 0px;
    display: none;
    width: 100%;
}

.resultado-box {
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    min-height: auto;
}

.resultado-header {
    font-size: 1rem;
    margin-bottom: 10px;
    color: inherit;
}

.resultado-principal .resultado-header {
    color: white;
}

.resultado-valor {
    display: none !important;
}

.resultado-principal .resultado-valor {
    color: white;
}

.resultado-efecto {
    line-height: 1.6;
    font-size: 1.05rem;
    margin: 0;
    padding: 0;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    .varita-content-container {
        margin-right: 0;
        width: 100%;
    }
    
    .eurmal-image-container {
        margin-left: 0;
    }
}

@media (max-width: 900px) {
    .varita-layout-container {
        flex-direction: column;
    }
    
    .varita-container {
        width: 100%;
    }
    
    .eurmal-image-container {
        order: -1;
        margin-bottom: 30px;
        justify-content: center;
    }
    
    .eurmal-image {
        max-height: 350px;
    }
    
    .btn-magia {
        width: 100%;
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .sidebar.active ~ .main-content {
        margin-left: 0;
    }
    
    .explicacion-varita {
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .btn-magia {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .varita-layout-container {
        padding: 0 10px;
    }
    
    .varita-content-container {
        min-width: 100%;
    }
    
    .resultado-box {
        padding: 12px 15px;
    }
}

.menu-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    padding: 15px;
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
}

/* Estilos específicos para botones de armaduras */
.btn-armadura {
    background-color: #2d3748;
    color: #d69e2e;
    border: 1px solid #d69e2e;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.btn-armadura:hover {
    background-color: #3c4a5f;
    transform: translateY(-2px);
}

.btn-armadura-activo {
    background-color: #d69e2e;
    color: #2d3748;
    font-weight: bold;
}

.botones-armadura-container {
    margin-bottom: 15px;
}
.fila-botones {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}