/* --- RESET & GLOBAL --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { width: 100%; overflow-x: hidden; -ms-overflow-style: none; scrollbar-width: none; scroll-behavior: smooth; }
*::-webkit-scrollbar { display: none; }

body { font-family: 'Open Sans', sans-serif; color: #333; line-height: 1.6; background: #000; }
h1, h2, h3, h4 { font-family: 'Montserrat', sans-serif; font-weight: 800; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; transition: 0.3s; }

.container { width: 90%; max-width: 1200px; margin: 0 auto; position: relative; z-index: 20; }

:root {
    --purple-main: #BE29A2;
    --dark-bg: #26243A;
    --pink-hot: #EE10C6;
    --blue-deep: #3023B0;
    --white: #ffffff;
    --cyan-guide: #00e676;
}

/* --- NAV --- */
.navbar { padding: 15px 0; background: var(--white); box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: relative; z-index: 100; }
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo { height: 50px; width: auto; object-fit: contain; }
.social-top a { margin-left: 20px; font-size: 0.9rem; font-weight: 600; color: #333; }
.social-top i { color: var(--pink-hot); margin-right: 5px; }
.social-top a:hover { color: var(--purple-main); }

/* --- ARQUITECTURA MAESTRA --- */
.ratio-section {
    position: relative;
    width: 100%;
    /* Por defecto, la altura la da la imagen maestra */
    height: auto; 
    overflow: hidden;
    background-color: var(--dark-bg);
    display: block; 
}

/* MODIFICADOR: MODO CONTENIDO (Cuando Contacto no tiene fondo) */
.ratio-section.content-mode {
    height: auto !important;
    min-height: auto !important;
    padding: 100px 0; /* Aire arriba y abajo */
    display: flex;
    flex-direction: column;
    justify-content: center;
}
/* En modo contenido, ocultamos la imagen fantasma para que no empuje */
.ratio-section.content-mode .master-bg { display: none; }
/* Y hacemos que el overlay sea relativo para que ocupe espacio real */
.ratio-section.content-mode .overlay-content { position: relative; height: auto; }
.ratio-section.content-mode .text-layer { position: relative; height: auto; padding: 20px; }


/* 1. IMAGEN MAESTRA (FONDO) */
.master-bg {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
    z-index: 1;
    pointer-events: none;
    object-fit: contain; /* VER COMPLETA SIEMPRE */
}
.ghost { opacity: 0; visibility: hidden; }

/* 2. CAPA DE CONTENIDO (OVERLAY) */
.overlay-content {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
}

/* 3. ELEMENTOS FLOTANTES (PERSONAJES Y CAJAS DE TEXTO) */
.layer-figure, .contact-image, .layer-text-box {
    position: absolute;
    z-index: 10;
    touch-action: none; 
    user-select: none;
    transform-origin: center center;
    /* Coordenadas via PHP */
}

/* Personajes */
.layer-figure img, .contact-image img {
    width: 100%; height: 100%; 
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(0,0,0,0.5));
    pointer-events: none;
}

/* --- TEXTOS INTELIGENTES (CONTAINER QUERIES) --- */
/* La magia: El texto crece si la caja crece */
.layer-text-box {
    z-index: 30 !important; /* Capa superior */
    display: flex;
    flex-direction: column;
    justify-content: center;
    
    /* Activar Container Queries */
    container-type: inline-size;
    container-name: text-box;
}

.layer-text-box a, .layer-text-box button, .layer-text-box input, .layer-text-box textarea { 
    pointer-events: auto; 
}

/* Estilos internos usando unidades CQI (Container Query Inline) */
/* 1cqi = 1% del ancho de la caja de texto */

