/* ==========================================
   ESTILOS MODERNOS Y RESPONSIVE
   Sistema de Inscripciones Bádminton Perú
   ========================================== */

/* Variables de colores */
:root {
    --color-primary: #E31837;
    --color-primary-dark: #c01530;
    --color-secondary: #2c3e50;
    --color-dark: #1a1a1a;
    --color-gray: #6c757d;
    --color-gray-light: #f8f9fa;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* Reset y estilos base */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-dark);
    line-height: 1.6;
}

/* Header mejorado */
.header {
    background: linear-gradient(135deg, var(--color-white) 0%, var(--color-gray-light) 100%);
    box-shadow: var(--shadow-md);
    padding: 15px 0 !important;
}

.header h5 {
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.header img {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

/* Botones modernos */
.btn {
    border-radius: var(--border-radius);
    font-weight: 600;
    padding: 10px 20px;
    transition: var(--transition);
    border: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-white);
}

.btn-secondary:hover {
    background-color: #1a2634;
    transform: translateY(-2px);
}

.btn-outline-dark {
    border: 2px solid var(--color-dark);
    color: var(--color-dark);
    background: transparent;
}

.btn-outline-dark:hover {
    background-color: var(--color-dark);
    color: var(--color-white);
    transform: translateY(-2px);
}

/* Alertas mejoradas */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    padding: 15px 20px;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    color: #856404;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

/* Navegación con tabs */
.nav-tabs {
    border-bottom: 3px solid var(--color-gray-light);
    margin-bottom: 0;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--color-gray);
    font-weight: 600;
    padding: 12px 25px;
    transition: var(--transition);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.nav-tabs .nav-link:hover {
    color: var(--color-primary);
    background-color: var(--color-gray-light);
}

.nav-tabs .nav-link.active {
    color: var(--color-primary);
    background-color: var(--color-white);
    border-bottom: 3px solid var(--color-primary);
    font-weight: 700;
}

/* Títulos mejorados */
h3 {
    color: var(--color-dark);
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

h3.border-bottom::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 2px;
}

/* Tablas mejoradas */
.table {
    background: var(--color-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background: linear-gradient(135deg, var(--color-secondary) 0%, #34495e 100%);
    color: var(--color-white);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 15px 10px;
    border: none;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--color-gray-light);
    transform: scale(1.01);
}

.table tbody td {
    vertical-align: middle;
    padding: 12px 10px;
}

/* Tarjetas de deportistas */
.bp_sportman, .bp-team {
    position: relative;
    float: left;
    border: 2px solid var(--color-gray-light);
    border-radius: var(--border-radius);
    padding: 15px;
    background: var(--color-white);
    margin: 0 15px 15px 0;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    max-width: 280px;
    height: auto;
    min-height: 110px;
}

.bp-team {
    height: auto;
    min-height: 220px;
    cursor: default;
    max-width: 360px;
}

.bp_sportman:hover {
    border-color: var(--color-primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.bp_sportman .photo {
    height: 70px;
    width: 60px;
    border-radius: var(--border-radius);
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.active_sportman {
    background: linear-gradient(135deg, var(--color-secondary) 0%, #34495e 100%);
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(227, 24, 55, 0.3);
}

/* Indicadores de estado */
.bp_active {
    display: inline-block;
    height: 16px;
    width: 16px;
    border: 2px solid var(--color-white);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.active_sp {
    background-color: var(--color-success);
}

.inactive_sp {
    background-color: #dc3545;
}

/* Filtro alfabético */
.filter_abcd {
    margin: 10px 5px;
    border-bottom: 2px solid var(--color-gray-light);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.filter_abcd ul {
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: nowrap;
}

.filter_abcd ul li {
    list-style: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--color-gray);
    font-weight: 600;
    transition: var(--transition);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.filter_abcd ul li:hover,
.filter_abcd ul li.active {
    background: var(--color-primary);
    color: var(--color-white);
}

/* Bloques de búsqueda */
#block-search {
    background: var(--color-gray-light);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
}

#block-search select,
#block-search input {
    border: 2px solid var(--color-gray-light);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

#block-search select:focus,
#block-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.1);
}

/* Área de resultados */
#block-result {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    border-radius: var(--border-radius);
    background: var(--color-white);
}

.block_base {
    margin: 0 5px;
    text-align: center;
    height: 300px;
    border: 3px dashed var(--color-gray-light);
    color: var(--color-gray);
    background: var(--color-gray-light);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Controles de equipo */
.new-team-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 0;
    background: var(--color-white);
    border-top: 3px solid var(--color-primary);
    z-index: 1000;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
}

/* Iconos */
.info-icon {
    background-image: url("../img/info-icon.png");
    background-repeat: no-repeat;
    background-size: 22px;
    height: 22px;
    width: 22px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

/* Formularios */
.form-control {
    border: 2px solid var(--color-gray-light);
    border-radius: var(--border-radius);
    padding: 10px 15px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.1);
}

/* ==========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ========================================== */

/* Móviles pequeños (hasta 576px) */
@media (max-width: 576px) {
    .header h5 {
        font-size: 0.95rem;
    }
    
    .header .col-5 {
        flex: 0 0 100%;
        max-width: 100%;
        text-align: center !important;
        margin-top: 10px;
    }
    
    .btn {
        font-size: 0.75rem;
        padding: 8px 15px;
        width: 100%;
        margin-bottom: 10px;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    .bp_sportman, .bp-team {
        max-width: 100%;
        margin: 0 0 15px 0;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.8rem;
        padding: 10px 12px;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th {
        font-size: 0.75rem;
        padding: 10px 5px;
    }
    
    .table tbody td {
        padding: 8px 5px;
    }
    
    #block-search .row > div {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
    
    #block-search select,
    #block-search input {
        width: 100% !important;
    }
    
    .filter_abcd {
        overflow-x: scroll;
    }
    
    .filter_abcd ul li {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    #block-result {
        padding: 10px;
        max-height: 400px;
    }
}

/* Tablets (576px a 768px) */
@media (min-width: 577px) and (max-width: 768px) {
    .bp_sportman {
        max-width: calc(50% - 15px);
    }
    
    .bp-team {
        max-width: 100%;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    #block-search .row > div {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 10px;
    }
}

/* Tablets grandes y laptops (768px a 992px) */
@media (min-width: 769px) and (max-width: 992px) {
    .bp_sportman {
        max-width: calc(33.33% - 15px);
    }
    
    .bp-team {
        max-width: calc(50% - 15px);
    }
}

/* Desktops (más de 992px) */
@media (min-width: 993px) {
    .bp_sportman:nth-child(4n+4) {
        margin-right: 0;
    }
    
    .bp-team:nth-child(3n+3) {
        margin-right: 0;
    }
}

/* Utilidades responsive */
.d-mobile-none {
    display: none;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block;
    }
}

/* Animaciones sutiles */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bp_sportman,
.bp-team,
.table tbody tr {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar personalizado (solo Chrome/Safari) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* Estados de carga */
.wait_result {
    background: url('../img/loading.gif');
    background-position: center center;
    background-repeat: no-repeat;
    min-height: 200px;
}

/* Print styles */
@media print {
    .d-print-none,
    .btn,
    .nav-tabs,
    #block-search,
    .filter_abcd {
        display: none !important;
    }
    
    .table {
        box-shadow: none;
    }
}

/* SOLUCIÓN AGRESIVA PARA SELECTS */
select#idmodalidad,
select#idcategoria,
select#register,
select#clubes,
select#idmodalidad_x,
select#idcategoria_x {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    font-size: 14px !important;
    padding: 8px 35px 8px 12px !important;
    height: auto !important;
    line-height: normal !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: normal !important;
}

/* Mejorar visibilidad de inputs en formulario de deportista */
.form-control {
    border: 2px solid #d1d5db !important;
    border-radius: 6px !important;
    background-color: #ffffff !important;
    transition: all 0.3s ease !important;
}

.form-control:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.1) !important;
    outline: none !important;
}

.form-control::placeholder {
    color: #9ca3af !important;
}

/* Específicamente para los inputs de texto */
input[type="text"].form-control,
input[type="email"].form-control,
input[type="tel"].form-control,
input[type="date"].form-control,
input[type="number"].form-control {
    border: 2px solid #d1d5db !important;
    padding: 10px 15px !important;
}

/* Para los selects también */
select.form-control {
    border: 2px solid #d1d5db !important;
    background-color: #ffffff !important;
}

/* Tabla de deportistas responsive */
@media (max-width: 768px) {
    #block-deportistas-lista {
        font-size: 0.85rem;
    }
    
    /* Hacer la tabla scrolleable horizontalmente en móviles */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ajustar padding de celdas en móvil */
    #block-deportistas-lista td,
    #block-deportistas-lista th {
        padding: 8px 5px !important;
        white-space: nowrap;
    }
    
    /* Reducir ancho de columnas en móvil */
    #block-deportistas-lista th:first-child,
    #block-deportistas-lista td:first-child {
        width: 50px;
    }
}

/* Fix para selects de deportistas */
select#select_deportista1,
select#select_deportista2 {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    font-size: 14px !important;
    padding: 8px 35px 8px 12px !important;
    height: auto !important;
    line-height: normal !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word !important;
}

select#select_deportista1 option,
select#select_deportista2 option {
    white-space: normal !important;
    word-wrap: break-word !important;
    padding: 8px !important;
}
