/*******************************************************************************
 * CAMPAMENTO IPUC - CSS RESPONSIVE MEJORADO
 * Estilos adicionales para dispositivos móviles
 *******************************************************************************/

/* ============ MEJORAS GENERALES RESPONSIVE ============ */

/* Asegurar que nada se desborde */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ============ TABS RESPONSIVE ============ */
.tabs-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

/* ============ TABLAS RESPONSIVE ============ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

/* ============ FORMULARIOS RESPONSIVE ============ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-control {
    width: 100%;
    min-height: 44px; /* Tamaño mínimo para touch */
    font-size: 16px; /* Evitar zoom en iOS */
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* ============ BOTONES RESPONSIVE ============ */
.btn {
    min-height: 44px;
    padding: 12px 20px;
    white-space: nowrap;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ============ MEDIA QUERIES ============ */

/* Tablets y pantallas medianas */
@media screen and (max-width: 992px) {
    .main-container {
        padding: 0 15px;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    .hero-banner {
        height: 220px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
}

/* Móviles */
@media screen and (max-width: 768px) {
    body {
        font-size: 15px;
    }
    
    .main-container {
        padding: 0 12px;
    }
    
    /* Hero Banner */
    .hero-banner {
        height: 180px;
        border-radius: 0 0 12px 12px;
    }
    
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    /* Tabs */
    .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding: 10px 5px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .tab-btn {
        flex: 0 0 auto;
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
        min-width: auto;
    }
    
    .tab-btn .tab-number {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    /* Cards */
    .card {
        border-radius: 12px;
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 15px;
    }
    
    .card-header h3 {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Formularios */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-group {
        margin-bottom: 0;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-control {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    textarea.form-control {
        min-height: 80px;
    }
    
    /* Fieldsets */
    fieldset {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 12px;
    }
    
    legend {
        font-size: 0.95rem;
        padding: 8px 15px;
    }
    
    /* Selector de participante */
    .participant-selector {
        flex-direction: column;
        gap: 12px;
    }
    
    .participant-option {
        padding: 20px;
        width: 100%;
    }
    
    .participant-option i {
        font-size: 2rem;
    }
    
    .participant-option h4 {
        font-size: 1.1rem;
    }
    
    /* Firmas */
    .signature-container {
        padding: 12px;
    }
    
    .signature-canvas {
        height: 140px;
        max-width: 100%;
        touch-action: none;
    }
    
    .signature-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .signature-actions .btn {
        width: 100%;
    }
    
    /* Botones */
    .btn {
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .btn-lg {
        padding: 14px 24px;
        font-size: 15px;
        width: 100%;
    }
    
    .text-center .btn-lg {
        max-width: 100%;
    }
    
    /* Alertas */
    .alert {
        padding: 12px 15px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    /* Métodos de pago */
    .payment-methods-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .payment-method-card {
        padding: 15px;
    }
    
    .payment-method-card .qr-image,
    .payment-method-card .qr-placeholder {
        width: 140px;
        height: 140px;
    }
    
    .payment-method-card h4 {
        font-size: 1rem;
    }
    
    .account-number {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    /* Tablas */
    .table-responsive {
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    table {
        font-size: 13px;
    }
    
    table th, table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* Verificación */
    .verification-box {
        padding: 15px;
    }
    
    .verification-result {
        padding: 15px;
    }
    
    /* Upload zones */
    .upload-zone {
        padding: 20px 15px;
        min-height: 120px;
    }
    
    .upload-zone i {
        font-size: 2rem;
    }
    
    .upload-zone h4 {
        font-size: 0.95rem;
    }
    
    /* Status badges */
    .status-badge {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    /* Checkbox términos */
    .form-group input[type="checkbox"] {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }
}

/* Móviles pequeños */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .main-container {
        padding: 0 10px;
    }
    
    .hero-banner {
        height: 200px;
    }
    
    .hero-title {
        font-size: 1.3rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
    
    .hero-icon {
        font-size: 1.8rem;
    }
    
    /* Tabs más compactos */
    .tab-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .tab-btn i {
        display: none;
    }
    
    /* Cards */
    .card {
        border-radius: 10px;
    }
    
    .card-header {
        padding: 12px;
    }
    
    .card-header h3 {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 12px;
    }
    
    /* Formularios */
    .form-label {
        font-size: 12px;
    }
    
    .form-label i {
        display: none;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    /* Fieldsets */
    fieldset {
        padding: 12px;
    }
    
    legend {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    legend i {
        margin-right: 5px;
    }
    
    /* Firmas */
    .signature-canvas {
        height: 120px;
    }
    
    /* Pagos */
    .payment-method-card .qr-image,
    .payment-method-card .qr-placeholder {
        width: 120px;
        height: 120px;
    }
    
    /* Tablas - modo card en móvil */
    table.mobile-cards {
        min-width: auto;
    }
    
    table.mobile-cards thead {
        display: none;
    }
    
    table.mobile-cards tbody tr {
        display: block;
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    table.mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #f1f5f9;
    }
    
    table.mobile-cards tbody td:last-child {
        border-bottom: none;
    }
    
    table.mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 12px;
    }
}

/* Landscape móvil */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .hero-banner {
        height: 140px;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .participant-selector {
        flex-direction: row;
    }
    
    .participant-option {
        width: auto;
        flex: 1;
    }
}

/* ============ ACCESIBILIDAD ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para accesibilidad */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============ MEJORAS TOUCH ============ */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivos táctiles */
    .btn:active {
        transform: scale(0.98);
    }
    
    .participant-option:active {
        transform: scale(0.98);
    }
    
    .tab-btn:active {
        transform: scale(0.97);
    }
    
    /* Aumentar área de toque */
    .form-control,
    .btn,
    select {
        min-height: 48px;
    }
}

/* ============ PRINT STYLES ============ */
@media print {
    .hero-banner,
    .tabs,
    .btn,
    .signature-actions {
        display: none !important;
    }
    
    body {
        background: white;
        font-size: 12pt;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* ============ ESTILOS ADICIONALES PARA PAGOS ============ */
.efectivo-card {
    border-color: #10b981 !important;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
}

.efectivo-card:hover {
    border-color: #059669 !important;
}

/* ============ TABLA DE PAGOS RESPONSIVE ============ */
.table-responsive-payments {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.payments-table th {
    background: #f8fafc;
    font-weight: 600;
    text-align: left;
    padding: 12px 10px;
    font-size: 13px;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.payments-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    vertical-align: middle;
}

.payments-table tr:hover {
    background: #f8fafc;
}

/* Mobile: Convertir tabla a cards */
@media screen and (max-width: 580px) {
    .table-responsive-payments {
        overflow-x: visible;
    }
    
    .payments-table {
        min-width: auto;
    }
    
    .payments-table thead {
        display: none;
    }
    
    .payments-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .payments-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        gap: 8px;
    }
    
    .payments-table tbody tr:hover {
        background: white;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
    
    .payments-table tbody td {
        display: flex;
        align-items: center;
        padding: 0;
        border: none;
        font-size: 14px;
    }
    
    .payments-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 11px;
        text-transform: uppercase;
        margin-right: 8px;
        letter-spacing: 0.5px;
    }
    
    /* Primera columna: Fecha - ocupa 50% */
    .payments-table tbody td:nth-child(1) {
        flex: 0 0 50%;
    }
    
    /* Segunda columna: Valor - ocupa 50% */
    .payments-table tbody td:nth-child(2) {
        flex: 0 0 50%;
        font-weight: 700;
        color: #059669;
    }
    
    /* Tercera columna: Método - ocultar en móvil pequeño */
    .payments-table tbody td:nth-child(3) {
        display: none;
    }
    
    /* Cuarta columna: Estado - ocupa 100% */
    .payments-table tbody td:nth-child(4) {
        flex: 0 0 100%;
        justify-content: flex-start;
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px dashed #e2e8f0;
    }
    
    .hide-mobile {
        display: none !important;
    }
}

/* Status badges mejorados */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.approved,
.status-badge.aprobado {
    background: #dcfce7;
    color: #166534;
}

.status-badge.pending,
.status-badge.pendiente {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.rejected,
.status-badge.rechazado {
    background: #fee2e2;
    color: #991b1b;
}

/* ============ CAMPO EDAD READONLY ============ */
.edad-readonly {
    background-color: #f3f4f6 !important;
    cursor: not-allowed !important;
    color: #374151 !important;
    font-weight: 600 !important;
}

.edad-readonly:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Error de edad para menores */
.error-message {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 6px;
    font-size: 13px;
}

/* Info message para pago en efectivo */
.info-message {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #eff6ff;
    border-radius: 6px;
    font-size: 13px;
}
