/* --- RESET Y CONFIGURACIÓN GLOBAL --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth; /* Movimiento fluido por las secciones */
}

body {
    background-color: #0f172a;
    color: #f8fafc;
    line-height: 1.6;
}

/* --- NAVBAR --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 10%;
    background-color: #1e293b;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #334155;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.logo span {
    color: #a855f7;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    margin-right: 2rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #a855f7;
}

.btn-auth {
    background-color: #a855f7;
    color: white;
    border: none;
    padding: 0.6rem 1.3rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, background-color 0.3s;
}

.btn-auth:hover {
    background-color: #9333ea;
    transform: scale(1.05);
}

/* --- HERO SECTION --- */
.hero {
    height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 1rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ffffff;
    font-weight: 800;
}

.hero-content p {
    font-size: 1.2rem;
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.btn-primary {
    background-color: #22c55e;
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s;
}

.btn-primary:hover {
    background-color: #16a34a;
    transform: scale(1.05);
}

/* --- SECCIÓN CÓMO FUNCIONA --- */
.how-it-works {
    padding: 6rem 10%;
    background-color: #111a2e;
    text-align: center;
    border-bottom: 1px solid #1e293b;
}

.how-it-works h2 {
    font-size: 2.2rem;
    margin-bottom: 3rem;
}

.steps-container {
    display: flex;
    justify-content: space-around;
    gap: 3rem;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 250px;
    background: #1e293b;
    padding: 2.5rem 1.5rem;
    border-radius: 12px;
    border: 1px solid #334155;
    transition: transform 0.3s ease;
}

.step:hover {
    transform: translateY(-5px);
}

.step-number {
    width: 50px;
    height: 50px;
    background: #a855f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-weight: bold;
    font-size: 1.3rem;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.step h3 {
    margin-bottom: 0.8rem;
    color: #ffffff;
}

.step p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* --- CARACTERÍSTICAS --- */
.features {
    padding: 6rem 10%;
    text-align: center;
}

.features h2 {
    font-size: 2.2rem;
    margin-bottom: 3rem;
}

.grid-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
}

.card {
    background-color: #1e293b;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    border: 1px solid #334155;
    transition: transform 0.3s ease, border-color 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: #a855f7;
}

.card h3 {
    color: #a855f7;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.card p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* --- MODAL (ANIMADO Y SÚPER PRO) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px); /* Difumina el fondo */
    justify-content: center;
    align-items: center;
}

/* Animación de entrada con un rebote sutil */
@keyframes modalElastic {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content {
    background-color: #1e293b;
    padding: 2.5rem;
    border-radius: 20px;
    width: 92%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    border: 1px solid #334155;
    animation: modalElastic 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.close-modal {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    font-size: 2rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.close-modal:hover {
    color: #f8fafc;
    transform: scale(1.1);
}

.modal-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid #334155;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #94a3b8;
    padding: 0.8rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.tab-btn.active {
    color: #a855f7;
}

/* Línea animada inferior en los botones de pestañas */
.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #a855f7;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.tab-btn.active::after {
    width: 100%;
}

/* Animación de deslizamiento lateral al cambiar de formulario */
@keyframes slideInForm {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.auth-form:not(.hidden) {
    animation: slideInForm 0.35s ease-out;
}

.auth-form.hidden {
    display: none;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    color: #cbd5e1;
    font-weight: 500;
}

.input-group input {
    background-color: #0f172a;
    border: 1px solid #334155;
    padding: 0.85rem;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.full-width {
    width: 100%;
    padding: 0.85rem;
    font-size: 1.05rem;
    margin-top: 0.5rem;
}

/* --- ESTILOS PARA LOS MENSAJES DINÁMICOS DEL MODAL --- */
.auth-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.auth-message.error {
    background-color: #fde8e8;
    color: #e02424;
    border: 1px solid #f8b4b4;
    display: block;
}

.auth-message.success {
    background-color: #def7ec;
    color: #03543f;
    border: 1px solid #bcf0da;
    display: block;
}

.auth-message.hidden {
    display: none;
}

/* --- BARRA DE NAVEGACIÓN SUPERIOR --- */
.dashboard-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1e293b; /* Un azul oscuro elegante */
    color: #ffffff;
    padding: 15px 30px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dashboard-navbar .logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-navbar .logo span {
    color: #3b82f6; /* El toque azul de MemorIQ */
}

.panel-tag {
    font-size: 0.8rem;
    background-color: #334155;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 5px;
    color: #94a3b8;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

#navUserName {
    font-weight: 500;
    color: #cbd5e1;
}

.btn-logout {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-logout:hover {
    background-color: #dc2626;
}

/* Margen superior para que el contenido no se meta debajo de la barra fija */
.dashboard-content {
    margin-top: 80px; 
    padding: 20px;
}

/* --- MODAL PERSONALIZADO DE ALERTA --- */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Fondo oscurecido con opacidad */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px); /* Efecto difuminado de fondo */
}

.custom-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.2s ease-out;
}

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.custom-modal-content h3 {
    margin: 0 0 10px 0;
    color: #0f172a;
    font-size: 1.3rem;
}

.custom-modal-content p {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 25px;
    line-height: 1.4;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-confirm-logout {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-confirm-logout:hover {
    background-color: #dc2626;
}

.btn-cancel-logout {
    background-color: #e2e8f0;
    color: #475569;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-cancel-logout:hover {
    background-color: #cbd5e1;
}

.custom-modal.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- BARRA DE NAVEGACIÓN SUPERIOR --- */
.dashboard-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1e293b;
    color: #ffffff;
    padding: 12px 20px; /* Un poco más compacta */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dashboard-navbar .logo {
    font-size: 1.3rem;
    font-weight: 700;
}

.dashboard-navbar .logo span {
    color: #3b82f6;
}

.panel-tag {
    font-size: 0.7rem;
    background-color: #334155;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 3px;
    color: #94a3b8;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

#navUserName {
    font-weight: 500;
    color: #cbd5e1;
    font-size: 0.9rem;
    max-width: 120px; /* Evita que nombres largos rompan el diseño en móvil */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* BOTÓN DE ICONO ULTRA ADAPTADO */
.btn-logout-icon {
    background-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-logout-icon:hover {
    background-color: #ef4444;
    color: white;
    border-color: #ef4444;
}

.dashboard-content {
    margin-top: 75px; 
    padding: 15px;
}

/* --- MODAL ADAPTADO A PANTALLAS MÓVILES --- */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    padding: 15px; /* Margen para que no toque los bordes del móvil */
    box-sizing: border-box;
}

.custom-modal-content {
    background-color: white;
    padding: 25px 20px;
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: popUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.custom-modal-content h3 {
    margin: 0 0 8px 0;
    color: #0f172a;
    font-size: 1.2rem;
}

.custom-modal-content p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-buttons {
    display: flex;
    flex-direction: column-reverse; /* En móviles, cancelar abajo es más cómodo */
    gap: 8px;
    width: 100%;
}

.btn-confirm-logout, .btn-cancel-logout {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    box-sizing: border-box;
}

.btn-confirm-logout {
    background-color: #ef4444;
    color: white;
}

.btn-cancel-logout {
    background-color: #f1f5f9;
    color: #475569;
}

/* --- MEDIA QUERIES PARA PANTALLAS GRANDES (PC/TABLET) --- */
@media (min-width: 480px) {
    .dashboard-navbar { padding: 15px 30px; }
    .dashboard-navbar .logo { font-size: 1.5rem; }
    #navUserName { font-size: 1rem; max-width: 250px; }
    .modal-buttons { flex-direction: row; } /* Botones uno al lado del otro en PC */
    .custom-modal-content { padding: 30px; }
}

@keyframes popUp {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.custom-modal.hidden {
    display: none !important;
}

/* --- CUADRÍCULA DE ARCHIVOS RESPONSIVA --- */
.files-section {
    margin-top: 20px;
}

.files-section h2 {
    color: #0f172a;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Cuadrícula inteligente */
    gap: 16px;
    width: 100%;
}

/* Tarjeta individual de cada foto */
.file-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Contenedor de la miniatura */
.file-preview {
    width: 100%;
    height: 140px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ajusta la foto sin deformarla */
}

/* Info del archivo */
.file-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Corta textos largos con "..." */
}

.file-size {
    font-size: 0.75rem;
    color: #64748b;
}

/* Botón flotante para borrar archivo */
.btn-delete-file {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0; /* Oculto por defecto en PC, aparece al pasar el ratón */
    transition: opacity 0.2s;
}

.file-card:hover .btn-delete-file {
    opacity: 1;
}

/* Mensajes de estado */
.loading-text, .empty-text {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-size: 1rem;
}

/* --- ADAPTACIÓN MÓVIL --- */
@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 fotos por fila en móvil es lo más cómodo */
        gap: 10px;
    }
    .file-preview {
        height: 110px;
    }
    .btn-delete-file {
        opacity: 1; /* Siempre visible en móviles porque no hay hover */
    }
}

.upload-section {
    margin-bottom: 30px;
}

.dropzone {
    border: 2px dashed #3b82f6;
    background-color: #f8fafc;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

/* Efecto cuando el usuario arrastra una foto encima */
.dropzone.dragover {
    background-color: #eff6ff;
    border-color: #2563eb;
    transform: scale(1.01);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none; /* Evita que los textos molesten al arrastrar */
}

.dropzone-content p {
    font-size: 1rem;
    color: #334155;
    margin: 0;
}

.dropzone-content small {
    color: #94a3b8;
}

.hidden-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Banner de Cookies Elegante */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #ffffff;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 99999;
    max-width: 600px;
    width: 90%;
    font-family: sans-serif;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.cookie-banner.hidden-cookies {
    opacity: 0;
    transform: translate(-50%, 30px);
    pointer-events: none;
}
.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
@media (min-width: 600px) {
    .cookie-content { flex-direction: row; text-align: left; }
}
.btn-cookie-accept {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-cookie-accept:hover { background: #1557b0; }

/* ==========================================================================
   RESPONSIVE: OPTIMIZACIÓN PARA MÓVILES (NAVBAR LIMPIA)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. Hacemos que la barra distribuya el logo a la izquierda y el botón a la derecha */
    .navbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px; /* Ajustamos padding para ganar espacio */
    }

    /* 2. Ocultamos los enlaces de texto ("Cómo funciona" y "Características") */
    .nav-links a {
        display: none !important;
    }

    /* 3. Aseguramos que el contenedor nav no meta márgenes raros y solo muestre el botón */
    .nav-links {
        display: flex;
        align-items: center;
        margin: 0;
        padding: 0;
    }

    /* 4. Ajustamos el botón para que no quede gigante en el móvil */
    .btn-auth {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}