/* === ReadFy Goals Modal Styles (styles/metas-modal.css) - REDISEÑADO === */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(45, 55, 72, 0.7); /* Fondo más oscuro */
    backdrop-filter: blur(4px); /* Efecto de desenfoque */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.modal.modal-enter { animation: fadeInModalBg 0.3s ease-out forwards; }
.modal.modal-exit { animation: fadeOutModalBg 0.3s ease-out forwards; }

.modal-content {
    background-color: var(--color-secundario);
    padding: 0;
    border-radius: var(--border-radius-main);
    /* START: MODIFICATION */
    width: 100%; /* Ocupa el 100% del espacio disponible (respetando el padding del padre) */
    box-sizing: border-box; /* Asegura que el padding se incluya en el cálculo del ancho */
    /* END: MODIFICATION */
    max-width: 850px; /* Ancho máximo para el layout de dos columnas */
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Clave para que los hijos hereden el border-radius */
    margin: auto; /* Permite el centrado en pantallas más grandes que max-width */
}

.modal.modal-enter .modal-content { animation: slideDownModal 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
.modal.modal-exit .modal-content { animation: slideUpModal 0.4s cubic-bezier(0.5, 0, 0.75, 0) forwards; }

.modal-layout {
    display: grid;
    grid-template-columns: 1fr; /* Por defecto una columna para móvil */
    width: 100%;
}

/* --- Panel Informativo (Izquierda) --- */
.modal-info-panel {
    display: none; /* Oculto en móviles por defecto */
    background: linear-gradient(160deg, var(--color-primario), #4a58c0);
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    justify-content: center;
    flex-direction: column;
}

.info-icon { font-size: 3rem; margin-bottom: 1rem; }
.modal-info-panel h3 { font-size: 1.5rem; margin-bottom: 1rem; line-height: 1.3; }
.modal-info-panel p { opacity: 0.9; line-height: 1.7; font-size: 1rem; }
.info-quote {
    margin-top: auto;
    padding-top: 2rem;
    font-style: italic;
    opacity: 0.8;
}
.info-quote span {
    display: block;
    margin-top: 0.5rem;
    font-style: normal;
    font-weight: 700;
}

/* --- Panel del Formulario (Derecha) --- */
.modal-form-panel {
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Se asegura que no sobrepase la altura de la pantalla */
    width: 100%;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--color-borde);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-header h2 { font-size: 1.5rem; color: var(--text-primary); margin: 0; }
.close-modal-btn { background: none; border: none; font-size: 2rem; color: var(--color-terciario); cursor: pointer; line-height: 1; }

#goal-form {
    padding: 1rem 2rem 1.5rem 2rem;
    overflow-y: auto; /* Solo el formulario hace scroll */
    flex-grow: 1;
}
.form-group { margin-bottom: 1.75rem; }

.form-step > label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}
.step-number {
    background-color: #eef2ff;
    color: var(--color-primario);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    background-color: #f9fafb;
}
.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

#steps-container { display: flex; flex-direction: column; gap: 0.75rem; }
.step-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f9fafb;
    border: 1px solid var(--color-borde);
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    border-radius: 8px;
}
.step-item input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 0.25rem 0;
}
.step-item input:focus { box-shadow: none; }
.btn-remove-step { background: none; border: none; cursor: pointer; color: var(--color-terciario); padding: 0.5rem; border-radius: 50%; }
.btn-remove-step:hover { background-color: #f3f4f6; color: #ef4444; }

.btn-add-step {
    background: transparent;
    border: 2px dashed var(--color-borde);
    color: var(--text-secondary);
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    font-weight: 700;
    border-radius: 8px;
}
.btn-add-step:hover { background: #f8f9fa; border-color: var(--color-primario); color: var(--color-primario); }

.modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--color-borde);
    background-color: #f9fafb;
    flex-shrink: 0;
}

.btn-save-goal {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    background-color: var(--color-acento);
    color: white;
}
.btn-save-goal:hover { background-color: #2aa879; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(52,211,153,0.3); }

/* --- Animaciones y Media Queries --- */
@keyframes fadeInModalBg { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOutModalBg { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideDownModal { from { transform: translateY(-20px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes slideUpModal { from { transform: translateY(0) scale(1); opacity: 1; } to { transform: translateY(-20px) scale(0.98); opacity: 0; } }

@media (min-width: 880px) {
    .modal-content {
        margin: auto; /* Restauramos el margen auto en pantallas grandes */
    }
    .modal-layout {
        grid-template-columns: 1fr 1.5fr; /* Layout 40/60 */
    }
    .modal-info-panel {
        display: flex;
    }
    .modal-form-panel {
        max-height: 600px; /* Altura máxima en desktop */
    }
}
