/* Fuente Chelsea Market desde Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Chelsea+Market&display=swap');

/* Variables de color y fuentes */
:root {
    --bg-color: #f1ebd9;
    --text-color: #1a1a1a;
    --accent-color: #b22a2a;
    --white: #ffffff; 
    --font-headings: 'Chelsea Market', system-ui, cursive;
    --font-body: 'Chelsea Market', system-ui, cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background-color: var(--bg-color); color: var(--text-color);
    font-family: var(--font-body); font-weight: 400; line-height: 1.4;
    -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

/* --- NAVEGACIÓN --- */
nav {
    position: sticky; top: 0; background-color: rgba(241, 235, 217, 0.98);
    backdrop-filter: blur(8px); border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 100; font-family: var(--font-headings);
}
.nav-wrapper { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; max-width: 1100px; margin: 0 auto; }
.nav-logo { font-size: 1.5rem; color: var(--accent-color); text-decoration: none; font-weight: 400; }
.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--text-color); font-size: 1.1rem; font-weight: 400; position: relative; transition: color 0.3s ease; }
.nav-links a::after { content: ''; position: absolute; bottom: -5px; left: 0; width: 0; height: 2px; background-color: var(--accent-color); transition: width 0.3s ease; }
.nav-links a:hover { color: var(--accent-color); }
.nav-links a:hover::after { width: 100%; }
.hamburger { display: none; flex-direction: column; cursor: pointer; }
.hamburger span { width: 25px; height: 3px; background-color: var(--text-color); margin: 4px 0; transition: 0.3s; }
.hamburger.active span:nth-child(1) { transform: rotate(-45deg) translate(-8px, 8px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(45deg) translate(-7px, -7px); }

/* --- LAYOUT MODERNO --- */
.site-wrapper { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { padding: 80px 0; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 40px; padding-top: 60px; padding-bottom: 80px; }
.hero-text { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; }
.hero-image { flex: 1; width: 100%; max-width: 450px; position: relative; }
.hero-image img { width: 100%; height: auto; border-radius: 16px; box-shadow: 0 20px 40px rgba(178, 42, 42, 0.15); filter: sepia(0.15) contrast(1.05); transform: rotate(2deg); transition: transform 0.4s ease; }
.hero-image img:hover { transform: rotate(0deg) scale(1.02); }

/* Títulos Hero */
.save-the-date { font-family: var(--font-headings); color: var(--accent-color); line-height: 0.85; margin-bottom: 20px; display: flex; flex-direction: column; width: fit-content; margin-left: auto; margin-right: auto; }
.std-save { align-self: flex-start; font-size: 4.5rem; }
.std-the { align-self: flex-end; font-size: 2.8rem; margin-right: 5px; }
.std-date { align-self: flex-start; font-size: 5rem; }
.names-title { font-family: var(--font-headings); font-size: 3.5rem; margin-bottom: 15px; color: var(--accent-color); font-weight: 400; text-align: center; }
.hero-subtitle { font-size: 1.5rem; font-weight: 400; letter-spacing: 1px; color: var(--text-color); margin-top: 10px; }

/* Contador Regresivo */
.countdown-section { margin-top: 100px; position: relative; z-index: 10; padding: 0 20px; }
.countdown-container { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; background-color: var(--white); padding: 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); max-width: 800px; margin: 0 auto; border: 2px solid rgba(178, 42, 42, 0.1); }
.countdown-box { flex: 1; min-width: 70px; text-align: center; }
.countdown-number { font-family: var(--font-headings); font-size: 3rem; font-weight: 400; color: var(--accent-color); display: block; line-height: 1; margin-bottom: 5px; }
.countdown-label { font-size: 1.1rem; text-transform: uppercase; font-weight: 400; color: #666; }

/* Secciones de Contenido Grid */
.content-grid { display: grid; grid-template-columns: 1fr; gap: 50px; align-items: center; }
.text-block p { font-size: 1.4rem; font-weight: 400; margin-bottom: 15px; color: var(--text-color); line-height: 1.3; }
.text-block.center { text-align: center; max-width: 700px; margin: 0 auto; }
.highlight-text-red { color: var(--accent-color) !important; font-size: 1.6rem !important; font-weight: 400 !important; margin-top: 20px; }
.icon-spacer { margin: 20px 0 30px 0; display: flex; justify-content: center; }
.icon-spacer img { width: auto; height: 96px; }

/* Tarjeta de Información (Ubicación) */
.info-card { background: rgba(255,255,255,0.5); border: 2px dashed rgba(178, 42, 42, 0.3); border-radius: 16px; padding: 40px 30px; text-align: center; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.info-card h3 { font-family: var(--font-headings); font-size: 3rem; color: var(--accent-color); margin-bottom: 20px; font-weight: 400; }
.info-card h2 { font-family: var(--font-headings); font-size: 2.5rem; color: var(--accent-color); margin-bottom: 20px; font-weight: 400; }

/* Map Iframe */
.map-container { width: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.1); height: 350px; border: 4px solid var(--white); }
.map-container iframe { width: 100%; height: 100%; border: none; }

/* --- BOTONES Y UI --- */
.btn { display: inline-block; background-color: var(--accent-color); color: var(--white); padding: 16px 40px; text-decoration: none; font-size: 1.5rem; border: none; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; font-family: var(--font-body); font-weight: 400; box-shadow: 0 8px 20px rgba(178, 42, 42, 0.25); margin-top: 20px; }
.btn:hover:not(:disabled) { transform: translateY(-2px); background-color: #8f2020; box-shadow: 0 12px 25px rgba(178, 42, 42, 0.35); }
.btn:disabled { background-color: #ccc; cursor: not-allowed; box-shadow: none; transform: none; }

/* Variantes de botones para el CMS (Estilo Pill sin ser gigantes) */
.btn-outline { background-color: transparent; color: var(--accent-color); border: 2px solid var(--accent-color); box-shadow: none; }
.btn-outline:hover:not(:disabled) { background-color: var(--accent-color); color: var(--white); box-shadow: 0 5px 15px rgba(178, 42, 42, 0.2); }
.btn-small { padding: 8px 16px; font-size: 1rem; margin-top: 0; }
.btn-small.active { background-color: #8f2020; color: white; border-color: #8f2020; }

footer { text-align: center; padding: 40px 0 60px 0; font-family: var(--font-headings); font-size: 4rem; color: var(--accent-color); }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease; z-index: 1000; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { background-color: var(--bg-color); padding: 40px; width: 90%; max-width: 500px; border-radius: 12px; position: relative; transform: translateY(20px); transition: transform 0.3s ease; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.modal-overlay.active .modal-content { transform: translateY(0); }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 2rem; cursor: pointer; color: var(--text-color); background: none; border: none; font-family: var(--font-headings); }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 1.3rem; font-weight: 400; color: var(--text-color); }
.form-group input, .form-group select { width: 100%; padding: 12px; border: 2px solid rgba(0,0,0,0.1); background-color: var(--white); color: var(--text-color); font-family: var(--font-body); font-size: 1.1rem; border-radius: 8px; font-weight: 400; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent-color); }
.honeypot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }
.form-status { margin-top: 20px; padding: 15px; border-radius: 8px; text-align: center; font-size: 1.1rem; display: none; }
.form-status.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; display: block; }
.form-status.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; display: block; }

