:root {
    --bg-main: #0c0f16;
    --bg-card: rgba(22, 28, 41, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-blue: #0052d4;
    --accent-cyan: #00f2ff;
    --accent-purple: #9d4edd;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at top right, #151b2a, var(--bg-main) 70%);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    line-height: 1.5;
}

.app-wrapper {
    width: 100%;
    max-width: 1600px;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.view-container {
    width: 100%;
    max-width: 580px; /* Ancho optimizado para móviles/formularios */
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.5s ease-out;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

/* --- ESTILOS VISTA PARTICIPANTE (FORMULARIO) --- */
.form-header {
    text-align: center;
    margin-top: 10px;
}

.unl-tag {
    display: inline-block;
    background: rgba(0, 242, 255, 0.15);
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.form-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.form-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13.5px;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.2px;
}

select, input[type="text"], input[type="password"], textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    transition: var(--transition);
    width: 100%;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

select:focus, input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.15);
    background: rgba(15, 23, 42, 0.85);
}

.input-otro-wrapper {
    margin-top: 8px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Botones */
.btn {
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 82, 212, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-purple) 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Mensaje de Éxito */
.success-box {
    background: var(--bg-card);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.success-icon {
    font-size: 50px;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.success-box h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

.success-box p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* --- ESTILOS VISTA FACILITADOR (DASHBOARD) --- */
.dashboard-layout {
    max-width: 100%; /* El dashboard usa todo el ancho de la pantalla */
    display: grid;
    grid-template-columns: 1fr 340px; /* Espacio para el panel lateral de respuestas */
    gap: 24px;
}

.dashboard-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 8px;
}

.unl-badge-mini {
    display: inline-block;
    color: var(--accent-cyan);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.dashboard-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.timer-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.timer-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.timer-value {
    font-family: monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

.control-actions {
    display: flex;
    gap: 10px;
}

/* Grid de Tarjetas del Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.chart-panel-card, .wordcloud-panel-card, .ai-summary-panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.chart-panel-card h3, .wordcloud-panel-card h3, .ai-summary-panel-card h3 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #f1f5f9;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 200px;
}

/* Nube de palabras */
.span-2 {
    grid-column: span 2;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 12px;
}

.wordcloud-container {
    background: rgba(15, 23, 42, 0.3);
    border-radius: var(--radius-md);
    width: 100%;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px dashed rgba(255, 255, 255, 0.05);
}

#word-cloud-canvas {
    width: 100%;
    height: 100%;
}

.cloud-empty {
    position: absolute;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    pointer-events: none;
}

/* Panel de Resumen de Gemini */
.ai-summary-panel-card {
    grid-column: 3;
    display: flex;
    flex-direction: column;
}

.gemini-badge {
    font-size: 9px;
    font-weight: 800;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.15) 0%, rgba(157, 78, 221, 0.15) 100%);
    color: var(--accent-cyan);
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 242, 255, 0.15);
}

.ai-summary-content {
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-md);
    padding: 16px;
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 13px;
    line-height: 1.6;
    max-height: 320px;
}

.ai-state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    color: var(--text-muted);
    padding: 20px;
}

.empty-text {
    font-style: italic;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-output-box h3 {
    font-size: 14px;
    margin-top: 12px;
    margin-bottom: 6px;
    color: var(--accent-cyan);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.ai-output-box h3:first-of-type {
    margin-top: 0;
}

.ai-output-box p {
    margin-bottom: 8px;
}

.ai-output-box ul {
    margin-left: 16px;
    margin-bottom: 12px;
}

.ai-output-box li {
    margin-bottom: 4px;
}

.ai-output-box blockquote {
    background: rgba(0, 242, 255, 0.04);
    border-left: 3px solid var(--accent-cyan);
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 12px;
    font-style: italic;
}

/* Panel Lateral de Entradas Recientes */
.submissions-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    height: calc(100vh - 120px);
    max-height: 590px;
    overflow: hidden;
}

.submissions-panel h3 {
    font-size: 15px;
    font-weight: 700;
}

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
}

.sub-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: slideDown 0.3s ease-out;
}

.sub-header-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-cyan);
}

.sub-role {
    color: var(--text-muted);
}

.sub-origin {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 8px;
    color: var(--text-main);
}

.sub-idea {
    font-size: 12.5px;
    color: var(--text-main);
    line-height: 1.4;
    word-break: break-word;
}

/* --- MODAL CONFIGURACION API --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-box {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 480px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.modal-box h2 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.modal-box p {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* --- RESPONSIVIDAD GENERAL --- */
@media (max-width: 1100px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .submissions-panel {
        height: 400px;
        max-height: none;
    }
}

@media (max-width: 820px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .span-2 {
        grid-column: span 1;
    }
    .ai-summary-panel-card {
        grid-column: 1;
    }
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .dashboard-controls {
        width: 100%;
        justify-content: space-between;
    }
}
