/* --- Estilo del Contenedor --- */
.aideal-dev-ia-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Estilo del Botón de Apertura (Premium) --- */
.aideal-dev-ia-container .aideal-dev-ia-open-chat {
    background: linear-gradient(90deg, #601FE8, #A435B3, #601FE8) !important;
    background-size: 200% auto !important;
    color: white !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 18px 35px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    letter-spacing: 0.5px;
    cursor: pointer !important;
    box-shadow: 0 4px 20px rgba(96, 31, 232, 0.4) !important;
    transition: all 0.4s ease-out !important;
    display: inline-block !important;
    text-align: center;
    line-height: 1.2 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.aideal-dev-ia-container .aideal-dev-ia-open-chat:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 30px rgba(96, 31, 232, 0.6) !important;
    background-position: right center !important;
}

/* --- Estructura del Popup --- */
.aideal-dev-ia-popup-overlay {
    position: fixed; inset: 0;
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; opacity: 0;
    transition: opacity 0.3s ease;
}
.aideal-dev-ia-popup-overlay.visible { opacity: 1; }
.aideal-dev-ia-popup-container {
    background: #18181B; color: #E4E4E7;
    border-radius: 20px; width: 90%; max-width: 480px;
    height: 90%; max-height: 720px;
    display: flex; flex-direction: column;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95); opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.aideal-dev-ia-popup-overlay.visible .aideal-dev-ia-popup-container {
    transform: scale(1); opacity: 1;
}

.aideal-dev-ia-popup-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.aideal-dev-ia-brand { font-size: 18px; font-weight: 500; }
.aideal-dev-ia-brand strong { font-weight: 800; background: linear-gradient(90deg, #818CF8, #C084FC); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.aideal-dev-ia-popup-close { background: none; border: none; color: #71717A; font-size: 24px; cursor: pointer; transition: color 0.2s; }
.aideal-dev-ia-popup-close:hover { color: white; }

.aideal-dev-ia-popup-content { flex-grow: 1; position: relative; overflow: hidden; }
.aideal-dev-ia-step { position: absolute; inset: 0; padding: 20px; display: flex; flex-direction: column; opacity: 0; visibility: hidden; transition: all 0.4s ease; }
.aideal-dev-ia-step.active { opacity: 1; visibility: visible; }

/* --- Step 1: Chat --- */
.aideal-dev-ia-chat-messages { flex-grow: 1; overflow-y: auto; padding: 10px 0; }
.aideal-dev-ia-message {
    max-width: 85%; padding: 12px 18px;
    border-radius: 20px; line-height: 1.5;
    margin-bottom: 10px; opacity: 0;
    animation: slide-up 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes slide-up { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.aideal-dev-ia-message.bot { background: #27272A; border-bottom-left-radius: 5px; align-self: flex-start; }
.aideal-dev-ia-message.user { background: #6366F1; color: white; border-bottom-right-radius: 5px; align-self: flex-end; }
.typing-indicator { display: inline-flex; align-items: center; }
.typing-indicator span { width: 6px; height: 6px; background-color: #A1A1AA; border-radius: 50%; margin: 0 2px; animation: bounce 1.2s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: -0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: -0.4s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }

.aideal-dev-ia-chat-input-area { padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.aideal-dev-ia-chat-input-wrapper { display: flex; align-items: center; background: #27272A; border-radius: 12px; }
#aideal-dev-ia-user-input { flex-grow: 1; background: transparent; border: none; color: white; padding: 12px 15px; font-size: 16px; }
#aideal-dev-ia-user-input:focus { outline: none; }
#aideal-dev-ia-send-btn { background: none; border: none; padding: 10px; cursor: pointer; }
#aideal-dev-ia-send-btn svg { width: 24px; height: 24px; color: #A1A1AA; transition: color 0.2s; }
#aideal-dev-ia-send-btn:hover svg { color: #6366F1; }
.aideal-dev-ia-error-message { color: #F87171; font-size: 14px; text-align: center; padding-top: 10px; }

/* --- Step 2: Loading --- */
.aideal-dev-ia-step-2 { text-align: center; justify-content: center; align-items: center; gap: 20px; }
.aideal-dev-ia-step-2 h4 { font-size: 20px; color: white; }
.aideal-dev-ia-step-2 p { color: #A1A1AA; line-height: 1.6; max-width: 80%; }
.aideal-dev-ia-logo-loader { width: 60px; height: 60px; border-radius: 50%; border: 4px solid #6366F1; border-top-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Step 3: Report --- */
.aideal-dev-ia-report-content { flex-grow: 1; overflow-y: auto; padding-right: 10px; }
.aideal-dev-ia-report-actions { padding-top: 20px; }
.aideal-dev-ia-download-pdf {
    width: 100%;
    background: #6366F1; color: white; border: none;
    border-radius: 12px; padding: 15px; font-size: 16px;
    font-weight: bold; cursor: pointer; transition: background 0.2s;
}
.aideal-dev-ia-download-pdf:hover { background: #4F46E5; }

.report-section { margin-bottom: 25px; }
.report-section h3 { font-size:18px; color:white; margin-bottom:15px; padding-bottom:5px; border-bottom:1px solid rgba(255, 255, 255, 0.1); }
.report-section h5 { font-size: 14px; color: #A1A1AA; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.report-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.report-pill { background: #27272A; padding: 8px 12px; border-radius: 20px; font-size: 14px; }
.report-score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px; }
.report-score { text-align: center; background: #27272A; padding: 15px; border-radius: 12px; }
.report-score .score-value { font-size: 32px; font-weight: bold; color: white; }
.report-score span { font-size: 12px; color: #A1A1AA; }