.hero-content { text-align: left; width: 100%; color: var(--white); }
.hero-content h1 { 
    font-size: 10cqi; /* Tamaño proporcional a la caja */
    line-height: 1.1; margin-bottom: 2cqi; 
    text-shadow: 0px 4px 15px rgba(0,0,0,0.6); 
}
.hero-content h4 { font-size: 4cqi; text-transform: uppercase; margin-bottom: 2cqi; letter-spacing: 1px; }
.hero-content p { font-size: 3.5cqi; font-weight: 600; text-shadow: 0px 2px 5px rgba(0,0,0,0.8); }

.about-box {
    background: rgba(190, 41, 162, 0.25); border: 1px solid rgba(255,255,255,0.3);
    padding: 5cqi; backdrop-filter: blur(8px);
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    color: var(--white); text-align: left; width: 100%;
}
.about-box h2 { font-size: 8cqi; margin-bottom: 3cqi; text-transform: uppercase; }
.about-box p { font-size: 3.5cqi; }

/* CONTACTO */
.contact-container { 
    width: 100%;
    color: var(--white); 
    text-align: left; pointer-events: auto;
    /* En contact, si no hay fondo, los textos deben tener un tamaño base legible */
    container-type: inline-size;
}
.contact-title { font-size: 8cqi; text-transform: uppercase; margin-bottom: 2cqi; }
.contact-container p { font-size: 3.5cqi; margin-bottom: 4cqi; }

.form-box { display: flex; flex-direction: column; width: 100%; }
.form-box label { font-size: 3cqi; margin-top: 2cqi; margin-bottom: 1cqi; color: var(--pink-hot); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.form-box input, .form-box textarea { 
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2); 
    padding: 3cqi; color: var(--white); font-family: inherit; font-size: 3.5cqi; border-radius: 8px; width: 100%; transition: 0.3s; 
}
.form-box input:focus, .form-box textarea:focus { border-color: var(--pink-hot); outline: none; background: rgba(0, 0, 0, 0.6); box-shadow: 0 0 15px rgba(238, 16, 198, 0.3); }
.btn-submit { background-color: var(--pink-hot); color: white; border: none; padding: 3cqi; margin-top: 4cqi; font-weight: 800; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; border-radius: 4px; width: 100%; font-size: 3.5cqi; }
.input-trap { opacity: 0; position: absolute; z-index: -1; height:0; width:0; overflow:hidden; }

