/* Crime Investigation Plugin Styles */

.crime-investigation-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Nuevo: Aviso para usuarios invitados */
.guest-notice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.guest-notice p {
    margin: 0;
    font-size: 1.1em;
}

.guest-notice a {
    color: #ffd93d;
    text-decoration: none;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.guest-notice a:hover {
    background-color: rgba(255, 217, 61, 0.2);
}

.case-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(30, 60, 114, 0.3);
}

.case-header h2 {
    margin: 0 0 15px 0;
    font-size: 2.5em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.case-header p {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    opacity: 0.9;
    line-height: 1.6;
}

/* Nuevo: Indicador de progreso de usuario */
.user-progress {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-indicator {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    display: inline-block;
    backdrop-filter: blur(10px);
}

.suspects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.suspect-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.suspect-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcf7f, #4d79ff);
    border-radius: 20px 20px 0 0;
}

.suspect-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.suspect-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 20px auto;
    display: block;
    border: 4px solid #f8f9fa;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.suspect-card h3 {
    text-align: center;
    margin: 0 0 15px 0;
    font-size: 1.8em;
    color: #2c3e50;
    font-weight: 600;
}

.suspect-card > p {
    text-align: center;
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 25px;
    font-style: italic;
}

.question-section {
    border-top: 2px solid #f1f3f4;
    padding-top: 20px;
}

.questions-used {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    border: 2px solid #e9ecef;
}

.questions-count {
    color: #007cba;
    font-size: 1.2em;
    font-weight: 700;
}

.question-form {
    margin-bottom: 25px;
}

.question-input {
    width: 100%;
    min-height: 80px;
    max-height: 120px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1em;
    resize: none;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1.5;
}

.question-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.question-input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.ask-question-btn {
    width: 100%;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ask-question-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87 0%, #003f5e 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.3);
}

.ask-question-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.answer-section {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #007cba #f1f3f4;
}

.answer-section::-webkit-scrollbar {
    width: 6px;
}

.answer-section::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.answer-section::-webkit-scrollbar-thumb {
    background: #007cba;
    border-radius: 3px;
}

.qa-pair {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #007cba;
}

.qa-timestamp {
    text-align: right;
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 10px;
    font-style: italic;
}

.question-display {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e1e5e9;
}

.question-display strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.answer-display {
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e1e5e9;
}

