/* ============================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   Paleta de colores profesional moderna
   ============================================ */
:root {
    /* Colores principales - Azul del logo CuponApp+ */
    --primary-color: #4A90E2; /* Azul corporativo suave - mismo tono del logo */
    --primary-dark: #357ABD; /* Azul más oscuro para hover */
    --primary-light: #6BA3E8; /* Azul claro */
    --primary-lighter: #8BB5ED; /* Azul muy claro */
    --primary-gradient: linear-gradient(135deg, #4A90E2 0%, #5BA0F2 100%);
    --primary-gradient-soft: linear-gradient(135deg, #6BA3E8 0%, #7BB3F8 100%);
    
    /* Sobrescribir Bootstrap primary para que coincida con el logo */
    --bs-primary: var(--primary-color);
    --bs-primary-rgb: 74, 144, 226;
    
    /* Colores secundarios */
    --secondary-color: #64748b; /* Slate */
    --secondary-light: #94a3b8;
    
    /* Colores de estado - Profesionales y suaves */
    --success-color: #27AE60; /* Verde más suave */
    --success-light: #52BE80;
    --warning-color: #F39C12; /* Naranja en lugar de amarillo brillante */
    --warning-light: #F5B041;
    --danger-color: #E74C3C; /* Rojo más oscuro y profesional */
    --danger-light: #EC7063;
    --info-color: #3498DB; /* Azul información */
    --info-light: #5DADE2;
    
    /* Colores neutros */
    --light-color: #f8fafc;
    --light-gray: #f1f5f9;
    --gray: #e2e8f0;
    --dark-gray: #64748b;
    --dark-color: #1e293b;
    --darker-color: #0f172a;
    
    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-dark: #1e293b;
    
    /* Espaciado y diseño */
    --border-radius: 0.75rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --box-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --box-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --box-shadow-hover: 0 20px 25px -5px rgba(99, 102, 241, 0.2), 0 10px 10px -5px rgba(99, 102, 241, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Variables específicas para cupones */
    --cupon-color: var(--primary-color);
    
    /* Navbar - Más angosto pero con logo grande */
    --navbar-height: 80px;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* ============================================
   RESET Y ESTILOS BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--bg-secondary);
    padding-top: var(--navbar-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1; /* Empuja el footer hacia abajo */
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   TIPOGRAFÍA
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-weight: 800;
}

.lead {
    font-size: 1.25rem;
    font-weight: 300;
}

/* ============================================
   COMPONENTES PERSONALIZADOS
   ============================================ */

/* --- NAVBAR --- */
.navbar {
    background: var(--navbar-bg) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--navbar-shadow);
    transition: var(--transition);
    z-index: 1030;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

/* Navbar con fondo azul del logo (bg-primary personalizado) */
.navbar.bg-primary,
.navbar-dark.bg-primary {
    background: #4A90E2 !important;
    background-color: #4A90E2 !important;
    border-bottom: 1px solid #357ABD;
}

.navbar.bg-primary .nav-link,
.navbar-dark.bg-primary .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar.bg-primary .nav-link:hover,
.navbar-dark.bg-primary .nav-link:hover {
    color: rgba(255, 255, 255, 1) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.navbar.bg-primary .navbar-toggler,
.navbar-dark.bg-primary .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
}

.navbar.bg-primary .navbar-toggler-icon,
.navbar-dark.bg-primary .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.75rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    -webkit-text-fill-color: var(--primary-color);
    font-size: 1.8rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- BOTONES --- */
.btn {
    border-radius: var(--border-radius);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3), 0 2px 4px -1px rgba(99, 102, 241, 0.2);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-gradient-soft);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4), 0 4px 6px -2px rgba(99, 102, 241, 0.3);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-md);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* --- TARJETAS --- */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
    background: var(--bg-primary);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--gray);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: white;
    font-weight: 600;
}

/* --- BADGES --- */
.badge {
    padding: 0.5em 1em;
    border-radius: 50px;
    font-weight: 600;
}

.badge-primary {
    background: var(--primary-gradient);
}

/* --- FORMULARIOS --- */
.form-control, .form-select {
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(78, 84, 200, 0.25);
}

.form-control-lg {
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
}

/* Prefijo telefónico (+52 / +1) */
.phone-prefix-select {
    flex: 0 0 7.5rem !important;
    width: 7.5rem !important;
    min-width: 7.5rem !important;
    max-width: 7.5rem !important;
    color: #212529 !important;
    -webkit-text-fill-color: #212529 !important;
    background-color: #fff !important;
    opacity: 1 !important;
    overflow: visible;
    text-indent: 0;
    padding-left: 0.75rem;
    padding-right: 2rem;
    font-weight: 500;
    line-height: 1.5;
}

