/* --- ESTILOS DEL HEADER Y SESIÓN --- */
.main-header {
    width: 100%;
    background-color: #fff;
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    box-sizing: border-box;
}

.user-session-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: right;
    font-size: 0.9em;
}

.user-session-container .login-button {
    background-color: #4285F4; /* Color de Google */
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.2s;
}
.user-session-container .login-button:hover {
    background-color: #357ae8;
}

.user-session-container .user-info {
    color: #333;
}
.user-session-container .user-info span {
    margin: 0 5px;
    color: #ccc;
}
.user-session-container .user-info a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}
.user-session-container .user-info a:hover {
    text-decoration: underline;
}

/* Ajustar el body para dejar espacio al header fijo */
body {
    padding-top: 60px; /* Altura del header + un poco de margen */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #e0f2f7; /* Fondo azul claro */
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 20px; /* Añadido padding abajo */
    margin: 0; 
}

/* --- ESTILOS GENERALES DEL CONTENEDOR --- */
.container {
    max-width: 600px;
    width: 100%;
    background: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); 
    margin-top: 20px; /* Espacio extra debajo del header */
    position: relative; /* Para que el contador de créditos se posicione bien */
}

h1 {
    text-align: center;
    color: #1a2a3a; 
    margin-bottom: 10px;
}

p {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 25px;
    color: #555;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.1em;
}

input[type="file"],
input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cce7f0; 
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
    background-color: #f8fcff; 
}
input[type="text"] {
    margin-bottom: 10px;
}

input[type="file"] {
    padding: 10px 12px;
    background: #f0f8ff; 
    border: 1px dashed #a0d9ef; 
}

.grid-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}
.grid-inputs span {
    font-size: 1.2em;
    font-weight: 600;
}

/* --- ESTILOS DE PREVISUALIZACIÓN DE PÓSTER --- */
#preview-container {
    position: relative; 
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 150px; 
    margin-top: 15px;
    border: 2px dashed #a0d9ef; 
    padding: 10px;
    box-sizing: border-box;
    background-color: #f0f8ff; 
    text-align: center;
    color: #666;
    font-style: italic;
    overflow: hidden; 
}

#imagePreview {
    max-width: 100%; 
    height: auto;
    margin: auto; 
}

#previewPlaceholder {
    margin: 0;
    padding: 10px;
}

#gridPreviewOverlay {
    position: absolute;
    top: 10px; 
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: none; 
    flex-wrap: wrap;
    pointer-events: none; 
}

.grid-cell {
    box-sizing: border-box;
    border: 1px dashed rgba(255, 0, 0, 0.7); 
}

/* --- ESTILOS DE BOTONES Y OPCIONES --- */
button {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 25px; 
}
button:hover {
    background-color: #0056b3;
}
button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

#status {
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
    font-size: 1.1em;
    color: #28a745;
}

.aspect-note {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-size: 0.9em;
    color: #444;
}
.aspect-note input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}
.aspect-note label {
    margin-bottom: 0;
    font-weight: 400;
}

.option-row {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-size: 0.95em;
    color: #444;
}
.option-row input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    height: 18px;
}
.option-row label {
    margin-bottom: 0;
    font-weight: 400;
    cursor: pointer; 
}

/* Botón de donar genérico (usado en poster.html) */
.donate-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: #ffc107; 
    color: #333;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: 5px;
    transition: background-color 0.2s;
    font-size: 1em;
}
.donate-btn:hover {
    background-color: #e0a800; 
}

.secondary-btn {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    font-weight: 600;
    color: #007bff;
    background-color: #f0f8ff;
    border: 1px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    margin-top: 10px;
}
.secondary-btn:hover {
    background-color: #e0f0ff;
}

/* --- ESTILOS DE MODALES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}
.modal-content h2 {
    margin-top: 0;
    color: #1a2a3a;
}
.modal-content .small-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 15px;
}

/* Estilos para el Contenedor de Cropper.js */
.cropper-img-container {
    width: 100%;
    max-width: 80vw;
    max-height: 60vh; 
    margin: 20px 0;
    overflow: hidden; 
}
#imageToCrop {
    display: block;
    max-width: 100%;
}

/* Estilos para el Modal de TikTok y Créditos */
.tiktok-btn, .whatsapp-btn {
    display: inline-block;
    padding: 15px 30px;
    margin: 20px 0;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    border-radius: 5px;
    font-size: 1.1em;
    transition: background-color 0.2s;
}
.tiktok-btn {
    background-color: #000000; 
    border: 2px solid #00f2ea;
}
.tiktok-btn:hover {
    background-color: #333;
}
.whatsapp-btn {
    background-color: #25D366; /* Color de WhatsApp */
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    margin-bottom: 10px;
}
.whatsapp-btn:hover {
    background-color: #1EAE56;
}

