/* ============================================
   MILLACOFFEE - Estilos Globales
   Diseño responsive tipo App - Colores cálidos café
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    /* Paleta principal - Tonos café cálidos */
    --color-espresso: #2C1810;
    --color-mocha: #4A2C2A;
    --color-caramel: #C68B59;
    --color-latte: #E8D5B7;
    --color-cream: #FFF8F0;
    --color-milk: #FFFDF9;

    /* Acentos */
    --color-gold: #D4A853;
    --color-gold-light: #F0D48A;
    --color-success: #27AE60;
    --color-success-bg: #E8F8F0;
    --color-danger: #E74C3C;
    --color-danger-bg: #FDEDEC;
    --color-info: #3498DB;
    --color-info-bg: #EBF5FB;
    --color-warning: #F39C12;
    --color-warning-bg: #FEF9E7;

    /* Texto */
    --text-primary: #2C1810;
    --text-secondary: #6B4F3A;
    --text-muted: #A0876E;
    --text-light: #FFFFFF;

    /* Superficies */
    --surface-main: #FFF8F0;
    --surface-card: #FFFFFF;
    --surface-glass: rgba(255, 255, 255, 0.75);
    --surface-dark: #2C1810;

    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(44, 24, 16, 0.08);
    --shadow-md: 0 4px 12px rgba(44, 24, 16, 0.1);
    --shadow-lg: 0 8px 30px rgba(44, 24, 16, 0.12);
    --shadow-xl: 0 16px 50px rgba(44, 24, 16, 0.15);
    --shadow-glow: 0 0 20px rgba(212, 168, 83, 0.3);

    /* Bordes */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--surface-main);
}

.app-container.admin {
    max-width: 960px;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
    background: linear-gradient(135deg, var(--color-espresso) 0%, var(--color-mocha) 100%);
    padding: 24px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.1) 0%, transparent 60%);
    animation: headerShimmer 8s ease-in-out infinite;
}

@keyframes headerShimmer {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(5%, 5%);
    }
}

.app-header .logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    background: var(--color-gold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-glow);
}

.app-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.app-header .subtitle {
    font-size: 0.85rem;
    color: var(--color-latte);
    margin-top: 4px;
    position: relative;
    z-index: 1;
    opacity: 0.85;
}

.header-actions {
    position: absolute;
    top: 20px;
    right: 16px;
    z-index: 2;
}

.header-actions a,
.header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
    backdrop-filter: blur(10px);
}

.header-actions a:hover,
.header-actions button:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */
.app-content {
    padding: 20px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(198, 139, 89, 0.1);
    transition: var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-glass {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    font-size: 1.2rem;
}

/* ============================================
   CÓDIGO QR
   ============================================ */
.qr-section {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(160deg, var(--color-cream) 0%, var(--color-latte) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.qr-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-caramel), var(--color-gold), var(--color-caramel));
}

.qr-container {
    display: inline-block;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin: 16px 0;
}

.qr-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

.qr-alias {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--color-espresso);
    margin-bottom: 8px;
}

/* ============================================
   PUNTOS / PROGRESO
   ============================================ */
.puntos-list {
    list-style: none;
}

.punto-item {
    padding: 16px;
    border-bottom: 1px solid rgba(198, 139, 89, 0.1);
    transition: var(--transition-fast);
}

.punto-item:last-child {
    border-bottom: none;
}

.punto-item:hover {
    background: var(--color-cream);
    border-radius: var(--radius-sm);
}

.punto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.punto-nombre {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.punto-count {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--color-gold);
    font-size: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-latte);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-caramel), var(--color-gold));
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.punto-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-latte);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--surface-card);
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--color-caramel);
    box-shadow: 0 0 0 3px rgba(198, 139, 89, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-caramel) 0%, var(--color-gold) 100%);
    color: var(--color-espresso);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