.input-group > .phone-prefix-select:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* --- PROGRESS BAR --- */
.progress {
    border-radius: 50px;
    height: 10px;
}

.progress-bar {
    background: var(--primary-gradient);
    border-radius: 50px;
}

/* ============================================
   EFECTOS ESPECIALES
   ============================================ */
.hover-lift {
    transition: var(--transition);
}

.hover-lift:hover {
    transform: translateY(-10px);
}

.hover-shadow {
    transition: var(--transition);
}

.hover-shadow:hover {
    box-shadow: var(--box-shadow-hover);
}

/* Efecto de aparición suave */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   UTILIDADES PERSONALIZADAS
   ============================================ */
.rounded-xl {
    border-radius: 1.5rem !important;
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: var(--primary-gradient) !important;
}

.bg-light-primary {
    background-color: rgba(78, 84, 200, 0.1) !important;
}

.bg-light-success {
    background-color: rgba(40, 167, 69, 0.1) !important;
}

.bg-light-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.bg-light-danger {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* ============================================
   COMPONENTES ESPECÍFICOS DEL PROYECTO
   ============================================ */

/* --- CUPÓN CARD --- */
.cupon-card {
    border-left: 5px solid var(--cupon-color, var(--primary-color));
}

/* --- UPLOAD AREA --- */
.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
    background-color: var(--light-color);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(78, 84, 200, 0.05);
}

/* --- COLOR OPTIONS --- */
.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.color-option:hover {
    transform: scale(1.1);
    border-color: var(--dark-color);
}

/* --- QR MINI --- */
.qr-mini {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- STATS CARD --- */
.stats-card {
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

/* ============================================
   LAYOUT Y ESTRUCTURA
   ============================================ */
.section-padding {
    padding: 5rem 0;
}

@media (max-width: 768px) {
    .section-padding {
        padding: 3rem 0;
    }
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
}

/* Sticky Sidebar */
.sticky-sidebar {
    position: sticky;
    top: 100px;
}

/* ============================================
   PÁGINAS ESPECÍFICAS
   ============================================ */

/* --- LOGIN PAGE --- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.login-card {
    border-radius: 1.5rem;
    border: none;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.login-illustration {
    background: var(--primary-gradient);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
}

/* --- CREAR CUPÓN --- */
.preview-img {
    max-height: 200px;
    object-fit: contain;
    border-radius: calc(var(--border-radius) - 0.25rem);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .display-1 { font-size: 3rem; }
    .display-2 { font-size: 2.5rem; }
    .display-3 { font-size: 2rem; }
    .display-4 { font-size: 1.75rem; }
    .display-5 { font-size: 1.5rem; }
    
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .section-padding {
        padding: 3rem 0;
    }
    
    /* Mejorar legibilidad en móviles */
    p, li, .form-text {
        font-size: 0.95rem;
    }
    
    /* Ajustar padding en móviles */
    .container, .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 576px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .lead {
        font-size: 1rem;
    }
    
    /* Botones a ancho completo en móviles */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        min-height: 44px; /* Tamaño táctil mínimo */
        font-size: 1rem; /* Texto legible */
    }
    
    .btn-group .btn {
        width: auto;
    }
    
    /* Tablas con scroll horizontal en móvil */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    
    /* Formularios optimizados para móvil */
    .form-control, .form-select {
        font-size: 16px; /* Evita zoom automático en iOS */
        min-height: 44px; /* Tamaño táctil mínimo */
    }
    
    /* Cards con mejor padding en móvil */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Mejor espaciado en móvil */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ============================================
   ANIMACIONES Y TRANSICIONES
   ============================================ */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.shimmer {
    background: linear-gradient(to right, #f6f7f8 8%, #edeef1 18%, #f6f7f8 33%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    background: linear-gradient(135deg, var(--darker-color) 0%, var(--dark-color) 100%);
    color: rgba(255, 255, 255, 0.9);
    margin-top: auto;
    padding: 4rem 0 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.app-footer a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--primary-lighter);
    text-decoration: none;
}

.app-footer h5 {
    color: white;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.footer-divider {
    opacity: 0.2;
    margin: 2rem 0;
}

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

/* ============================================
   ACCESIBILIDAD - FOCUS VISIBLE
   ============================================ */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Focus visible para botones */
button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* Focus visible para enlaces */
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Focus visible para inputs y selects (sobrescribe outline:none de Bootstrap si existe) */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px !important;
}

/* Asegurar que elementos interactivos tengan focus visible */
[tabindex]:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   DEBUG (Solo para desarrollo)
   ============================================ */
.debug * {
    outline: 1px solid rgba(255, 0, 0, 0.1);
}