/* Questions and Carousel Consolidated Styles */
/* Extracted from aprender.css and interactivo.css */

/* Recent Questions Card Styles */
.recent-questions-card {
    transition: all 0.2s ease;
    border-radius: 12px;
    overflow: hidden;
}

.recent-questions-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #28a745 !important;
}

/* Featured Questions Card Styles */
.featured-questions-card {
    transition: all 0.2s ease;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.featured-questions-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffc107, #ffeb3b, #ffc107);
    z-index: 1;
}

.featured-questions-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.3);
    border-color: #ffc107 !important;
}

.question-type-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-weight: 600;
}

.question-preview-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 4.2rem;
}

/* Question Status Indicator Styles */
.status-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0; /* Prevent shrinking in flex container */
}

.status-indicator.answered {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    animation: gentle-pulse-green 4s infinite;
}

.status-indicator.pending {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    animation: gentle-pulse-orange 4s infinite;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}

.status-text.answered {
    color: #059669;
}

.status-text.pending {
    color: #d97706;
}

@keyframes gentle-pulse-green {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
        transform: scale(1.02);
    }
}

@keyframes gentle-pulse-orange {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
        transform: scale(1.02);
    }
}

/* Questions Carousel for Mobile */
.questions-carousel-container {
    position: relative;
    overflow: hidden;
}

.questions-carousel {
    display: flex;
    transition: transform 0.3s ease;
}

.questions-carousel .carousel-slide {
    flex: 0 0 100%;
    min-width: 0;
    padding: 0 7.5px; /* Add padding instead of gap for spacing */
    box-sizing: border-box;
}

.carousel-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carousel-nav-button:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.05);
}

.carousel-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.95);
}

.carousel-nav-button.prev {
    left: -15px;
}

.carousel-nav-button.next {
    right: -15px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-indicator.active {
    background: #28a745;
    transform: scale(1.2);
}

/* Load More Button Styles */
.load-more-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    color: white;
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Topic Questions Card Styles - Main Container */
.topic-questions-card {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.topic-questions-card:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Topic Questions Header */
.topic-questions-card .topic-questions-header,
.card-header.topic-questions-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-bottom: none !important;
    padding: 20px;
}

.topic-questions-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
    padding: 20px;
}

