/* Estilos básicos del sistema QR simplificado */
.qr-system-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.qr-header {
    background: linear-gradient(135deg, #bf360c, #e65100);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #e65100;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    margin: 5px;
    text-align: center;
}

.btn:hover {
    background: #bf360c;
}

.btn i.dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 14px;
}

.btn-sm i.dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.btn-danger {
    background: #f44336;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-info {
    background: #2196f3;
}

.btn-info:hover {
    background: #1976d2;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success { 
    background: #e8f5e9; 
    border-left: 4px solid #4caf50; 
}

.alert-danger { 
    background: #ffebee; 
    border-left: 4px solid #f44336; 
}

#qr-reader {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border: 2px solid #e65100;
    border-radius: 10px;
    overflow: hidden;
}

.loading-spinner {
    text-align: center;
    padding: 20px;
}

.table-responsive {
    overflow-x: auto;
    margin: 20px 0;
}

.qr-table {
    width: 100%;
    border-collapse: collapse;
}

.qr-table th, .qr-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

.qr-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.access-denied {
    text-align: center;
    padding: 40px;
    font-weight: bold;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}

/* Mapa simplificado visual */
.simple-map-container {
    width: 100%;
    height: 300px;
    background: #f0f0f0;
    border-radius: 8px;
    border: 2px solid #ddd;
    position: relative;
    overflow: hidden;
    margin: 15px 0;
}

.map-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0,0,0,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.map-marker {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #e65100;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}

.map-marker::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid #e65100;
}

.map-route-line {
    position: absolute;
    height: 4px;
    background: #4caf50;
    transform-origin: 0 0;
}

/* Responsive */
@media (max-width: 768px) {
    .qr-system-container {
        padding: 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    #qr-reader {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
}

/* NUEVOS ESTILOS PARA TABLAS MEJORADAS */
.scan-qr-popup-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    margin: 10px 5px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scan-qr-popup-btn:hover {
    background: #388e3c;
    transform: translateY(-2px);
}

.popup-scanner {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.success-popup {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 10px;
    margin: 20px 0;
}

.success-popup i {
    font-size: 64px;
    color: #4caf50;
    margin-bottom: 20px;
}

.success-popup h3 {
    color: #2e7d32;
    margin-bottom: 15px;
}

.success-popup p {
    color: #1b5e20;
    font-size: 16px;
}

/* ESTILOS PARA TABLAS MEJORADAS */
.enhanced-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.enhanced-table thead {
    background: linear-gradient(135deg, #e65100, #ff9800);
}

.enhanced-table th {
    padding: 18px 15px;
    color: white;
    font-weight: 600;
    text-align: left;
    font-size: 15px;
    border: none;
    position: relative;
}

.enhanced-table th:after {
    content: "";
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: rgba(255,255,255,0.3);
}

.enhanced-table th:last-child:after {
    display: none;
}

.enhanced-table tbody tr {
    transition: all 0.3s;
    border-bottom: 1px solid #f0f0f0;
}

.enhanced-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.enhanced-table tbody tr:hover {
    background: #f0f7ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.enhanced-table td {
    padding: 16px 15px;
    color: #333;
    font-size: 14px;
    border: none;
}

/* ESTILOS PARA UBICACION EN TABLA */
.ubicacion-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    min-width: 100px;
}

.ubicacion-correcta {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ubicacion-aproximada {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.ubicacion-incorrecta {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ESTILOS PARA POPUP MODAL */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.qr-modal-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qr-modal-header {
    background: linear-gradient(135deg, #e65100, #ff9800);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qr-modal-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.qr-modal-body {
    padding: 25px;
}

.qr-modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* Scanner en popup */
#popup-qr-reader {
    width: 100%;
    border: 2px solid #e65100;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
}

/* Loading spinner mejorado */
.enhanced-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #e65100;
    border-radius: 50%;
    animation: enhanced-spin 1s linear infinite;
}

@keyframes enhanced-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Botones mejorados */
.enhanced-btn {
    background: linear-gradient(135deg, #e65100, #ff9800);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.enhanced-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 81, 0, 0.3);
}

.enhanced-btn:active {
    transform: translateY(0);
}

.enhanced-btn i {
    font-size: 18px;
}

/* Badges mejorados */
.enhanced-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-entrada {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.badge-salida {
    background: linear-gradient(135deg, #ff9800, #ef6c00);
    color: white;
}

.badge-ronda {
    background: linear-gradient(135deg, #2196f3, #1565c0);
    color: white;
}

.badge-especial {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: white;
}

.badge-emergencia {
    background: linear-gradient(135deg, #f44336, #c62828);
    color: white;
}

/* Establecimientos */
.establecimientos-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.establecimiento-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    transition: all 0.3s;
}

.establecimiento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.establecimiento-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

/* Action buttons en tablas */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons .btn {
    margin: 0;
    padding: 6px 10px;
    min-width: auto;
}

/* Spin animation para íconos */
.dashicons.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Camera selector styles */
.camera-selector {
    margin: 15px 0;
    text-align: center;
}

.camera-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.camera-selector select {
    padding: 10px 15px;
    border-radius: 6px;
    border: 2px solid #e65100;
    background: white;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
}

/* Mejoras para móviles */
@media (max-width: 768px) {
    .establecimientos-container {
        grid-template-columns: 1fr;
    }
    
    .qr-modal {
        padding: 10px;
    }
    
    .qr-modal-content {
        max-width: 95%;
        margin: 20px auto;
    }
    
    .camera-selector select {
        max-width: 100%;
    }
    
    .enhanced-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}