.answer-display strong {
    color: #d63384;
    display: block;
    margin-bottom: 10px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.answer-display p {
    margin: 0;
    line-height: 1.6;
    color: #495057;
    font-size: 1.05em;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px 40px;
    border-radius: 15px;
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .crime-investigation-container {
        padding: 15px;
    }
    
    .suspects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .case-header {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .case-header h2 {
        font-size: 2em;
    }
    
    .suspect-card {
        padding: 20px;
    }
    
    .suspect-avatar {
        width: 60px;
        height: 60px;
    }
    
    .guest-notice {
        padding: 12px 15px;
        font-size: 0.95em;
    }
}

/* Animaciones adicionales */
.suspect-card {
    animation: fadeInUp 0.6s ease-out;
}

.suspect-card:nth-child(1) { animation-delay: 0.1s; }
.suspect-card:nth-child(2) { animation-delay: 0.2s; }
.suspect-card:nth-child(3) { animation-delay: 0.3s; }
.suspect-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qa-pair {
    animation: slideInLeft 0.5s ease-out;
}

/* Sección de Resolución del Caso */
.case-solution-section {
    margin-top: 50px;
    padding: 30px;
    background: linear-gradient(135deg, #1a1a3a 0%, #2d2d5f 100%);
    border-radius: 20px;
    border: 2px solid #4a4a8a;
    position: relative;
    overflow: hidden;
}

.case-solution-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b, #d97706);
}

.solution-header {
    text-align: center;
    margin-bottom: 30px;
}

.solution-header h2 {
    color: #fbbf24;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.solution-header p {
    color: #c5c5ed;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.attempts-counter {
    background: rgba(251, 191, 36, 0.1);
    border: 2px solid rgba(251, 191, 36, 0.3);
    padding: 12px 20px;
    border-radius: 12px;
    display: inline-block;
    color: #fbbf24;
    font-weight: 600;
}

.attempts-used {
    font-size: 1.2em;
    font-weight: 700;
}

.solution-form {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.solution-fields {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    color: #fbbf24;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.field-group input,
.field-group textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    color: white;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: inherit;
}

.field-group input:focus,
.field-group textarea:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.field-group input::placeholder,
.field-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.submit-solution-btn {
    width: 100%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a1a3a;
    border: none;
    padding: 18px 30px;
    border-radius: 15px;
    font-size: 1.3em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
}

.submit-solution-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(251, 191, 36, 0.4);
}

.submit-solution-btn:disabled {
    background: #666;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Respuestas de Solución */
.solution-responses {
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #fbbf24 rgba(255,255,255,0.1);
}

.solution-responses::-webkit-scrollbar {
    width: 8px;
}

.solution-responses::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.solution-responses::-webkit-scrollbar-thumb {
    background: #fbbf24;
    border-radius: 4px;
}

.solution-attempt {
    margin-bottom: 25px;
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid #fbbf24;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.solution-attempt.correct {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.solution-attempt.incorrect {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.attempt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.attempt-number {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.attempt-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.attempt-status.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.attempt-status.partial {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.ai-response {
    color: #e1e1f9;
}

.ai-response strong {
    color: #fbbf24;
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.ai-response p {
    line-height: 1.6;
    margin: 0;
}

/* Animación de éxito */
.success-animation {
    animation: successPulse 3s ease-in-out;
}

@keyframes successPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 0 40px 10px rgba(16, 185, 129, 0.2);
    }
}

/* Nuevos estilos para estados de persistencia */
.user-status-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85em;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-status-indicator.logged-in {
    background: rgba(16, 185, 129, 0.9);
}

.user-status-indicator.guest {
    background: rgba(245, 158, 11, 0.9);
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) {
    .suspect-card:hover {
        transform: none;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    }
    
    .ask-question-btn:hover:not(:disabled) {
        transform: none;
        box-shadow: 0 4px 15px rgba(0, 124, 186, 0.2);
    }
    
    .submit-solution-btn:hover:not(:disabled) {
        transform: none;
        box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3);
    }
}

/* Estilos para notificaciones de migración */
.migration-notice {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    animation: slideInDown 0.5s ease-out;
}

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

.migration-notice .icon {
    font-size: 1.5em;
    margin-right: 10px;
}

/* Responsive para soluciones */
@media (max-width: 768px) {
    .case-solution-section {
        padding: 20px;
        margin-top: 30px;
    }
    
    .solution-header h2 {
        font-size: 2em;
    }
    
    .solution-form {
        padding: 20px;
    }
    
    .submit-solution-btn {
        padding: 15px 20px;
        font-size: 1.1em;
    }
    
    .attempt-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-status-indicator {
        bottom: 10px;
        right: 10px;
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

/* Tema oscuro mejorado */
@media (prefers-color-scheme: dark) {
    .suspect-card {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .suspect-card h3 {
        color: #ecf0f1;
    }
    
    .question-input {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .question-input::placeholder {
        color: #95a5a6;
    }
    
    .qa-pair {
        background: #34495e;
    }
    
    .question-display,
    .answer-display {
        background: #2c3e50;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .guest-notice {
        background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
    }
    
    .loading-spinner {
        background: #2c3e50;
        color: #ecf0f1;
    }
}

/* Estilos adicionales para admin */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    border-left: 4px solid #007cba;
}

.stat-card h3 {
    margin: 0;
    color: #007cba;
    font-size: 1.2em;
}

.stat-card .stat-number {
    font-size: 2.5em;
    margin: 10px 0;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card .stat-description {
    font-size: 0.9em;
    color: #666;
    margin: 0;
}

/* Indicadores de estado mejorados */
.questions-used.limit-reached {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

.attempts-counter.limit-reached {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
}

/* Efectos de transición suaves */
.crime-investigation-container * {
    transition: all 0.3s ease;
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    .success-animation {
        animation: none;
    }
}

/* Focus states mejorados para navegación por teclado */
.ask-question-btn:focus,
.submit-solution-btn:focus,
.question-input:focus,
.field-group input:focus,
.field-group textarea:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Estados de carga específicos */
.ask-question-btn.loading {
    position: relative;
    color: transparent;
}

.ask-question-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Mejoras para pantallas muy pequeñas */
@media (max-width: 480px) {
    .case-header h2 {
        font-size: 1.8em;
    }
    
    .solution-header h2 {
        font-size: 1.8em;
    }
    
    .suspect-card {
        padding: 15px;
    }
    
    .suspect-avatar {
        width: 50px;
        height: 50px;
    }
    
    .guest-notice {
        margin: 10px;
        padding: 10px;
        font-size: 0.9em;
    }
}

/* Animaciones de entrada para elementos dinámicos */
.qa-pair.new-entry {
    animation: slideInUp 0.5s ease-out;
}

.solution-attempt.new-entry {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}