/*
 * ActivaCom SaaS — Estilos principales v1.3
 * Mobile-first | Variables CSS | Caracteres correctos
 */

:root {
    --ac-c1:         #FF5722;
    --ac-c2:         #212121;
    --ac-bg:         #F7F8FA;
    --ac-white:      #FFFFFF;
    --ac-text:       #1A1A2E;
    --ac-text-muted: #6B7280;
    --ac-border:     #E5E7EB;
    --ac-radius:     14px;
    --ac-radius-sm:  8px;
    --ac-shadow:     0 2px 12px rgba(0,0,0,.07);
    --ac-shadow-lg:  0 8px 40px rgba(0,0,0,.12);
    --ac-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --ac-success:    #10B981;
    --ac-danger:     #EF4444;
}

* { -webkit-tap-highlight-color: transparent; }

.ac-dashboard,
.ac-auth-wrap,
.ac-landing {
    font-family: var(--ac-font);
    color: var(--ac-text);
    -webkit-font-smoothing: antialiased;
}

/* ── Botones ───────────────────────────────────────────────────── */
.ac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: var(--ac-radius);
    border: none;
    font-family: var(--ac-font);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all .18s ease;
    white-space: nowrap;
    text-align: center;
    letter-spacing: .01em;
}
.ac-btn:focus { outline: 3px solid var(--ac-c1); outline-offset: 2px; }

.ac-btn-primary  { background: var(--ac-c1); color: #fff; }
.ac-btn-primary:hover  { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.ac-btn-primary:active { transform: translateY(0); }

.ac-btn-secondary { background: var(--ac-white); color: var(--ac-text); border: 2px solid var(--ac-border); }
.ac-btn-secondary:hover { border-color: var(--ac-c1); color: var(--ac-c1); }

.ac-btn-ghost { background: transparent; color: var(--ac-text-muted); border: none; }
.ac-btn-ghost:hover { background: var(--ac-bg); }

.ac-btn-whatsapp { background: #25D366; color: #fff; }
.ac-btn-whatsapp:hover { filter: brightness(1.08); }

.ac-btn-full { width: 100%; }
.ac-btn-sm   { padding: 8px 16px; font-size: 13px; border-radius: var(--ac-radius-sm); }
.ac-btn-hero { padding: 16px 32px; font-size: 17px; }

.ac-btn-icon {
    background: none; border: none; cursor: pointer;
    padding: 6px; border-radius: var(--ac-radius-sm);
    font-size: 17px; transition: background .15s;
    display: inline-flex; align-items: center; justify-content: center;
}
.ac-btn-icon:hover { background: var(--ac-bg); }

/* ── Mensajes ──────────────────────────────────────────────────── */
.ac-message { padding: 12px 16px; border-radius: var(--ac-radius-sm); font-size: 14px; margin: 8px 0; line-height: 1.5; }
.ac-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.ac-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Campos de formulario ──────────────────────────────────────── */
.ac-field { margin-bottom: 16px; }
.ac-field label {
    display: block; font-size: 12px; font-weight: 700;
    color: var(--ac-text-muted); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: .05em;
}
.ac-field input[type="text"],
.ac-field input[type="email"],
.ac-field input[type="tel"],
.ac-field input[type="password"],
.ac-field input[type="number"],
.ac-field input[type="date"],
.ac-field textarea,
.ac-select {
    width: 100%; padding: 13px 16px;
    border: 2px solid var(--ac-border);
    border-radius: var(--ac-radius);
    font-family: var(--ac-font); font-size: 15px;
    color: var(--ac-text); background: var(--ac-white);
    transition: border-color .15s; outline: none;
    -webkit-appearance: none;
}
.ac-field input:focus,
.ac-field textarea:focus,
.ac-select:focus {
    border-color: var(--ac-c1);
    box-shadow: 0 0 0 3px rgba(255,87,34,.12);
}
.ac-field textarea { resize: vertical; min-height: 90px; }
.ac-field input[type="color"] { padding: 4px; height: 48px; border-radius: var(--ac-radius); cursor: pointer; }
.ac-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ac-link-input { background: var(--ac-bg) !important; font-size: 13px !important; }

/* ── Autenticacion ─────────────────────────────────────────────── */
.ac-auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(145deg, #f5f5f5 0%, #ece9f1 100%);
    box-sizing: border-box;
}
.ac-auth-card {
    background: var(--ac-white);
    border-radius: 20px;
    padding: 36px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--ac-shadow-lg);
    box-sizing: border-box;
}
.ac-auth-logo {
    display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.ac-logo-icon { font-size: 26px; }
.ac-logo-text { font-size: 22px; font-weight: 900; color: var(--ac-c1); }

.ac-auth-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; color: var(--ac-text); }
.ac-auth-sub { color: var(--ac-text-muted); margin-bottom: 24px; font-size: 14px; }

/* Inputs de auth con estilos propios para mayor compatibilidad mobile */
.ac-auth-card .ac-form .ac-field input {
    -webkit-appearance: none;
    appearance: none;
    background: #fff;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    color: #1A1A2E;
    display: block;
    font-family: inherit;
    font-size: 16px; /* 16px evita zoom en iOS */
    padding: 14px 16px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    margin: 0;
}
.ac-auth-card .ac-form .ac-field input:focus {
    border-color: var(--ac-c1);
    box-shadow: 0 0 0 3px rgba(255,87,34,.12);
}
.ac-auth-card .ac-btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border-radius: 12px;
    margin-top: 4px;
    box-sizing: border-box;
}

.ac-auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ac-text-muted); }
.ac-auth-switch a { color: var(--ac-c1); font-weight: 700; text-decoration: none; }

