/* ============================================
   SIMULACROS - ESTILOS ESPECÍFICOS
   ============================================ */

/* Reordenar secciones: Perfiles primero, Instrucciones segundo */
.main-content .container {
    display: flex;
    flex-direction: column;
}

.profiles-section.profiles-moved-top {
    order: 1;
}

.instructions-section {
    order: 2;
}

/* Hero Section Simulacros */
.hero-simulacros {
    background: linear-gradient(135deg, #FFB84D 0%, #FF9500 100%);
    position: relative;
}

.crown-icon {
    font-size: 4rem;
    animation: bounce 2s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ============================================
   SECCIÓN DE INSTRUCCIONES
   ============================================ */
.instructions-section {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.instructions-header {
    text-align: center;
    margin-bottom: 2rem;
}

.instructions-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.instructions-header h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Grid de Instrucciones Rápidas */
.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.instruction-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

/* Centrar la última tarjeta de instrucciones si queda sola */
.instructions-grid .instruction-card:last-child:nth-child(4) {
    grid-column: 1 / -1;
    max-width: 300px;
    margin: 0 auto;
}

.instruction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.instruction-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.instruction-icon i {
    font-size: 2rem;
    color: white;
}

.instruction-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.instruction-card p {
    font-size: 1rem;
    color: var(--text-light);
}

/* ============================================
   ESTRUCTURA DEL EXAMEN
   ============================================ */
.exam-structure {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.structure-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 2rem;
}

.structure-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.structure-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.structure-block {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.structure-block .block-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.block-header {
    padding: 1.5rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.psico-color {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
}

.conocimientos-color {
    background: linear-gradient(135deg, #5CB85C 0%, #449D44 100%);
}

.block-header h4 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.block-percentage {
    background: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

.block-content {
    padding: 1.5rem;
}

.block-item {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.block-scoring {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.scoring-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.scoring-item.correct {
    background: rgba(92, 184, 92, 0.1);
    border: 2px solid #5CB85C;
}

.scoring-item.correct i {
    color: #5CB85C;
    font-size: 1.2rem;
}

.scoring-item.incorrect {
    background: rgba(217, 83, 79, 0.1);
    border: 2px solid #d9534f;
}

.scoring-item.incorrect i {
    color: #d9534f;
    font-size: 1.2rem;
}

.total-scoring {
    background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.2rem;
}

.total-scoring i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* ============================================
   CRITERIOS DE APROBACIÓN
   ============================================ */
.approval-criteria {
    background: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%);
    border: 3px solid #5CB85C;
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
}

.criteria-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.criteria-header i {
    font-size: 2.5rem;
    color: #5CB85C;
}

.criteria-header h4 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--text-dark);
    margin: 0;
}

.criteria-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
}

.criteria-intro {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.criteria-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.criteria-item {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.criteria-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #5CB85C 0%, #449D44 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.criteria-text {
    flex: 1;
}

.criteria-text strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.criteria-text ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.criteria-text ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-light);
    font-size: 1rem;
}

.criteria-text ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #5CB85C;
    font-weight: bold;
}

.approval-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Centrar el tercer ejemplo (último suspendido) cuando queda solo */
.approval-examples .example-box:nth-child(3) {
    grid-column: 1 / -1;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.example-box {
    border-radius: 12px;
    padding: 1.5rem;
    border: 3px solid;
}

.example-box.approved {
    background: linear-gradient(135deg, #d4edda 0%, #ffffff 100%);
    border-color: #28a745;
}

.example-box.failed {
    background: linear-gradient(135deg, #f8d7da 0%, #ffffff 100%);
    border-color: #dc3545;
}

.example-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid currentColor;
}

.example-box.approved .example-header {
    color: #28a745;
}

.example-box.failed .example-header {
    color: #dc3545;
}

.example-header i {
    font-size: 1.5rem;
}

.example-header strong {
    font-size: 1rem;
    font-family: var(--font-heading);
}

.example-box ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.example-box ul li {
    padding: 0.4rem 0;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.example-result {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.5;
}

/* ============================================
   NORMAS IMPORTANTES
   ============================================ */
.important-rules {
    background: linear-gradient(135deg, #FFF9F0 0%, #ffffff 100%);
    border: 3px solid var(--primary-color);
    border-radius: 15px;
    padding: 2rem;
}

.rules-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.rules-header i {
    font-size: 2rem;
    color: var(--primary-color);
}

.rules-header h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--text-dark);
    margin: 0;
}

.rules-list {
    list-style: none;
    padding: 0;
}

.rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    font-size: 1.05rem;
    line-height: 1.6;
}

.rules-list li i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* ============================================
   SECCIÓN DE PERFILES
   ============================================ */
.profiles-section {
    margin-top: 3rem;
}

.profiles-section.profiles-moved-top {
    margin-bottom: 5rem;
}

.profiles-header {
    text-align: center;
    margin-bottom: 3rem;
}

.profiles-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.profiles-header h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.profiles-header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Primera fila: 3 tarjetas (Factor Circulación, Oficial Admin, Factor Entrada) */
.profiles-grid .profile-card:nth-child(1) {
    grid-column: 1 / 3;  /* Factor de Circulación: columnas 1-2 */
}

.profiles-grid .profile-card:nth-child(2) {
    grid-column: 3 / 5;  /* Oficial Administrativo: columnas 3-4 */
}

.profiles-grid .profile-card:nth-child(3) {
    grid-column: 5 / 7;  /* Factor de Entrada: columnas 5-6 */
}

/* Segunda fila: 2 tarjetas centradas (Montador, Ayudante) */
.profiles-grid .profile-card:nth-child(4) {
    grid-column: 2 / 4;  /* Montador Eléctrico: columnas 2-3 (centrado entre 1-2 y 3-4) */
}

.profiles-grid .profile-card:nth-child(5) {
    grid-column: 4 / 6;  /* Ayudante Ferroviario: columnas 4-5 (centrado entre 3-4 y 5-6) */
}

/* ============================================
   TARJETAS DE PERFIL
   ============================================ */
.profile-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-icon i {
    font-size: 2.5rem;
    color: white;
}

.profile-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.3;
}

.profile-info {
    margin-bottom: 1.5rem;
}

.profile-description {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.profile-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.stat-item i {
    color: var(--primary-color);
}

.profile-toggle-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.profile-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 184, 77, 0.4);
}

.profile-toggle-btn i {
    transition: transform 0.3s ease;
}

.profile-toggle-btn.active i {
    transform: rotate(180deg);
}

/* ============================================
   LISTA DE SIMULACROS (DESPLEGABLE)
   ============================================ */
.simulacros-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    margin-top: 0;
}

.simulacros-list.active {
    max-height: 1000px;
    margin-top: 1.5rem;
}

.simulacro-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.simulacro-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.simulacro-item:last-child {
    margin-bottom: 0;
}

.simulacro-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.simulacro-info p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
}

