/* ================= RESET & BASE ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    color: #000;
    overflow-x: hidden;
}

ul { list-style: none; }
a { text-decoration: none; color: inherit; }

/* Tipografía Base */
h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.02em; margin-bottom: 0.2rem; }
.brand-block p { font-size: 0.85rem; color: #888; font-weight: 300; }
h2 { font-size: 2rem; font-weight: 400; letter-spacing: 0.05em; }
.copyright { font-size: 0.7rem; color: #aaa; margin-top: auto; }

/* ================= HEADER FIJO (MÓVIL) ================= */
.site-header {
    position: fixed; top: 0; left: 0; width: 100%; height: 85px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem; z-index: 1000; background-color: #fff; border-bottom: solid #000 1px;
}

/* ================= BOTÓN HAMBURGUESA ================= */
.menu-toggle-btn {
    background: none; border: none; cursor: pointer;
    padding: 0 5px; z-index: 1001;
    display: flex; align-items: center; justify-content: center;
}
.hamburger-box { width: 24px; height: 18px; position: relative; }
.burger-line {
    display: block; width: 100%; height: 2px;
    background-color: #000; position: absolute; left: 0;
    transition: all 0.3s ease-in-out;
}
.burger-line.top { top: 0; }
.burger-line.middle { top: 8px; opacity: 1; }
.burger-line.bottom { top: 16px; }

/* Animación a 'X' */
.menu-toggle-btn.active .burger-line.top { top: 8px; transform: rotate(45deg); }
.menu-toggle-btn.active .burger-line.middle { opacity: 0; transform: translateX(-10px); }
.menu-toggle-btn.active .burger-line.bottom { top: 8px; transform: rotate(-45deg); }

/* ================= MENÚ OVERLAY (Móvil) ================= */
.mobile-overlay-menu {
    position: fixed; top: 85px; left: 0; width: 100%; height: calc(100vh - 85px);
    background-color: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 900; padding: 2rem;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s;
}
.mobile-overlay-menu.active { opacity: 1; visibility: visible; }
.overlay-nav-links { width: 100%; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.overlay-nav-links ul { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.nav-title { color: #fff; font-size: 1.3rem; font-weight: 500; margin-bottom: 0.5rem; }
.submenu-mobile { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; margin-bottom: 1rem; }
.nav-sublink { color: #ddd; font-size: 1.2rem; font-style: italic; font-weight: 300; position: relative; }
.nav-section { color: #fff; font-size: 1.3rem; font-weight: 400; position: relative; }
.mobile-copy { color: #666; font-weight: 300; margin-bottom: 1rem; }

/* ================= SIDEBAR ESCRITORIO ================= */
.desktop-sidebar { display: none; } /* Oculto en móvil */

.nav-dash { font-weight: 700; font-size: 1.5rem; margin: 2.5rem 0; display: block; }
.sidebar-nav .nav-title { color: #000; display: block; font-weight: 600; font-size: 1.1rem; margin-bottom: 1.5rem; }
.submenu-desktop { padding-left: 1.2rem; display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 4rem; gap: 0; }
.sidebar-nav .nav-sublink { font-size: 1rem; color: #333; margin-bottom: 1.2rem; font-style: italic; display: inline-block; position: relative; }
.sidebar-nav .nav-section { color: #000; font-size: 1.1rem; display: inline-block; font-weight: 600; margin-bottom: 2rem; position: relative; }

/* Subrayado animado */
.nav-sublink::after, .nav-section::after {
    content: ''; position: absolute; width: 0%; height: 1px; bottom: -2px; left: 0; 
    background-color: currentColor; transition: width 0.3s ease-in-out;
}
.nav-sublink:hover::after, .nav-section:hover::after, .active-link::after { width: 100% !important; }


/* ================= VISTA HOME (.main-container) ================= */
.image-section {
    height: 100vh; width: 100%;
    background-image: url('assets/home.jpg');
    background-size: cover; background-position: center;
    position: relative; padding-top: 85px;
}
.mobile-image-content { margin-top: 3rem; padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: flex-end; }
.text-group { max-width: 60%; }
.mobile-image-content h2 { font-size: 1.5rem; }
.mobile-image-content p { font-style: italic; margin-bottom: 0; font-size: 0.9rem; color:#818181 }

.btn {
    display: inline-block; padding: 0.7rem 1.2rem; font-size: 1rem; letter-spacing: 0.1em;
    border: 1px solid transparent; transition: all 0.3s; margin-bottom: 5px;
}
.btn-dark { background: #000; color: #fff; }
.btn-light { background: #fff; color: #000; }
.desktop-hover-content { display: none; }


/* ================= VISTA PROYECTO (Móvil First) ================= */
.project-layout-container { 
    display: flex; flex-direction: column; 
    padding-top: 85px; min-height: 100vh;
}
.project-sidebar { display: none; }

/* Contenedor Flex para ordenar Info vs Galería */
.content-split-wrapper { display: flex; flex-direction: column; }

/* ORDEN MÓVIL */
.project-info-col { order: 1; padding: 2rem 1.5rem; background: #fff; }
.project-gallery-col { order: 2; display: flex; flex-direction: column; gap: 5px; }

.gallery-img { width: 100%; height: auto; display: block; cursor: pointer; }

.project-title { font-size: 1.8rem; font-weight: 600; margin-bottom: 0.3rem; text-transform: uppercase; }
.project-date { font-size: 0.95rem; color: #666; font-style: italic; margin-bottom: 1.5rem; }
.project-description p { font-size: 1rem; line-height: 1.6; color: #333; font-weight: 300; margin-bottom: 1rem; }

/* Botón Volver Arriba */
.gallery-footer-actions { width: 100%; display: flex; justify-content: center; padding: 6rem 0 4rem 0; background: #fff; }
.btn-outline-black { background: #fff; color: #000; border: 1px solid #000; padding: 0.8rem 1.5rem; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.1em; cursor: pointer; transition: all 0.3s; }
.btn-outline-black:hover { background: #000; color: #fff; }

/* FOOTER INTERNO (ESTILO BASE / MÓVIL) */
.project-internal-footer { 
    background: #000; color: #fff; 
    padding: 3rem 1.5rem; 
    text-align: left; 
    margin-top: auto; width: 100%; 
}
.project-internal-footer .footer-top-row {
    display: flex; flex-direction: column; gap: 2rem; margin-bottom: 2rem;
}
.project-internal-footer .mf-brand h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.2rem; color: #fff; }
.project-internal-footer .mf-brand p { font-size: 0.8rem; color: #888; font-weight: 300; margin: 0; }
.project-internal-footer .mf-links { display: flex; gap: 2rem; }
.project-internal-footer .mf-links a { font-size: 0.9rem; text-decoration: underline; font-weight: 300; color: #fff; }
.project-internal-footer .mf-separator { width: 100%; height: 1px; background: #333; margin-bottom: 1.5rem; }
.project-internal-footer .mf-copy { font-size: 0.7rem; color: #666; }


/* ================= VISTA CONTACTO ================= */
/* Columna Formulario */
.contact-form-col { 
    order: 1; /* Móvil: Primero */
    padding: 2rem 1.5rem; 
    background: #fff; 
    display: flex; flex-direction: column;
}

.contact-wrapper { width: 100%; }
.contact-heading { font-size: 2rem; font-weight: 400; margin-bottom: 2rem; letter-spacing: 0.05em; text-transform: uppercase; }

.contact-info-list { margin-bottom: 3rem; }
.info-item { display: flex; align-items: center; gap: 15px; margin-bottom: 1rem; color: #666; font-size: 0.95rem; font-weight: 300; }

/* ICONOS PERSONALIZADOS (SVG) */
.info-item img.contact-icon { 
    width: 20px; 
    height: auto; 
    display: block; 
}

.info-item a:hover { text-decoration: underline; color: #000; }

.contact-form { max-width: 500px; display: flex; flex-direction: column; gap: 2rem; }
.form-group-line, .form-group-box { display: flex; flex-direction: column; }
.form-group-line label, .form-group-box label { font-size: 0.75rem; color: #888; text-transform: uppercase; margin-bottom: 5px; letter-spacing: 0.05em; }

/* CAMBIO DE COLOR DE BORDES: #818181 */
.form-group-line input { 
    border: none; 
    border-bottom: 1px solid #818181; /* Borde inferior actualizado */
    padding: 8px 0; 
    font-family: 'Inter', sans-serif; 
    font-size: 1rem; 
    outline: none; 
    transition: border-color 0.3s; 
}
.form-group-line input:focus { border-bottom-color: #000; }

.form-group-box textarea { 
    border: 1px solid #818181; /* Borde caja actualizado */
    padding: 10px; 
    min-height: 150px; 
    resize: vertical; 
    font-family: 'Inter', sans-serif; 
    font-size: 1rem; 
    outline: none; 
    transition: border-color 0.3s; 
}
.form-group-box textarea:focus { border-color: #000; }

.btn-submit { align-self: flex-start; background: #fff; border: 1px solid #000; color: #000; padding: 10px 30px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.3s; }
.btn-submit:hover { background: #000; color: #fff; }

/* Columna Imagen */
.contact-image-col {
    order: 2; /* Móvil: Segundo */
    padding: 0; /* SIN PADDING EN MÓVIL */
}
.contact-image-col img {
    width: 100%;
    height: auto;
    display: block;
    /* Sin padding específico en móvil */
}


/* ================= VISTA INFO ================= */
.info-bio-col { order: 1; padding: 0; }
.bio-image-wrapper img { width: 100%; height: auto; display: block; margin-bottom: 2rem; }
.bio-title { font-size: 2rem; font-weight: bold; margin-bottom: 0.2rem; }
.bio-subtitle { font-size: 0.9rem; font-style: italic; color: #666; margin-bottom: 2rem; }
.bio-label { display: block; font-size: 0.9rem; margin-bottom: 1rem; text-transform: uppercase; }
.bio-content p { font-size: 0.9rem; line-height: 1.6; margin-bottom: 1rem; color: #333; font-weight: 300; }
.bio-content .bold{ font-size: 1rem; line-height: 1.6; margin-bottom: 1rem; color: #333; font-weight: bold; }
.bio-text-wrapper { padding: 0 2rem;} 

.info-cv-col { order: 2; padding: 2rem 1.5rem; }
.cv-section { margin-bottom: 3rem; }
.cv-heading { font-size: 0.9rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1.5rem; }
.cv-item { margin-bottom: 1.5rem; }
.cv-item-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem; }
.cv-date { font-weight: 300; font-style: italic; color: #666; font-size: 0.9rem; margin-left: 5px; }
.cv-item-desc { font-size: 0.9rem; color: #666; font-weight: 300; }
.cv-divider { border: 0; border-top: 1px solid #000; margin-top: 2rem; width: 100%; }


/* ================= VISTA EXPOSICIONES ================= */
.exposiciones-text-col { order: 1; padding: 2rem 1.5rem; background: #fff; }
.exposiciones-title { font-size: 2rem; font-weight: bold; margin-bottom: 2rem; letter-spacing: 0.05em; text-transform: uppercase; }
.expo-item { margin-bottom: 2rem; }
.expo-name { font-weight: 600; font-size: 1rem; color: #000; margin-bottom: 0.2rem; }
.expo-year { font-weight: 300; color: #666; font-style: italic; font-size: 0.95rem; margin-left: 5px; }
.expo-place { font-size: 0.95rem; color: #444; font-weight: 300; }
.exposiciones-gallery-col { order: 2; display: flex; flex-direction: column; gap: 0.25rem; padding: 0; }
.loader-text { color: #999; font-style: italic; text-align: center; margin-top: 2rem; }

.exposiciones-gallery-col img {
    width: 100%; height: auto; display: block; cursor: pointer;
    padding-bottom: 8px; margin-bottom: 0; 
}


/* ================= LIGHTBOX ================= */
.lightbox-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(20, 20, 20, 0.95); backdrop-filter: blur(20px);
    z-index: 2000; display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s;
}
.lightbox-modal.active { opacity: 1; visibility: visible; }
.lightbox-image-container { width: 90%; height: 85%; display: flex; justify-content: center; align-items: center; }
.lightbox-image-container img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close-btn, .nav-btn { position: absolute; background: none; border: none; color: #fff; cursor: pointer; z-index: 2010; }
.lightbox-close-btn { 
    top: 2rem; right: 2rem; width: auto; height: 30px;
    background-image: url('assets/close.svg');
    background-size: 20px; background-repeat: no-repeat; background-position: right center;
    color: #fff; font-size: 1.1rem; padding-right: 30px; display: flex; align-items: center;
}
.nav-btn { 
    top: auto; bottom: 10%; width: 30px; height: 30px;
    background-image: url('assets/arrow.svg');
    background-size: contain; background-repeat: no-repeat; background-position: center;
    color: transparent; font-size: 0; padding: 0px; margin: 35px 35px 0 35px;
}
.prev-btn { left: 1.5rem; transform: scaleX(-1); }
.next-btn { right: 1.5rem; }



/* ==========================================================================
   MEDIA QUERY ESCRITORIO (> 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
    .site-header, .mobile-overlay-menu, .mobile-image-content { display: none !important; }
    
    body { height: 100vh; overflow: hidden; }
    .main-container { display: flex; height: 100vh; overflow: hidden; }
    .desktop-sidebar {
        display: flex; flex-direction: column; justify-content: space-between;
        width: 30%; height: 100vh; background: #fff; padding: 4rem 3rem; border-right: 1px solid #000000;
        position: fixed; top: 0; left: 0; z-index: 10;
    }
    .image-section { width: 70%; margin-left: 30%; height: 100vh; padding-top: 0; }
    
    .desktop-hover-content {
        display: flex; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        background-color: rgba(0, 0, 0, 0.4); backdrop-filter: blur(0px); opacity: 0; transition: all 0.5s ease;
        justify-content: center; align-items: center; text-align: center; color: #fff;
    }
    .hover-text-center { transform: translateY(20px); transition: all 0.5s ease; }
    .hover-text-center a { margin-top:32px; padding: 16;}
    .hover-text-center P { font-style: italic; color: #C1C1C1; margin-top: 6px;}
    .image-section:hover .desktop-hover-content { opacity: 1; backdrop-filter: blur(15px); }
    .image-section:hover .hover-text-center { transform: translateY(0); }

    /* LAYOUT PROYECTO */
    .project-layout-container {
        margin-left: 30%; width: 70%;
        height: 100vh;
        overflow: hidden; padding-top: 0 !important;
        display: block; 
    }
    .project-sidebar.desktop-sidebar { width: 30%; }

    /* Contenedor derecho que hace Scroll (70%) */
    .right-scroll-container {
        width: 100%; height: 100vh;
        overflow-y: auto; display: flex; flex-direction: column;
    }

    /* Grid Interno: Galería + Info */
    .content-split-wrapper {
        display: flex; flex-direction: row; 
        width: 100%; flex-grow: 1;
        border-bottom: 1px solid #000; 
    }

    /* Galería (Centro) - Orden 1 (Izquierda) */
    .project-gallery-col {
        width: 50%; order: 1; 
        padding: 0; display: flex; flex-direction: column; gap: 5px;
    }
    .project-gallery-col img { width: 100%; display: block; }

    /* Info (Derecha) - Orden 2 (Derecha) */
    .project-info-col.sticky-col {
        width: 50%; order: 2; 
        border-left: 1px solid #000; padding: 3rem;
        position: sticky; top: 0; align-self: flex-start;
        height: auto; min-height: 100vh;
        display: flex; flex-direction: column; justify-content: flex-start;
    }
    .project-title { font-size: 2.2rem; }

    /* Footer Proyecto */
    .project-internal-footer { padding: 4rem 3rem; width: 100%; flex-shrink: 0; }
    .project-internal-footer .footer-top-row {
        flex-direction: row; justify-content: space-between; align-items: flex-end;
    }


    /* === CONTACTO (Adaptado) === */
    .contact-form-col.sticky-col {
        width: 50%;
        position: sticky; top: 0; align-self: flex-start;
        height: auto; min-height: 100vh;
        padding: 4rem 3rem; 
        border-right: 1px solid #000;
        display: flex; flex-direction: column; 
        justify-content: flex-start; 
    }
    
    .contact-image-col {
        width: 50%;
        padding: 8px; 
        overflow: hidden; 
    }
    .contact-image-col img {
        width: 100%; height: 100%; object-fit: cover;
    }


    /* === INFO === */
    .info-page-body .project-layout-container {
        margin-left: 30%; width: 70%; padding-top: 0;
        display: block; 
    }
    .info-bio-col.middle-col-desktop {
        width: 50%;
        position: sticky; top: 0; align-self: flex-start; 
        height: 100vh; 
        padding: 0;
        border-right: 1px solid #000;
        overflow: hidden; 
        display: flex; flex-direction: column;
    }
    .info-bio-col.middle-col-desktop .bio-text-wrapper {
        flex: 0 0 auto; padding: 2rem 3rem; order: 2; background: #fff; z-index: 10;
    }
    .info-bio-col.middle-col-desktop .bio-image-wrapper {
        flex: 1 1 auto; width: 100%; position: relative; overflow: hidden; order: 1; margin: 0; 
    }
    .info-bio-col.middle-col-desktop .bio-image-wrapper img {
        position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        object-fit: cover; object-position: center; margin: 0;
    }
    .info-cv-col.scrolling-col {
        width: 50%; height: auto; padding: 3rem; overflow: visible; 
    }


    /* === EXPOSICIONES === */
    .exposiciones-text-col.sticky-col {
        width: 50%;
        position: sticky; top: 0; align-self: flex-start;
        height: auto; min-height: 100vh;
        border-right: 1px solid #000; padding: 4rem 3rem; 
        display: flex; flex-direction: column;
    }
    .exposiciones-gallery-col.scrolling-col {
        width: 50%; height: auto;
        padding: 0; 
        overflow: visible; 
        display: flex; flex-direction: column; gap: 0; 
    }
    
    .exposiciones-gallery-col img {
        width: 100%; 
        height: auto; 
        display: block; 
        vertical-align: bottom;
        margin-bottom: 0;
        padding: 8px; 
    }

    /* === LIGHTBOX DESKTOP (FLECHAS CENTRADAS) === */
    .nav-btn { 
        top: 50%;          
        bottom: auto;      
        width: 60px; 
        height: 60px; 
        transform: translateY(-50%); 
        margin: 0;         
    }
    .prev-btn { 
        transform: translateY(-50%) scaleX(-1); 
    }
    .mobile-contact-image, .mobile-footer-black { display: none; }
}


/* ==========================================================================
   ESTILOS PANEL DE ADMINISTRACIÓN (ADMIN) - VERSIÓN COMPLETA
   ========================================================================== */

/* --- 1. LAYOUT GENERAL & BASE (ESCRITORIO) --- */

/* Cuerpo y Contenedor Principal */
body.admin-body { 
    background: #f4f4f4; 
    overflow: hidden; /* Bloqueamos scroll en escritorio (el scroll lo tiene el main) */
}

.admin-container { 
    display: grid; 
    grid-template-columns: 250px 1fr; /* Sidebar fijo 250px | Resto contenido */
    height: 100vh; 
}

/* Sidebar (Barra Lateral) */
.admin-sidebar { 
    background: #fff; 
    border-right: 1px solid #ddd; 
    display: flex; 
    flex-direction: column; 
    padding: 1.5rem; 
    height: 100vh; 
    overflow-y: auto; 
    z-index: 20;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

/* Cabecera del Sidebar */
.admin-header { 
    padding-bottom: 1.5rem; 
    border-bottom: 1px solid #eee; 
    margin-bottom: 1.5rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}
.admin-header h2 { font-size: 1.1rem; margin-bottom: 0.2rem; color: #000; text-transform: uppercase; }
.admin-header p { font-size: 0.8rem; color: #888; margin: 0; }

/* Botón Hamburguesa (Oculto en escritorio por defecto) */
.admin-mobile-toggle { display: none; }

/* Navegación Principal */
.nav-main { margin-bottom: 2rem; display: flex; flex-direction: column; gap: 5px; }

.nav-item { 
    padding: 12px 15px; 
    cursor: pointer; 
    border-radius: 6px; 
    font-weight: 500; 
    color: #555;
    display: flex; align-items: center; gap: 12px;
    transition: all 0.2s;
}
.nav-item i { width: 20px; text-align: center; }
.nav-item:hover { background: #f0f0f0; color: #000; }
.nav-item.active { background: #000; color: #fff; }

/* Sublista de Proyectos */
.project-list { 
    list-style: none; 
    margin: 5px 0 15px 32px; 
    padding-left: 10px; 
    border-left: 2px solid #eee; 
}
.sub-item { 
    padding: 8px 10px; 
    cursor: pointer; 
    border-radius: 4px; 
    margin-bottom: 2px; 
    font-size: 0.9rem; 
    color: #666;
    display: block;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}
.sub-item:hover { background: #f9f9f9; color: #000; }
.sub-item.active { color: #000; font-weight: 600; background: #eef; border-left: 2px solid #000; margin-left: -12px; padding-left: 10px; }

/* Botones del Sidebar */
.sidebar-actions { margin-top: 1rem; }
.btn-sidebar-action {
    width: 100%; padding: 10px; background: #fff; border: 1px dashed #999;
    color: #555; border-radius: 6px; cursor: pointer; font-size: 0.9rem;
    transition: all 0.2s; text-align: center;
}
.btn-sidebar-action:hover { border-color: #000; color: #000; background: #fafafa; }

/* --- 2. ÁREA PRINCIPAL & EDITOR --- */

.admin-main { 
    padding: 2rem; 
    overflow-y: auto; 
    background: #fafafa; 
    height: 100vh; 
    padding-bottom: 100px; /* Espacio extra al final */
}

/* Tarjeta del Editor */
.editor-card { 
    background: #fff; 
    padding: 3rem; 
    border-radius: 8px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.03); 
    max-width: none; 
    width: 100%;
    margin: 0; 
}

/* Títulos y Cabeceras de Formulario */
.section-title { 
    font-size: 1.2rem; font-weight: 600; 
    margin: 2rem 0 1.5rem 0; 
    padding-bottom: 0.8rem; 
    border-bottom: 2px solid #eee; 
    color: #000;
}
.admin-form-header {
    display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 1px solid #eee; padding-bottom: 1.5rem; margin-bottom: 2rem;
}

/* Campos de Formulario */
.form-group { margin-bottom: 1.5rem; }
.form-group label { 
    display: block; margin-bottom: 0.5rem; 
    font-weight: 600; font-size: 0.8rem; 
    color: #888; text-transform: uppercase; letter-spacing: 0.05em; 
}
.form-control { 
    width: 100%; padding: 1rem; 
    border: 1px solid #e0e0e0; border-radius: 6px; 
    font-family: 'Inter', sans-serif; font-size: 1rem; 
    background: #fdfdfd; transition: border 0.3s;
}
.form-control:focus { outline: none; border-color: #000; background: #fff; }
textarea.form-control { min-height: 120px; resize: vertical; line-height: 1.5; }

/* Grid para campos lado a lado */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

/* Bloques CV (Info) */
.cv-block { 
    background: #fff; padding: 1.5rem; border: 1px solid #000; 
    border-radius: 8px; margin-bottom: 2rem; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.cv-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.cv-item-row { 
    display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 15px; 
    margin-bottom: 10px; align-items: center; 
    padding: 10px; background: #f9f9f9; border-radius: 6px; 
}

/* Botones Generales Admin */
.btn-admin { 
    padding: 0.8rem 1.5rem; border: none; cursor: pointer; border-radius: 6px; 
    font-weight: 500; font-size: 0.95rem; transition: 0.2s; 
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top:10px;
}
.btn-primary { background: #000; color: #fff; }
.btn-primary:hover { background: #333; }
.btn-success { background: #000; color: #fff; width: 100%; padding: 1.2rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }
.btn-success:hover { background: #333; }
.btn-danger { background: #fff; border: 1px solid #ffcccc; color: #dc3545; }
.btn-danger:hover { background: #fff5f5; border-color: #dc3545; }
.btn-outline { background: #fff; border: 1px solid #000; color: #333; }
.btn-outline:hover { border-color: #000; color: #000; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

/* Iconos de Acción */
.action-icon { cursor: pointer; color: #bbb; padding: 8px; font-size: 1rem; transition: 0.2s; }
.action-icon:hover { color: #000; }
.icon-delete:hover { color: #dc3545; }

/* Overlay de Login */
#authOverlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: #fff; z-index: 9999; 
    display: flex; align-items: center; justify-content: center; 
}


/* ==========================================================================
   --- 3. RESPONSIVE ADMIN (MÓVIL / TABLET < 1024px) ---
   Transforma el Sidebar en un Menú Superior Expansible
   ========================================================================== */
@media (max-width: 1024px) {

    /* 1. Ajustes del Contenedor y Scroll */
    body.admin-body { 
        overflow: auto; /* Permitimos scroll en el cuerpo general */
    }
    /* Clase que JS añade al abrir el menú para bloquear el fondo */
    body.admin-body.menu-open { overflow: hidden; }

    .admin-container { 
        display:flex; /* Rompemos el Grid de escritorio */
        height: auto; 
    }

    /* 2. Sidebar Transformado en Header Fijo */
    .admin-sidebar { 
        position: fixed; 
        top: 0; left: 0; 
        width: 100%; 
        height: 70px; /* Altura del header cerrado */
        background: #fff; 
        border-right: none; 
        border-bottom: 1px solid #ddd; 
        padding: 0 1.5rem; 
        z-index: 2000; 
        overflow: hidden; /* Oculta el menú desplegable */
        transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1); /* Animación suave */
        display: flex; 
        flex-direction: column; 
    }

    /* Estado Abierto (Añadido por JS) */
    .admin-sidebar.open { 
        height: 100vh; /* Ocupa toda la pantalla */
        overflow-y: auto; /* Scroll interno para el menú */
        background: #fff;
    }

    /* 3. Cabecera del Menú (Logo + Botón) */
    .admin-header { 
        min-height: 70px; /* Debe coincidir con la altura del sidebar cerrado */
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        margin: 0; padding: 0; 
        border-bottom: none; 
        flex-shrink: 0;
    }
    .admin-header div h2 { font-size: 1rem; margin: 0; }
    .admin-header div p { font-size: 0.75rem; margin: 0; opacity: 0.6; }

    /* Botón Hamburguesa (Ahora Visible) */
    .admin-mobile-toggle { 
        display: flex; 
        align-items: center; 
        justify-content: center;
        width: 44px; height: 44px;
        background: transparent; border: none;
        font-size: 1.5rem; color: #000;
        cursor: pointer;
    }

    /* 4. Contenido del Menú Desplegable */
    .admin-menu-content { 
        display: block; /* Siempre renderizado */
        opacity: 0; /* Invisible cuando cerrado */
        transform: translateY(20px); 
        transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
        padding-top: 1rem; 
        padding-bottom: 2rem;
        flex-grow: 1; display: flex; flex-direction: column;
    }

    /* Animación al abrir */
    .admin-sidebar.open .admin-menu-content { 
        opacity: 1; 
        transform: translateY(0); 
    }

    /* Estilos de enlaces más grandes para dedo */
    .nav-item { 
        padding: 1.2rem; 
        font-size: 1.1rem; 
        border-bottom: 1px solid #f5f5f5; 
    }
    .project-list { 
        margin: 0; padding: 0; 
        border-left: none; background: #f9f9f9; 
    }
    .sub-item { 
        padding: 1rem 1rem 1rem 2.5rem; 
        font-size: 1rem; 
        border-bottom: 1px solid #eee; 
    }
    .sidebar-footer { margin-top: auto; padding-top: 2rem; }

    /* 5. Área Principal (Editor) */
    .admin-main { 
        padding: 1rem; 
        padding-top: 100px; /* 70px Header + 30px espacio */
        padding-bottom: 80px; 
        height: auto; 
        min-height: 100vh;
    }

    .editor-card { 
        padding: 1.5rem; 
        box-shadow: none; 
        border: 1px solid #e0e0e0; 
    }

    /* Formularios en Columna */
    .form-row, .cv-item-row { 
        grid-template-columns: 1fr; /* Pila vertical */
        gap: 1.5rem; 
    }

    /* Ajustes CV Builder */
    .cv-header-row { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 1rem; 
    }
    .cv-header-row input { width: 100% !important; font-size: 1.1rem; }
    .cv-header-row div { 
        width: 100%; display: flex; justify-content: flex-end; gap: 15px; 
        border-top: 1px solid #eee; padding-top: 10px; 
    }
    .action-icon { padding: 10px; font-size: 1.2rem; }

    /* Login Box */
    .auth-box { width: 90%; max-width: 90%; padding: 2rem; }
}

/* =========================================
   NUEVO: BARRA DE FORMATO Y GALERÍA
   ========================================= */

/* Barra de herramientas para texto */
.formatting-toolbar {
    display: flex;
    gap: 5px;
    background: #e9e9e9;
    padding: 8px;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.btn-format {
    background: #fff;
    border: 1px solid #bbb;
    padding: 4px 10px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 4px;
    font-size: 0.9rem;
}
.btn-format:hover { background: #000; color: #fff; border-color: #000; }

/* Ajuste para textareas con toolbar */
.textarea-with-toolbar {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-top: 0;
}

/* Galería de Imágenes (Admin) */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
    background: #fff;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
}

.admin-gallery-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.admin-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-delete-img {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}
.btn-delete-img:hover { background: red; }
/* GALERÍA ADMIN MEJORADA */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Un poco más anchos */
    gap: 15px;
    margin-top: 15px;
}

.admin-gallery-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.img-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    overflow: hidden;
}
.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-actions {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.img-name {
    font-size: 0.75rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-family: monospace;
}

.btn-group {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-icon {
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: 0.2s;
}

.btn-edit { background: #e0e0e0; color: #333; }
.btn-edit:hover { background: #000; color: #fff; }

.btn-delete { background: #ffebeb; color: #d9534f; }
.btn-delete:hover { background: #d9534f; color: #fff; }
/* =========================================
   NUEVO ESTILO PARA ÍTEMS DE CV (2 FILAS)
   ========================================= */

/* Contenedor de cada experiencia laboral / estudio */
.cv-item-box {
    background: #fff;
    border: 1px solid #000;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Fila 1: Nombre, Fecha y Botón Borrar */
.cv-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr auto; /* Nombre | Fecha | Borrar */
    gap: 15px;
    align-items: center;
}

/* Fila 2: Descripción (Ancho completo) */
.cv-row-bottom {
    display: flex;
    flex-direction: column;
}

/* En móvil, que la fila de arriba se apile si es necesario */
@media (max-width: 600px) {
    .cv-row-top {
        grid-template-columns: 1fr; /* Una columna */
        gap: 10px;
    }
    /* El botón de borrar flota a la derecha o ocupa ancho */
    .cv-row-top .btn-delete-item {
        justify-self: end;
    }
}
/* =======================================================
   RESPONSIVE TABLE: TRANSFORMACIÓN A TARJETAS (MÓVIL)
   ======================================================= */
@media (max-width: 768px) {
    
    /* 1. Desmontamos la tabla para que se comporten como bloques */
    .admin-table, 
    .admin-table tbody, 
    .admin-table tr, 
    .admin-table td {
        display: block;
        width: 100%;
    }

    /* 2. Ocultamos la cabecera (Fecha, Nombre, etc.) porque usaremos etiquetas */
    .admin-table thead {
        display: none;
    }

    /* 3. Estilo "Tarjeta" para cada fila (Cada mensaje) */
    .admin-table tr {
        background: #fff;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        padding: 15px;
        position: relative;
    }

    /* 4. Estilo de cada celda (línea dentro de la tarjeta) */
    .admin-table td {
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
        text-align: left;
        font-size: 0.95rem;
        display: flex;
        flex-direction: column; /* Apilar etiqueta y contenido */
        align-items: flex-start;
    }

    .admin-table td:last-child {
        border-bottom: none;
        flex-direction: row;
        justify-content: flex-end; /* Botón borrar a la derecha */
        padding-top: 15px;
    }

    /* 5. TRUCO DE MAGIA: Ponemos las etiquetas con CSS (nth-of-type) */
    
    /* Fecha */
    .admin-table td:nth-of-type(1)::before {
        content: "FECHA";
        font-size: 0.7rem; font-weight: bold; color: #999; margin-bottom: 4px;
    }
    
    /* Nombre */
    .admin-table td:nth-of-type(2)::before {
        content: "REMITENTE";
        font-size: 0.7rem; font-weight: bold; color: #999; margin-bottom: 4px;
    }
    .admin-table td:nth-of-type(2) {
        font-weight: 600; font-size: 1.1rem; color: #000;
    }

    /* Email */
    .admin-table td:nth-of-type(3)::before {
        content: "EMAIL";
        font-size: 0.7rem; font-weight: bold; color: #999; margin-bottom: 4px;
    }

    /* Mensaje (El más importante) */
    .admin-table td:nth-of-type(4) {
        background: #fafafa;
        padding: 10px;
        border-radius: 4px;
        margin-top: 10px;
        border: 1px solid #eee;
    }
    .admin-table td:nth-of-type(4)::before {
        content: "MENSAJE";
        font-size: 0.7rem; font-weight: bold; color: #999; margin-bottom: 6px; display: block;
    }

    /* Botón de borrar */
    .btn-delete {
        width: 100%; /* Botón grande para el dedo */
        padding: 12px;
        display: flex; justify-content: center; align-items: center; gap: 10px;
    }
    .btn-delete::after {
        content: "Borrar Mensaje"; /* Añadimos texto al botón que solo tenía icono */
        font-weight: 600;
    }
}