@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Quicksand:wght@400;600;700&display=swap');

:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --accent: #fd79a8;
    --yellow: #ffeaa7;
    --text-color: #2d3436;
    --glass-bg: rgba(255, 255, 255, 0.92);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #2b1055, #7597de);
    color: var(--text-color);
    background-attachment: fixed;
}

/* Barra superior elegante */
.top-bar {
    width: 100%;
    background: rgba(15, 12, 41, 0.7);
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-greeting {
    font-weight: 700;
    color: var(--yellow);
    font-size: 1.05rem;
}

/* Tarjeta principal estilo Cristal/Fantasía */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), inset 0 0 2px rgba(255, 255, 255, 0.5);
    margin: 30px auto;
    max-width: 750px;
    width: 90%;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.welcome-card {
    text-align: center;
}

.welcome-card h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.8rem;
    color: #6c5ce7;
    margin-bottom: 5px;
    text-shadow: 2px 2px 0px #ffeaa7;
}

.subtitle {
    font-size: 1.1rem;
    color: #636e72;
    margin-bottom: 25px;
    font-weight: 600;
}

/* Opciones de Género para Niños */
.gender-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 15px 0;
}

.gender-btn {
    flex: 1;
    max-width: 160px;
    cursor: pointer;
}

.gender-btn input {
    display: none;
}

.gender-btn span {
    display: block;
    padding: 12px;
    background: #f1f2f6;
    border: 3px solid #dfe4ea;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    text-align: center;
}

.gender-btn input:checked + span {
    background: #ffeaa7;
    border-color: #fdcb6e;
    color: #d63031;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(253, 203, 110, 0.4);
}

/* Lector de Historia */
.story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.badge-page {
    background: linear-gradient(135deg, #ff7675, #d63031);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-family: 'Fredoka One', cursive;
    letter-spacing: 0.5px;
}

.story-text-content {
    font-size: 1.25rem;
    line-height: 1.9;
    color: #2d3436;
    white-space: pre-line;
    margin-bottom: 30px;
}

/* Botones de Decisión Mágicos */
.story-options-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.btn-option {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 16px 22px;
    border-radius: 16px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s ease;
    box-shadow: 0 6px 15px rgba(108, 92, 231, 0.3);
    display: flex;
    align-items: center;
}

.btn-option::before {
    content: '✨';
    margin-right: 12px;
    font-size: 1.2rem;
}

.btn-option:hover {
    transform: translateY(-3px) scale(1.01);
    background: linear-gradient(135deg, #5b4bc4, #8c7ae6);
    box-shadow: 0 10px 20px rgba(108, 92, 231, 0.4);
}

/* Botones Genéricos */
.btn-primary {
    background: linear-gradient(135deg, #00b894, #55efc4);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 15px rgba(0, 184, 148, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 184, 148, 0.4);
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.9rem;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
}

.btn-admin-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-admin-link:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Imagen ilustrativa */
.story-image-container {
    margin-bottom: 25px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.story-image-container img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    display: block;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2d3436;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dfe4ea;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: #6c5ce7;
}

/* Panel Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    max-width: 1250px;
    margin: 25px auto;
    width: 95%;
}

.sidebar-pages {
    margin: 0;
    padding: 20px;
}

.pages-list {
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.page-item {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.page-item:hover, .page-item.active {
    background: #6c5ce7;
    color: white;
}

.option-row {
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 12px;
    margin-bottom: 10px;
}