/* =============================================================================
   STYLE.CSS OPTIMIZADO - Reemplaza Bootstrap + FontAwesome
   Solo incluye lo que realmente necesitas - ~15KB vs 1.2MB
   ============================================================================= */

/* Variables CSS */
:root {
    --primary: #1e3a8a;
    --secondary: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f8fafc;
    --dark: #1f2937;
    --white: #ffffff;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

/* Reset y Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Layout Utilities */
.container-fluid { max-width: 100%; padding: 0 1rem; }
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.text-center { text-align: center !important; }
.w-100 { width: 100% !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.position-fixed { position: fixed !important; }
.top-0 { top: 0 !important; }
.end-0 { right: 0 !important; }

/* Typography */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.2; margin-bottom: 0.5rem; }
h1 { font-size: 1.875rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
.fs-5 { font-size: 1.125rem !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-white { color: var(--white) !important; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: var(--transition);
    user-select: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af, #2563eb);
    box-shadow: var(--shadow-lg);
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.125rem; }
.rounded-pill { border-radius: 50rem !important; }

/* Forms */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control, .form-select {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--dark);
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-info {
    background-color: #cffafe;
    border-color: #a5f3fc;
    color: #155e75;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.border-0 { border: 0 !important; }
.shadow-sm { box-shadow: var(--shadow) !important; }

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Main Container */
.main-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    margin: 1.25rem auto;
    max-width: 28rem;
    overflow: hidden;
}

.header-section {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 1.5rem;
    text-align: center;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.content-section {
    padding: 1.5rem;
}

/* Scanner */
.scanner-card {
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-lg);
    transition: var(--transition);
    cursor: pointer;
    background: linear-gradient(135deg, var(--light) 0%, var(--white) 100%);
    padding: 2rem 1.5rem;
    text-align: center;
}

.scanner-card:hover {
    border-color: var(--secondary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.scanner-icon {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.scanner-card:hover .scanner-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.scanner-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.scanner-subtitle { color: var(--gray-500); margin-bottom: 0; }

.scanner-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid var(--secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.scanner-status {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 500;
}

.bg-primary { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--danger) !important; }

#qr-reader {
    border: 3px solid var(--secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    max-width: 100%;
    margin: 0 auto;
    background: #000;
}

/* Action Section */
.action-section {
    background: linear-gradient(135deg, #fefefe 0%, var(--light) 100%);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 58, 138, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: var(--white);
}

.loading-spinner {
    width: 3.75rem;
    height: 3.75rem;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Container */
.toast-container {
    z-index: 1055;
}

.toast {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    min-width: 300px;
}

.toast-header {
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast-body {
    padding: 1rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 1;
}

/* Iconos - Solo los que necesitas */
.fas::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
}

/* Iconos específicos que usas */
.fa-industry::before { content: "\f275"; }
.fa-qrcode::before { content: "\f029"; }
.fa-camera::before { content: "\f030"; }
.fa-stop::before { content: "\f04d"; }
.fa-spinner::before { content: "\f110"; animation: fa-spin 2s infinite linear; }
.fa-edit::before { content: "\f044"; }
.fa-arrow-right::before { content: "\f061"; }
.fa-barcode::before { content: "\f02a"; }
.fa-layer-group::before { content: "\f5fd"; }
.fa-user::before { content: "\f007"; }
.fa-id-card::before { content: "\f2c2"; }
.fa-play-circle::before { content: "\f144"; }
.fa-save::before { content: "\f0c7"; }
.fa-check-circle::before { content: "\f058"; }
.fa-info-circle::before { content: "\f05a"; }
.fa-exclamation-triangle::before { content: "\f071"; }
.fa-sign-out-alt::before { content: "\f2f5"; }
.fa-lock::before { content: "\f023"; }
.fa-users::before { content: "\f0c0"; }

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin { animation: fa-spin 2s infinite linear; }

/* PWA Adjustments */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .main-container {
        margin-top: calc(1.25rem + env(safe-area-inset-top));
    }
}

/* iOS Safari adjustments */
@supports (-webkit-touch-callout: none) {
    @media (display-mode: standalone) {
        body {
            padding-top: 44px;
        }
    }
}

/* Responsive */
@media (max-width: 576px) {
    .main-container {
        margin: 0.625rem;
        border-radius: var(--border-radius);
    }
    
    .content-section {
        padding: 1rem;
    }
    
    .scanner-card {
        padding: 1.5rem 1rem;
    }
    
    .scanner-icon {
        font-size: 2.5rem;
    }
    
    .btn, .form-control, .form-select {
        min-height: 44px; /* iOS touch target */
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .scanner-card {
        padding: 1rem;
    }
    
    .scanner-icon {
        font-size: 2rem;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .scanner-card {
        border-width: 3px;
    }
    
    .form-control:focus, .form-select:focus {
        border-width: 3px;
    }
}

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