#continueGenerateBtn {
    background-color: #007bff; 
    color: white;
    width: auto;
    padding: 12px 25px;
    border: none;
    cursor: pointer;
    margin: 0;
    font-size: 1em;
}
#continueGenerateBtn:hover {
    background-color: #0056b3;
}

/* --- ESTILOS PÁGINA PRINCIPAL (INDEX.HTML) --- */
.home-container {
    max-width: 900px; /* Más ancho para la cuadrícula */
    text-align: center;
}

.tool-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Cuadrícula responsive */
    gap: 20px;
    margin: 30px 0;
}

.tool-button {
    display: block;
    padding: 25px;
    background-color: #f8fcff;
    border: 1px solid #cce7f0;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.tool-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 123, 255, 0.1);
    border-color: #007bff;
}

.tool-button .tool-icon {
    font-size: 3em;
}

.tool-button h2 {
    color: #007bff;
    margin-top: 10px;
    margin-bottom: 5px;
}

.tool-button p {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 0;
    text-align: center; /* Asegura que el párrafo esté centrado */
}

/* Formulario de Donación en Home */
.paypal-form-home {
    margin: 0;
    padding-top: 20px; /* Espacio entre la cuadrícula y el botón */
}

button.donate-btn-home {
    display: inline-block; /* Para que no ocupe todo el ancho */
    width: auto;
    padding: 12px 25px;
    margin-top: 20px;
    background-color: #ffc107;
    color: #333;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: 5px;
    transition: background-color 0.2s;
    font-size: 1.1em;
    border: none;
    cursor: pointer;
}
button.donate-btn-home:hover {
    background-color: #e0a800;
}


/* --- ESTILOS PÁGINAS SECUNDARIAS (GALERÍA, FONDO, ETC.) --- */
.back-link {
    display: inline-block;
    font-weight: 600;
    color: #007bff;
    text-decoration: none;
    margin-bottom: 20px;
}
.back-link:hover {
    text-decoration: underline;
}

.recommend-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 25px;
}

.recommend-button {
    display: block;
    padding: 20px;
    background-color: #fdfdfd;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}
.recommend-button:hover {
    border-color: #007bff;
    background-color: #f8fcff;
}
.recommend-button h3 {
    margin: 0 0 5px 0;
    color: #0056b3;
}
.recommend-button p {
    margin: 0;
    font-size: 0.95em;
    text-align: left;
}

/* --- ESTILOS DE GALERÍA DE PROYECTOS --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Cuadrícula responsive */
    gap: 20px;
    margin-top: 25px;
}

.proyecto-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    background: #fdfdfd;
    transition: all 0.2s ease;
    overflow: hidden; /* Para que la imagen no se salga */
}

.proyecto-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.1);
    transform: translateY(-3px);
}

.proyecto-card img {
    width: 100%;
    height: 150px; /* Altura fija para las miniaturas */
    object-fit: cover; /* Asegura que la imagen cubra el espacio */
    border-bottom: 1px solid #eee;
}

.proyecto-card h3 {
    font-size: 1.1em;
    margin: 10px 15px 5px;
    color: #0056b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Añade ... si el nombre es muy largo */
}

.proyecto-card p {
    font-size: 0.9em;
    margin: 0 15px 15px;
    color: #555;
    text-align: left; /* Alineado a la izquierda */
}

/* Estilo para el autor en la galería comunitaria */
.proyecto-card p.project-author {
    font-size: 0.8em;
    font-style: italic;
    color: #777;
    margin-top: 5px;
    border-top: 1px solid #eee;
    padding-top: 5px;
}

/* Estilo para el checkbox "Hacer público" */
.public-checkbox {
    margin-top: 10px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
}
.public-checkbox label {
    font-weight: 600;
    color: #007bff;
}

/* Contador de créditos (en poster.html) */
#creditCounterDisplay {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 10;
    padding: 8px 12px;
    background-color: #007bff;
    color: white;
    font-weight: 600;
    border-radius: 20px;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* --- ESTILOS DEL MODAL DE COMPRA (poster.html) --- */
.paypal-form {
    margin-top: 20px;
    margin-bottom: 20px;
}

.paypal-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: left;
    color: #333;
}

.paypal-form select {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    border: 1px solid #cce7f0;
    border-radius: 5px;
    background-color: #f8fcff;
    margin-bottom: 15px;
}

.paypal-form .donate-btn {
    width: 100%;
    margin-top: 0;
    padding: 15px;
    background-color: #007bff; /* Azul PayPal */
}
.paypal-form .donate-btn:hover {
    background-color: #0056b3;
}

.modal-content hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 25px 0;
}