/* Tarjetas de Actividades */
.activity-card { background: rgba(255,255,255,0.7); border: 2px solid rgba(178, 42, 42, 0.2); border-radius: 12px; padding: 30px; transition: all 0.3s ease; }
.activity-card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(178, 42, 42, 0.1); border-color: rgba(178, 42, 42, 0.4); }
.activity-card h3 { font-family: var(--font-headings); font-size: 2rem; color: var(--accent-color); margin-bottom: 15px; font-weight: 400; }
.activity-card p { font-size: 1.2rem; color: var(--text-color); line-height: 1.5; margin-bottom: 12px; }
.activity-grid { display: grid; grid-template-columns: 1fr; gap: 30px; }

/* --- CMS Styles --- */
.cms-container { max-width: 1200px; margin: 40px auto; padding: 0 20px; }
.cms-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; flex-wrap: wrap; gap: 20px; }
.cms-header h1 { font-family: var(--font-headings); font-size: 3rem; color: var(--accent-color); font-weight: 400; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 50px; }

.logout-btn { background-color: var(--accent-color); color: var(--white); padding: 10px 20px; text-decoration: none; border-radius: 25px; font-family: var(--font-headings); transition: all 0.3s ease; }
.logout-btn:hover { background-color: #8f2020; }

.cms-table { width: 100%; border-collapse: collapse; background-color: var(--white); border-radius: 12px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.cms-table th, .cms-table td { padding: 15px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 1.1rem; }
.cms-table th { background-color: var(--accent-color); color: var(--white); font-family: var(--font-headings); font-weight: 400; user-select: none; }
.cms-table th.sortable:hover { background-color: #8f2020; }
.cms-table tbody tr:hover { background-color: rgba(178, 42, 42, 0.05); }

.cms-section { margin-top: 50px; padding: 30px; background-color: var(--white); border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.cms-section h2 { font-family: var(--font-headings); font-size: 2rem; color: var(--accent-color); margin-bottom: 20px; font-weight: 400; padding-bottom: 15px; border-bottom: 2px solid rgba(178, 42, 42, 0.1); }
.cms-section p { font-size: 1.1rem; color: #666; line-height: 1.6; margin-bottom: 15px; }

/* Login Styles */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.login-card { background-color: var(--white); padding: 50px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); width: 100%; max-width: 400px; }
.login-card h1 { font-family: var(--font-headings); font-size: 2.5rem; color: var(--accent-color); margin-bottom: 30px; text-align: center; font-weight: 400; }
.login-form .form-group { margin-bottom: 25px; }
.login-form .form-group label { font-size: 1.2rem; }
.login-form .form-group input { font-size: 1.1rem; padding: 14px; }
.login-form .btn { width: 100%; margin-top: 30px; }
.error-message { background-color: #f8d7da; color: #721c24; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #f5c6cb; font-size: 1rem; }

/* Gallery Styles */
.gallery-card { transition: box-shadow 0.3s ease; }
.gallery-card:hover { box-shadow: 0 5px 20px rgba(178, 42, 42, 0.1); }
.photo-grid { cursor: grab; }
.photo-item { cursor: grab; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.photo-item:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.15) !important; }
.photo-item:active { cursor: grabbing; }
.photo-item img { display: block; }
.delete-photo-btn { transition: all 0.2s ease; }
.delete-photo-btn:hover { background-color: #c82333 !important; transform: scale(1.1); }

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 60px; left: 0; width: 100%; flex-direction: column; gap: 0; background-color: rgba(241, 235, 217, 0.98); padding: 20px; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
    .nav-links.active { display: flex; }
    .nav-links a { padding: 15px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
    .nav-links a::after { display: none; }
    .hamburger { display: flex; }
    .std-save { font-size: 3.5rem; }
    .std-the { font-size: 2rem; }
    .std-date { font-size: 4rem; }
    .names-title { font-size: 2.5rem; }
    .hero-subtitle { font-size: 1.2rem; }
    .activity-grid { grid-template-columns: 1fr; }

    /* CMS Mobile adjustments */
    .cms-container { margin: 20px auto; }
    .cms-header h1 { font-size: 2.2rem; }

    /* Transformación de tabla a tarjetas (Card View) para móvil */
    .cms-table { border: 0; background: transparent; box-shadow: none; }
    .cms-table thead { display: none; }
    .cms-table tr { display: block; margin-bottom: 20px; background: var(--white); border-radius: 12px; padding: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.08); border: 2px solid rgba(178, 42, 42, 0.05); }
    .cms-table td { display: block; text-align: right; font-size: 1.1rem; border-bottom: 1px dashed rgba(0,0,0,0.1); padding: 12px 5px; }
    .cms-table td:last-child { border-bottom: 0; text-align: center; padding-top: 15px; }
    
    /* Usa el atributo data-label del HTML como título de cada fila */
    .cms-table td::before { content: attr(data-label); float: left; font-family: var(--font-headings); font-weight: 400; color: var(--accent-color); font-size: 1.1rem; }

    .btn-small { width: 100%; margin-top: 10px; display: block; }
    .cms-table td form { justify-content: space-between !important; flex-wrap: wrap; }
    .cms-table td form input[type="number"] { flex: 1; }

    /* Galería CMS en móvil */
    #newGalleryForm { flex-direction: column; }
    #newGalleryForm .btn { width: 100%; }
    .gallery-card > div:first-child { flex-direction: column; align-items: flex-start !important; gap: 15px; }
    .gallery-card > div:first-child > div:last-child { width: 100%; display: flex; flex-direction: column; gap: 10px; }
    .gallery-card .btn { width: 100%; text-align: center; }
}

@media (min-width: 769px) {
    .hero { flex-direction: row; text-align: left; justify-content: space-between; padding-bottom: 50px; }
    .hero-text { padding-right: 40px; align-items: flex-start; }
    .save-the-date { margin-left: 0; margin-right: auto; }
    .std-save { font-size: 6.5rem; }
    .std-the { font-size: 4rem; margin-right: 15px; }
    .std-date { font-size: 7rem; }
    .names-title { font-size: 4.5rem; }
    .content-grid { grid-template-columns: 1fr 1fr; gap: 60px; }
    .map-container { height: 450px; }
    .activity-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (min-width: 1024px) {
    .activity-grid { grid-template-columns: 1fr 1fr 1fr; }
}