.btn-success {
    background: linear-gradient(135deg, #27AE60, #2ECC71);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-caramel);
    color: var(--color-caramel);
}

.btn-outline:hover {
    background: var(--color-caramel);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* ============================================
   BANNER PUBLICITARIO (ANTI-ADBLOCK)
   ============================================ */
.mc-promo-container {
    position: sticky;
    top: 10px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 8px 12px;
    z-index: 100;
}

.mc-promo-item {
    display: block;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.3);
    /* Brillo tipo Talentia */
    transition: var(--transition-normal);
    text-decoration: none;
    position: relative;
    cursor: pointer;
    background: linear-gradient(135deg, #b2f5ea 0%, #81e6d9 50%, #5eead4 100%);
    /* Brillito de fondo inspirado en Talentia */
}

.mc-promo-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: promoShine 3s ease-in-out infinite;
    z-index: 10;
}

@keyframes promoShine {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

.mc-promo-item:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(212, 168, 83, 0.5);
}

.mc-promo-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-md);
    /* Para tapar fondo si la imagen no es transparente */
    position: relative;
    z-index: 1;
}

.mc-promo-item .mc-label {
    position: absolute;
    top: 4px;
    right: 6px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    z-index: 20;
}

/* Espacio para que el contenido no quede tapado */
.content-padding-bottom {
    padding-bottom: 100px;
}

/* ============================================
   ESCÁNER QR
   ============================================ */
.scanner-section {
    margin: 20px 0;
}

.scanner-viewport {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--color-caramel);
}

#reader {
    width: 100%;
}

/* ============================================
   RESULTADO ESCANEO
   ============================================ */
.scan-result {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin: 16px 0;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scan-result.success {
    background: var(--color-success-bg);
    border: 2px solid var(--color-success);
}

.scan-result.premio {
    background: linear-gradient(135deg, #FFF8E1, #FFF3CD);
    border: 2px solid var(--color-gold);
    animation: slideUp 0.4s ease, premioGlow 1s ease-in-out infinite alternate;
}

@keyframes premioGlow {
    from {
        box-shadow: 0 0 10px rgba(212, 168, 83, 0.3);
    }

    to {
        box-shadow: 0 0 30px rgba(212, 168, 83, 0.6);
    }
}

.scan-result .result-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.scan-result .result-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.scan-result .result-detail {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   ALERTAS / MENSAJES
   ============================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease;
}

.alert-success {
    background: var(--color-success-bg);
    color: #1E7E45;
    border-left: 4px solid var(--color-success);
}

.alert-danger {
    background: var(--color-danger-bg);
    color: #C0392B;
    border-left: 4px solid var(--color-danger);
}

.alert-info {
    background: var(--color-info-bg);
    color: #2471A3;
    border-left: 4px solid var(--color-info);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: #B7950B;
    border-left: 4px solid var(--color-warning);
}

/* ============================================
   TABLA ADMIN
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--color-espresso);
    color: var(--text-light);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-latte);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: var(--color-cream);
}

.admin-table .banner-thumb {
    width: 80px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-latte);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-inactive {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.stat-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-espresso);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 24, 16, 0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(160deg, var(--color-espresso) 0%, var(--color-mocha) 40%, #5D3A2E 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(198, 139, 89, 0.1) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    border-radius: 50%;
}

.login-box {
    width: 100%;
    max-width: 380px;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: var(--color-gold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: var(--shadow-glow);
}

.login-logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    color: var(--text-light);
    font-weight: 700;
}

.login-logo p {
    color: var(--color-latte);
    font-size: 0.9rem;
    margin-top: 4px;
    opacity: 0.8;
}

.login-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-xl);
}

.login-card .form-control {
    background: rgba(255, 255, 255, 0.9);
}

.login-info {
    text-align: center;
    margin-top: 20px;
    color: var(--color-latte);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ============================================
   ESTADÍSTICAS ADMIN
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface-card);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(198, 139, 89, 0.1);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-espresso);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.gap-8 {
    gap: 8px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hidden {
    display: none !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.3rem;
    }

    .card {
        padding: 18px;
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .app-container.admin {
        padding: 0 20px;
    }
}