/* ── Dashboard ─────────────────────────────────────────────────── */
.ac-dashboard { max-width: 680px; margin: 0 auto; padding: 0 16px 60px; box-sizing: border-box; }

.ac-dash-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 0 16px;
    border-bottom: 1px solid var(--ac-border);
    margin-bottom: 20px;
}
.ac-dash-brand    { display: flex; align-items: center; gap: 12px; }
.ac-dash-logo     { height: 44px; border-radius: var(--ac-radius-sm); }
.ac-dash-negocio  { font-size: 17px; font-weight: 800; }
.ac-trial-badge   { font-size: 12px; color: #F59E0B; font-weight: 600; }
.ac-active-badge  { font-size: 12px; color: var(--ac-success); font-weight: 600; }

/* Metricas */
.ac-metrics {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 24px;
}
.ac-metric {
    background: var(--ac-white); border-radius: var(--ac-radius); padding: 12px 8px;
    text-align: center; box-shadow: var(--ac-shadow);
}
.ac-metric-val   { display: block; font-size: 24px; font-weight: 900; color: var(--ac-c1); }
.ac-metric-label { font-size: 10px; color: var(--ac-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* Pregunta central */
.ac-central-question { text-align: center; margin-bottom: 18px; }
.ac-central-question h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.ac-central-question p  { color: var(--ac-text-muted); font-size: 14px; }

/* Acciones */
.ac-actions {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px;
}
.ac-action-btn {
    background: var(--ac-white); border: 2px solid var(--ac-border);
    border-radius: var(--ac-radius); padding: 18px 12px; text-align: center;
    cursor: pointer; transition: all .18s; font-family: var(--ac-font);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    box-shadow: var(--ac-shadow);
}
.ac-action-btn:hover, .ac-action-btn.active {
    border-color: var(--ac-c1); background: #FFF3F0;
    transform: translateY(-2px);
}
.ac-action-emoji { font-size: 28px; }
.ac-action-label { font-size: 13px; font-weight: 700; color: var(--ac-text); }

/* Generador */
.ac-generator {
    background: var(--ac-white); border-radius: var(--ac-radius);
    padding: 18px; box-shadow: var(--ac-shadow);
    margin-bottom: 18px; border: 2px solid var(--ac-c1);
}
.ac-gen-header {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 800; font-size: 15px; margin-bottom: 14px;
}

/* Resultado */
.ac-result {
    background: var(--ac-white); border-radius: var(--ac-radius);
    padding: 18px; box-shadow: var(--ac-shadow); margin-bottom: 18px;
}
.ac-result-label { font-size: 11px; font-weight: 700; color: var(--ac-success); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ac-result-msg {
    background: var(--ac-bg); border-radius: var(--ac-radius-sm);
    padding: 12px 14px; font-size: 14px; line-height: 1.6;
    white-space: pre-wrap; border-left: 3px solid var(--ac-c1);
    word-break: break-word;
}
.ac-result-actions {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px;
}
/* WhatsApp ocupa fila completa */
.ac-result-actions .ac-btn-whatsapp { grid-column: 1 / -1; }

/* Tabs */
.ac-tabs-wrap { margin-top: 24px; }
.ac-tabs {
    display: flex; gap: 2px; border-bottom: 2px solid var(--ac-border);
    margin-bottom: 18px; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.ac-tabs::-webkit-scrollbar { display: none; }
.ac-tab {
    padding: 10px 14px; font-family: var(--ac-font);
    font-size: 13px; font-weight: 700; border: none; background: none;
    cursor: pointer; color: var(--ac-text-muted);
    border-bottom: 3px solid transparent; margin-bottom: -2px;
    white-space: nowrap; transition: all .15s; flex-shrink: 0;
}
.ac-tab.active, .ac-tab:hover { color: var(--ac-c1); border-bottom-color: var(--ac-c1); }
.ac-tab-content { display: none; }
.ac-tab-content.active { display: block; }

.ac-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ac-section-header h3 { font-size: 15px; font-weight: 800; margin: 0; }

/* Game items */
.ac-game-item {
    background: var(--ac-white); border-radius: var(--ac-radius);
    padding: 14px; margin-bottom: 10px; box-shadow: var(--ac-shadow);
}
.ac-game-item-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }

/* Contactos */
.ac-contact-list { display: flex; flex-direction: column; gap: 8px; }
.ac-contact-item {
    background: var(--ac-white); border-radius: var(--ac-radius);
    padding: 11px 12px; display: flex; align-items: center; gap: 10px;
    box-shadow: var(--ac-shadow);
}
.ac-contact-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--ac-c1); color: #fff;
    font-weight: 800; display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.ac-contact-info { flex: 1; min-width: 0; }
.ac-contact-name { font-weight: 700; font-size: 14px; }
.ac-contact-wa   { font-size: 12px; color: var(--ac-text-muted); }

/* Campanas historial */
.ac-campaign-list { display: flex; flex-direction: column; gap: 8px; }
.ac-campaign-item {
    background: var(--ac-white); border-radius: var(--ac-radius);
    padding: 14px; box-shadow: var(--ac-shadow);
    cursor: pointer; transition: box-shadow .15s;
}
.ac-campaign-item:hover { box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.ac-campaign-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* Badge */
.ac-badge {
    display: inline-block; background: var(--ac-bg); color: var(--ac-text-muted);
    padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}

/* Vacio */
.ac-empty {
    text-align: center; padding: 28px 16px; color: var(--ac-text-muted);
    font-size: 14px; background: var(--ac-bg); border-radius: var(--ac-radius);
}

/* Paywall */
.ac-paywall { text-align: center; padding: 60px 24px; max-width: 460px; margin: 0 auto; }
.ac-paywall h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.ac-paywall p  { color: var(--ac-text-muted); margin-bottom: 22px; }

/* Upload */
.ac-upload-zone {
    border: 2px dashed #ddd; border-radius: var(--ac-radius);
    padding: 18px; text-align: center; cursor: pointer;
    background: #fafafa; transition: .2s;
    position: relative; min-height: 90px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
}
.ac-upload-zone:hover { border-color: var(--ac-c1); background: #fff9f7; }
.ac-upload-zone.has-img { border-style: solid; border-color: var(--ac-c1); }
#ac-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
#ac-preview-wrap { display: none; flex-direction: column; align-items: center; gap: 6px; }
#ac-preview-img  { max-height: 150px; max-width: 100%; border-radius: 10px; object-fit: contain; }

/* Participantes */
.ac-play-item { background: var(--ac-white); border-radius: var(--ac-radius); padding: 13px; margin-bottom: 8px; box-shadow: var(--ac-shadow); }
.ac-play-top  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 5px; }
.ac-play-name { font-weight: 700; font-size: 14px; }
.ac-play-juego{ font-size: 11px; background: #f0f0f0; color: #666; padding: 2px 8px; border-radius: 20px; }
.ac-play-premio{ font-size: 14px; color: var(--ac-c1); font-weight: 700; margin-bottom: 4px; }
.ac-play-meta { font-size: 12px; color: #999; display: flex; gap: 10px; flex-wrap: wrap; }
.ac-play-vence { font-size: 11px; background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; padding: 2px 9px; border-radius: 6px; display: inline-block; margin-top: 4px; }
.ac-play-vencido{ font-size: 11px; background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; padding: 2px 9px; border-radius: 6px; display: inline-block; margin-top: 4px; }

/* Modal de campana */
.ac-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.7);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.ac-modal-overlay.open { opacity: 1; pointer-events: all; }
.ac-modal {
    background: #fff; border-radius: 20px; padding: 20px;
    max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.ac-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ac-modal-canvas { max-width: 100%; border-radius: 14px; display: block; margin: 0 auto 14px; }

/* Landing */
.ac-landing { font-family: var(--ac-font); }
.ac-hero { text-align: center; padding: 60px 20px 48px; background: linear-gradient(160deg, #FFF3F0 0%, #F3E8FF 100%); }
.ac-hero-badge { display: inline-block; background: #fff; color: var(--ac-c1); font-size: 13px; font-weight: 700; padding: 6px 16px; border-radius: 20px; margin-bottom: 18px; box-shadow: var(--ac-shadow); }
.ac-hero-title { font-size: clamp(28px, 6vw, 50px); font-weight: 900; line-height: 1.1; margin-bottom: 14px; }
.ac-hero-sub { font-size: 16px; color: var(--ac-text-muted); max-width: 500px; margin: 0 auto 24px; line-height: 1.6; }
.ac-hero .ac-btn { margin: 6px; }
.ac-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; padding: 44px 20px; max-width: 860px; margin: 0 auto; }
.ac-feature { background: #fff; border-radius: var(--ac-radius); padding: 22px; box-shadow: var(--ac-shadow); }
.ac-feature-icon { font-size: 32px; display: block; margin-bottom: 10px; }
.ac-feature h3 { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.ac-feature p  { color: var(--ac-text-muted); font-size: 14px; line-height: 1.6; }
.ac-cta-final { text-align: center; padding: 44px 20px 60px; background: var(--ac-c2); color: #fff; }
.ac-cta-final h2 { font-size: 26px; font-weight: 900; margin-bottom: 8px; }
.ac-cta-final p  { opacity: .7; margin-bottom: 22px; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ac-auth-card { padding: 28px 18px; }
    .ac-metrics   { grid-template-columns: repeat(2,1fr); }
    .ac-metric-val { font-size: 20px; }
    .ac-actions   { grid-template-columns: 1fr 1fr; }
    .ac-result-actions { grid-template-columns: 1fr; }
    .ac-result-actions .ac-btn-whatsapp { grid-column: auto; }
    .ac-field-row { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
    .ac-actions { grid-template-columns: 1fr; }
}