/* SECCIONES ESTÁTICAS */
.features { padding: 80px 0; background: var(--white); z-index: 20; position: relative; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 50px; }
.feature-item { padding: 10px; text-align: center; }
.icon-pink { font-size: 2.5rem; color: var(--pink-hot); margin-bottom: 25px; border: 3px solid var(--pink-hot); padding: 20px; border-radius: 12px; display: inline-block; }
.feature-item h3 { font-size: 1.1rem; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 0.5px; }
.feature-item p { font-size: 0.95rem; color: #666; line-height: 1.5; }

.instagram-feed { padding: 60px 0; background: #f9f9f9; z-index: 20; position: relative; text-align: center; }
.section-title { color: var(--blue-deep); font-size: 2.2rem; margin-bottom: 5px; }
.widget-wrapper { margin-bottom: 50px; min-height: 400px; }
.promo-separator { display: flex; justify-content: center; width: 100%; }
.promo-block { background: linear-gradient(135deg, var(--purple-main), var(--blue-deep)); color: white; padding: 40px; border-radius: 15px; margin: 30px auto; max-width: 700px; }
.promo-block a { color: white; text-decoration: underline; font-weight: bold; display: block; margin-top: 10px; }

/* FOOTER */
footer { background: var(--white); padding: 30px 0; text-align: center; color: #666; font-size: 0.85rem; z-index: 20; position: relative; }
.footer-content { display: flex; justify-content: space-between; align-items: center; }
.social-footer a { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; color: #666; }
.social-footer img { width: 24px !important; height: 24px !important; object-fit: contain; margin: 0; }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(38, 36, 58, 0.95); display: none; justify-content: center; align-items: center; z-index: 99999; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background: var(--white); padding: 40px; border-radius: 15px; text-align: center; max-width: 400px; border: 2px solid var(--purple-main); }
.btn-close-modal { background: var(--blue-deep); color: white; border: none; padding: 10px 30px; font-weight: bold; cursor: pointer; border-radius: 20px; margin-top: 20px; }

/* --- ADMIN UI --- */
.admin-sidebar { position: fixed; top: 0; left: 0; width: 320px; height: 100%; background: #222; color: #fff; padding: 20px; overflow-y: auto; z-index: 100000; box-shadow: 5px 0 15px rgba(0,0,0,0.5); border-right: 1px solid #333; }
.admin-logo { display: block; width: 70%; margin: 0 auto 20px auto; }
.edit-group { margin-bottom: 15px; background: #2c2c2c; padding: 10px; border-radius: 6px; }
.edit-group label { display: block; font-size: 0.75rem; color: #aaa; text-transform: uppercase; margin-bottom: 5px; }
.edit-group input[type="text"], .edit-group textarea { width: 100%; padding: 8px; background: #111; border: 1px solid #444; color: white; border-radius: 4px; }
.custom-file-label { background: var(--blue-deep); color: white; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.7rem; font-weight: bold; display: inline-block; }
.btn-delete-img { background: #ff3333; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; float: right; font-weight: bold; }
.btn-save-sb { background: var(--pink-hot); color: white; padding: 10px; width: 100%; border: none; cursor: pointer; font-weight: bold; margin-bottom: 10px; border-radius: 4px; }
.btn-reset { background: #444; color: white; padding: 10px; width: 100%; border: none; cursor: pointer; font-weight: bold; margin-bottom: 10px; border-radius: 4px; }
.btn-logout { display: block; text-align: center; border: 1px solid var(--pink-hot); color: var(--pink-hot); padding: 10px; margin-bottom: 20px; text-decoration: none; border-radius: 4px; font-weight: bold; }

/* Switch Style */
.mode-switch-container { position: fixed; top: 10px; right: 20px; z-index: 100001; background: rgba(38, 36, 58, 0.9); padding: 10px 20px; border-radius: 30px; border: 1px solid var(--purple-main); display: flex; align-items: center; gap: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); backdrop-filter: blur(5px); }
.mode-switch-label { color: var(--white); font-weight: 800; font-size: 0.8rem; letter-spacing: 1px; }
.switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--dark-bg); transition: .4s; border-radius: 34px; border: 1px solid var(--blue-deep); }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 3px; background-color: var(--white); transition: .4s; border-radius: 50%; box-shadow: 0 0 5px rgba(255,255,255,0.5); }
input:checked + .slider { background-color: var(--pink-hot); border-color: var(--pink-hot); }
input:checked + .slider:before { transform: translateX(24px); }

/* ADMIN PREVIEW */
.admin-view { padding: 50px 0; background: #ddd; min-height: 100vh; transition: 0.3s; margin-left: 320px; }
.admin-view .ratio-section { margin-bottom: 50px; border: 3px dashed var(--cyan-guide); box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
/* Borde para editar */
.admin-view .draggable-item { 
    pointer-events: auto !important; cursor: move; border: 1px dashed rgba(255,255,255,0.5); 
    background: rgba(0, 230, 118, 0.1); 
}
.admin-view .draggable-item:hover { border: 2px solid var(--cyan-guide); }

/* MOBILE MODE SIMULATOR (Admin) */
.admin-view.mobile-mode-active { background: #111; display: flex; flex-direction: column; align-items: center; }
.admin-view.mobile-mode-active .ratio-section {
    width: 375px !important; 
    border: 10px solid #333; border-radius: 30px; margin: 30px 0;
}

/* RESPONSIVE MEDIA QUERY */
@media (max-width: 768px), .mobile-mode-active {
    .nav-container { flex-direction: column; gap: 15px; }
    /* Mobile: La altura es automática por defecto */
    .ratio-section { height: auto; }
    
    .footer-content { flex-direction: column; gap: 15px; text-align: center; }
}