/**
 * MCB Course Requests - Frontend Styles
 * @version 1.7.0
 */

/* =========================
   Formulario
   ========================= */

.mcbcr-form {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.mcbcr-form .form-floating > label {
    opacity: 0.8;
}

.mcbcr-form .form-control:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.1);
}

/* Mensajes */
.mcbcr-msg {
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.mcbcr-msg:empty {
    display: none;
}

/* =========================
   Leaderboard
   ========================= */

.mcbcr-board {
    position: relative;
}

.mcbcr-board .table {
    margin-bottom: 0;
}

.mcbcr-board thead th {
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.mcbcr-board tbody tr {
    transition: background-color 0.2s ease;
}

.mcbcr-board tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Badge */
.mcbcr-board .badge {
    font-weight: 800;
    font-size: 0.7rem;
    padding: 0.35em 0.65em;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Botón de voto */
.mcbcr-vote {
    transition: all 0.3s ease;
    min-width: 80px;
}

.mcbcr-vote:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.mcbcr-vote.voted {
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

.mcbcr-vote:disabled {
    cursor: not-allowed;
}

/* Columna de acciones */
.mcbcr-actions {
    min-width: 160px;
}

/* Título del curso */
.mcbcr-title-wrap {
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mcbcr-title {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcbcr-title a {
    transition: color 0.2s ease;
}

.mcbcr-title a:hover {
    color: #ffc107 !important;
}

/* Fila vacía */
.mcbcr-empty {
    font-style: italic;
    opacity: 0.7;
}

/* =========================
   Paginación
   ========================= */

.mcbcr-pager {
    padding: 1rem 0;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mcbcr-pager button {
    transition: all 0.3s ease;
}

.mcbcr-pager button:not(:disabled):hover {
    transform: translateX(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.mcbcr-pager .mcbcr-prev:not(:disabled):hover {
    transform: translateX(-3px);
}

.mcbcr-pager .mcbcr-next:not(:disabled):hover {
    transform: translateX(3px);
}

.mcbcr-page {
    font-weight: 600;
    opacity: 0.9;
}

/* =========================
   Búsqueda
   ========================= */

#mcbcr-search {
    max-width: 300px;
    transition: all 0.3s ease;
}

#mcbcr-search:focus {
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =========================
   Tooltips
   ========================= */

.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    max-width: 250px;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 768px) {
    .mcbcr-form {
        padding: 0.75rem;
    }
    
    .mcbcr-title {
        max-width: 260px;
    }
    
    .mcbcr-pager {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .mcbcr-pager button {
        flex: 1 1 auto;
    }
    
    #mcbcr-search {
        max-width: 100%;
    }
    
    #mcbcr-search:focus {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .mcbcr-board .text-truncate {
        max-width: 220px;
    }
    
    .mcbcr-title {
        max-width: 200px;
    }
    
    .mcbcr-form .btn {
        width: 100%;
    }
    
    .mcbcr-actions {
        min-width: 100px;
    }
    
    .mcbcr-vote {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* =========================
   Estados de Carga
   ========================= */

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

.mcbcr-loading::after {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* =========================
   Accesibilidad
   ========================= */

.mcbcr-form :focus-visible,
.mcbcr-board :focus-visible {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* Reducir movimiento para usuarios con preferencias */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .mcbcr-form,
    .mcbcr-board {
        border-width: 2px;
    }
    
    .mcbcr-vote,
    .mcbcr-pager button {
        border-width: 2px;
    }
}