.question-icon-container {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    overflow: hidden;
    margin-right: 15px;
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

/* Alternative styling for non-gradient headers */
.topic-questions-header .question-icon-container {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.question-icon-container svg {
    color: white;
    width: 22px;
    height: 22px;
}

/* Topic Questions Body */
.topic-questions-body {
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fc 0%, #ffffff 100%);
}

/* Question Options */
.question-option {
    background: white;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    padding: 20px;
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.question-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, transparent);
    transition: all 0.3s ease;
}

/* ExaBoti Option Styles */
.exaboti-option {
    border-color: #000035;
    background: linear-gradient(135deg, #e8e9f3 0%, #ffffff 100%);
}

.exaboti-option::before {
    background: linear-gradient(90deg, #000035, #000025);
}

.exaboti-option:hover {
    border-color: #000025;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 53, 0.15);
}

/* Professor Option Styles */
.professor-option {
    border-color: #28a745;
    background: linear-gradient(135deg, #e8f5e8 0%, #ffffff 100%);
}

.professor-option::before {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.professor-option:hover {
    border-color: #20c997;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.15);
}

/* Avatars */
.bot-avatar, .professor-avatar {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.bot-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.bot-emoji, .professor-emoji {
    font-size: 20px;
}

.professor-avatar img {
    width: 45px;
    height: 45px;
    object-fit: cover;
}

.professor-avatar {
    background: linear-gradient(135deg, #28a745, #20c997);
}

/* Form Elements */
.question-textarea {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
}

.question-textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.char-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 11px;
}

/* Buttons */
.btn-exaboti {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-exaboti:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    color: white;
}

.btn-professor {
    border: 2px solid #28a745;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #28a745;
}

.btn-professor:hover {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Button Styles - Moved from aprender.css for consistency */
.btn-outline-warning {
    border: 2px solid #ffc107;
    color: #856404;
    background: transparent;
}

.btn-outline-warning:hover {
    background: linear-gradient(135deg, #ffc107, #ffcd39);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
}

/* Badges */
.recommended-badge {
    position: absolute;
    top: 15px;
    right: 15px;
}

.recommended-badge .badge {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

/* Info Items */
.info-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

/* Quick Tips */
.quick-tips {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 10px;
    padding: 15px;
}

.tips-header {
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    padding-bottom: 8px;
}

/* Modal Styles */
.professor-question-modal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.professor-question-modal .modal-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
}

.professor-question-modal .form-floating textarea {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    min-height: 120px;
    transition: all 0.3s ease;
}

.professor-question-modal .form-floating textarea:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Success States */
.question-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading States */
.btn-loading .spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* ContentEditable Styles */
.form-control[contenteditable="true"] {
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 80px;
    padding: 1.75rem 0.75rem 0.5rem 0.75rem;
    line-height: 1.5;
    overflow-y: auto;
    cursor: text;
    background-color: #ffffff;
    border: 1px solid #ced4da;
}

/* Placeholder solo cuando está vacío y sin foco */
.form-control[contenteditable="true"]:empty:not(:focus):before {
    content: attr(data-placeholder);
    color: #6c757d;
    pointer-events: none;
    position: absolute;
    top: 1.75rem;
    left: 0.75rem;
    font-size: 1rem;
    opacity: 0.65;
}

/* Esconder placeholder cuando tiene foco o contenido */
.form-control[contenteditable="true"]:focus:before,
.form-control[contenteditable="true"]:not(:empty):before {
    display: none;
}

.form-control[contenteditable="true"]:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    background-color: #ffffff;
}

.question-textarea[contenteditable="true"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: #ffffff;
}

/* Floating label adjustments for contentEditable */
.form-floating > div[contenteditable="true"] ~ label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem 0.75rem;
    overflow: hidden;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: #6c757d;
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
}

.form-floating > div[contenteditable="true"]:focus ~ label,
.form-floating > div[contenteditable="true"]:not(:empty) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
    color: #0d6efd;
}

/* Ajustes específicos para el modal del profesor */
.professor-question-modal .form-floating div[contenteditable="true"] {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    min-height: 120px;
    transition: all 0.3s ease;
    padding: 1.75rem 0.75rem 0.5rem 0.75rem;
    background-color: #ffffff;
}

.professor-question-modal .form-floating div[contenteditable="true"]:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    background-color: #ffffff;
}

.professor-question-modal .form-floating div[contenteditable="true"] ~ label {
    color: #6c757d;
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
}

.professor-question-modal .form-floating div[contenteditable="true"]:focus ~ label {
    color: #28a745;
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
}

/* Additional Mobile Responsive Improvements */
@media (max-width: 768px) {
    /* Ajustar header de opciones para mobile */
    .question-option .option-header {
        margin-bottom: 15px !important;
    }

    .question-option .option-header .d-flex.justify-content-between {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .question-option .option-header .d-flex.align-items-center:first-child {
        flex: 1 !important;
        min-width: 0 !important;
    }

    /* Question options con mejor espaciado en mobile */
    .question-option {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }

    /* Avatar más pequeño en mobile */
    .bot-avatar, .professor-avatar {
        width: 35px !important;
        height: 35px !important;
    }

    .bot-emoji, .professor-emoji {
        font-size: 16px !important;
    }

    /* Textos más compactos */
    .question-option h6 {
        font-size: 0.95rem !important;
        margin-bottom: 0.25rem !important;
    }

    .question-option small {
        font-size: 0.75rem !important;
    }

    /* Badge recomendado ajustado para mobile */
    .recommended-badge {
        position: static !important;
        margin-top: 5px !important;
        text-align: center !important;
        width: 100% !important;
    }

    .recommended-badge .badge {
        font-size: 9px !important;
        padding: 3px 6px !important;
    }

    /* Ajustar el header para que el badge no se superponga */
    .question-option .option-header .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .question-option .option-header .d-flex.align-items-center:first-child {
        flex: none !important;
        width: 100% !important;
    }

    /* Form elements ajustados para mobile */
    .form-floating {
        margin-bottom: 1rem !important;
        position: relative !important;
    }

    .question-textarea {
        min-height: 100px !important;
        padding-bottom: 35px !important;
    }

    /* Mejorar posicionamiento del contador de caracteres */
    .char-counter {
        position: absolute !important;
        bottom: 8px !important;
        right: 12px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        font-size: 11px !important;
        z-index: 2 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    }

    /* Botones más compactos en mobile */
    .btn-exaboti, .btn-professor {
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
    }

    /* Botón ExaBoti ocupa todo el ancho en mobile */
    .exaboti-option .btn-exaboti {
        width: 100% !important;
        margin-top: 10px !important;
    }

    /* Ajustar layout del footer del formulario en mobile */
    .exaboti-option .d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .exaboti-option .question-features {
        text-align: center !important;
        order: 2 !important;
    }

    /* Quick tips más compactos */
    .quick-tips {
        padding: 12px !important;
        margin-top: 15px !important;
    }

    .tips-header {
        margin-bottom: 8px !important;
    }

    .tips-list small {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Estado "no logueado" mejorado para mobile */
    .topic-questions-card .card-body.text-center {
        padding: 30px 20px !important;
    }

    /* Título principal más legible en mobile */
    .card-body.text-center h5 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }

    .card-body.text-center p {
        font-size: 0.9rem !important;
        margin-bottom: 1.5rem !important;
        line-height: 1.4 !important;
    }

    /* Botones de login/registro en mobile */
    .card-body.text-center .d-flex {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .card-body.text-center .btn {
        width: 100% !important;
        padding: 12px !important;
        font-size: 0.9rem !important;
    }
}

/* Reglas específicas para pantallas muy pequeñas */
@media (max-width: 480px) {
    .topic-questions-header {
        padding: 12px !important;
    }

    .topic-questions-header .question-icon-container {
        width: 35px !important;
        height: 35px !important;
        margin-right: 10px !important;
    }

    .topic-questions-header .question-icon-container svg {
        width: 18px !important;
        height: 18px !important;
    }

    .topic-questions-header h5 {
        font-size: 1rem !important;
    }

    .topic-questions-header small {
        font-size: 0.75rem !important;
    }
}