.difficulty-badge.low {
    background: #d4edda;
    color: #155724;
}

.difficulty-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-badge.high {
    background: #f8d7da;
    color: #721c24;
}

.start-simulacro-btn {
    background: linear-gradient(135deg, #5CB85C 0%, #449D44 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.start-simulacro-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(92, 184, 92, 0.4);
}

.start-simulacro-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   MODAL DE CONFIRMACIÓN
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    background: linear-gradient(135deg, #FFB84D 0%, #FF9500 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

.modal-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin: 0;
}

.modal-body {
    padding: 2rem;
}

.modal-title {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.modal-warnings {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.warning-item:last-child {
    border-bottom: none;
}

.warning-item i {
    color: #d9534f;
    font-size: 1.3rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.warning-item p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-question {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.modal-footer {
    padding: 1.5rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cancel-btn {
    background: #e9ecef;
    color: var(--text-dark);
}

.cancel-btn:hover {
    background: #dee2e6;
    transform: translateY(-2px);
}

.confirm-btn {
    background: linear-gradient(135deg, #5CB85C 0%, #449D44 100%);
    color: white;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(92, 184, 92, 0.4);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablets y pantallas medianas */
@media (max-width: 1200px) {
    .profiles-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 900px;
    }
    
    .profiles-grid .profile-card {
        grid-column: auto !important;
    }
    
    /* Centrar el quinto elemento en tablets */
    .profiles-grid .profile-card:nth-child(5) {
        grid-column: 1 / -1 !important;
        max-width: 450px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .instructions-section {
        padding: 2rem 1.5rem;
    }

    .instructions-grid {
        grid-template-columns: 1fr;
    }

    .structure-blocks {
        grid-template-columns: 1fr;
    }

    .profiles-grid {
        grid-template-columns: 1fr !important;
    }
    
    .profiles-grid .profile-card {
        grid-column: auto !important;
    }

    .simulacro-item {
        flex-direction: column;
        align-items: stretch;
    }

    .start-simulacro-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        width: 95%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
        justify-content: center;
    }

    .approval-examples {
        grid-template-columns: 1fr;
    }

    .criteria-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .criteria-text ul li {
        padding-left: 0;
        text-align: left;
    }

    .criteria-text ul li::before {
        position: static;
        margin-right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .instructions-header h2 {
        font-size: 2rem;
    }

    .profiles-header h2 {
        font-size: 2rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-title {
        font-size: 1.3rem;
    }
}
