/* ============================================
   CLUBALMACÉN – FEATURES.CSS
   Notificaciones · Chat IA · Cuponera · Suscripción
   ============================================ */

/* ---- Notification Bell ---- */
.notif-bell-wrapper {
    position: relative;
    cursor: pointer;
}
.notif-bell-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--primary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    transition: background 0.2s;
    position: relative;
}
.notif-bell-btn:hover { background: rgba(224,0,0,0.08); }
.notif-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid white;
    display: none;
}
.notif-dot.visible { display: block; }

.notif-panel {
    position: absolute;
    top: 48px;
    right: 0;
    width: 340px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    z-index: 500;
    display: none;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.07);
    animation: slideDown 0.22s ease;
}
.notif-panel.open { display: block; }
@keyframes slideDown {
    from { opacity:0; transform:translateY(-10px); }
    to   { opacity:1; transform:translateY(0); }
}
.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.notif-panel-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}
.notif-mark-all {
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    background: none;
    border: none;
    font-weight: 600;
}
.notif-list {
    max-height: 340px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    transition: background 0.2s;
}
.notif-item:hover { background: rgba(224,0,0,0.03); }
.notif-item.unread { background: rgba(224,0,0,0.04); }
.notif-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}
.notif-icon-wrap.green  { background: linear-gradient(135deg,#00c853,#4caf50); }
.notif-icon-wrap.orange { background: linear-gradient(135deg,#ff9800,#f57c00); }
.notif-icon-wrap.blue   { background: linear-gradient(135deg,#2196f3,#1976d2); }
.notif-text { flex: 1; }
.notif-text p { margin: 0 0 3px; font-size: 13px; color: var(--text-dark); line-height: 1.4; }
.notif-text span { font-size: 11px; color: var(--text-light); }
.notif-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-light);
    font-size: 14px;
}

/* ---- Chat IA Floating Button ---- */
.chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(224,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    z-index: 900;
    transition: transform 0.3s, box-shadow 0.3s;
}
.chat-fab:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 36px rgba(224,0,0,0.45);
}
.chat-fab .fab-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #00c853;
    border-radius: 50%;
    border: 2px solid white;
}

/* ---- Chat Window ---- */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 360px;
    max-height: 520px;
    background: white;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.16);
    z-index: 899;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.07);
    animation: chatIn 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
.chat-window.open { display: flex; }
@keyframes chatIn {
    from { opacity:0; transform:scale(0.85) translateY(20px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}
.chat-header {
    background: var(--gradient-primary);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.chat-header-info h4 {
    margin: 0;
    color: white;
    font-size: 15px;
    font-weight: 700;
}
.chat-header-info span {
    font-size: 11px;
    color: rgba(255,255,255,0.85);
}
.chat-close-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}
.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    position: relative;
}
.chat-msg.bot {
    background: white;
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.chat-msg.user {
    background: var(--gradient-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-msg .msg-time {
    font-size: 10px;
    opacity: 0.55;
    margin-top: 4px;
    display: block;
}
.chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: none;
}
.chat-typing.visible { display: flex; }
.typing-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%,80%,100% { transform: scale(0.7); opacity:0.5; }
    40% { transform: scale(1); opacity:1; }
}
.chat-quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 8px;
    background: #f9fafb;
}
.chat-quick-btn {
    font-size: 11.5px;
    padding: 5px 10px;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.chat-quick-btn:hover {
    background: var(--primary);
    color: white;
}
.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(0,0,0,0.07);
    background: white;
}
.chat-input {
    flex: 1;
    border: 1.5px solid rgba(0,0,0,0.1);
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--primary); }
.chat-send-btn {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.chat-send-btn:hover { transform: scale(1.08); }

/* ---- Cuponera ---- */
.cupones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.cupon-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    transition: transform 0.25s, box-shadow 0.25s;
}
.cupon-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(0,0,0,0.12);
}
.cupon-header {
    background: var(--gradient-primary);
    padding: 20px;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cupon-header::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}
.cupon-discount {
    font-size: 38px;
    font-weight: 800;
    line-height: 1;
}
.cupon-discount-label {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}
.cupon-body {
    padding: 16px;
}
.cupon-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 6px;
}
.cupon-desc {
    font-size: 12.5px;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.5;
}
.cupon-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    background: #fafafa;
}
.cupon-code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(224,0,0,0.07);
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 1.5px;
}
.cupon-expiry {
    font-size: 11px;
    color: var(--text-light);
}
.cupon-use-btn {
    width: 100%;
    padding: 10px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.2s;
}
.cupon-use-btn:hover { opacity: 0.88; }
.cupon-use-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 1;
}
.cupon-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255,255,255,0.25);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cupon-card.used { opacity: 0.55; }
.cupon-card.used .cupon-header { background: linear-gradient(135deg,#999,#bbb); }

/* ---- Suscripción / Cargo de mantenimiento ---- */
.suscripcion-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 28px;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}
.suscripcion-panel::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(224,0,0,0.3) 0%, transparent 70%);
    border-radius: 50%;
}
.suscripcion-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
    margin-bottom: 6px;
}
.suscripcion-amount {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.1;
}
.suscripcion-amount sup {
    font-size: 22px;
    vertical-align: super;
    font-weight: 600;
}
.suscripcion-subtitle {
    font-size: 13px;
    opacity: 0.65;
    margin-top: 4px;
    margin-bottom: 20px;
}
.suscripcion-breakdown {
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.suscripcion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.suscripcion-row:last-child { border-bottom: none; }
.suscripcion-row .label { opacity: 0.75; }
.suscripcion-row .value { font-weight: 700; }
.suscripcion-row.total .label { opacity: 1; font-weight: 700; font-size: 14px; }
.suscripcion-row.total .value { color: #ff6b6b; font-size: 16px; }
.suscripcion-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.suscripcion-status.ok {
    background: rgba(0,200,83,0.2);
    color: #00c853;
    border: 1px solid rgba(0,200,83,0.3);
}
.suscripcion-status.pending {
    background: rgba(255,152,0,0.2);
    color: #ff9800;
    border: 1px solid rgba(255,152,0,0.3);
}
.suscripcion-status.overdue {
    background: rgba(224,0,0,0.25);
    color: #ff4444;
    border: 1px solid rgba(224,0,0,0.35);
}
.suscripcion-pay-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 13px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}
.suscripcion-pay-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

/* Historial de cargos */
.cargo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(0,0,0,0.06);
    font-size: 13px;
}
.cargo-item .cargo-info {}
.cargo-item .cargo-info b { display: block; font-size: 14px; color: var(--text-dark); }
.cargo-item .cargo-info span { color: var(--text-light); font-size: 12px; }
.cargo-item .cargo-amount { font-weight: 700; color: var(--primary); font-size: 15px; }

/* ---- Tabs dentro del dashboard ---- */
.dash-tabs {
    display: flex;
    gap: 4px;
    background: #f0f0f0;
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tab {
    padding: 9px 18px;
    border-radius: 10px;
    border: none;
    background: none;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.dash-tab:hover:not(.active) { color: var(--text-dark); }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Guía de bienvenida / Onboarding ---- */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    display: none;
}
.onboarding-overlay.open { display: flex; }
.onboarding-card {
    background: white;
    border-radius: 24px;
    padding: 36px 32px;
    max-width: 440px;
    width: 92%;
    text-align: center;
    position: relative;
    animation: bounceIn 0.45s cubic-bezier(0.34,1.56,0.64,1);
}
.onboarding-step-indicator {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 24px;
}
.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: background 0.3s, width 0.3s;
}
.step-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}
.onboarding-icon {
    font-size: 52px;
    margin-bottom: 16px;
}
.onboarding-card h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-dark);
}
.onboarding-card p {
    font-size: 14.5px;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 24px;
}
.onboarding-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.onboarding-next-btn {
    padding: 12px 28px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.onboarding-next-btn:hover { opacity: 0.88; }
.onboarding-skip-btn {
    padding: 12px 18px;
    background: none;
    color: var(--text-light);
    border: none;
    font-size: 13px;
    cursor: pointer;
}

/* ---- Toast notifications ---- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: white;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.14);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: #00c853; }
.toast.warning { border-left-color: #ff9800; }
.toast.info { border-left-color: #2196f3; }
@keyframes toastIn {
    from { opacity:0; transform:translateX(20px); }
    to   { opacity:1; transform:translateX(0); }
}
@keyframes toastOut {
    from { opacity:1; transform:translateX(0); }
    to   { opacity:0; transform:translateX(20px); }
}
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-text { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--text-dark); }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-light); font-size: 14px; padding: 2px 4px; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .chat-window { width: calc(100vw - 40px); right: 20px; bottom: 90px; }
    .notif-panel { width: calc(100vw - 32px); right: 0; }
    .cupones-grid { grid-template-columns: 1fr; }
    .suscripcion-amount { font-size: 34px; }
}


/* ============================================
   RESPONSIVE ADICIONAL PARA FEATURES
   ============================================ */

@media (max-width: 600px) {
    .chat-window {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 80px;
        max-height: 60vh;
        border-radius: 16px;
    }

    .chat-fab {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 16px;
        right: 16px;
    }

    .notif-panel {
        width: calc(100vw - 24px);
        right: -8px;
        top: 42px;
        border-radius: 14px;
    }

    .notif-item {
        padding: 10px 14px;
    }

    .notif-text p {
        font-size: 12px;
    }

    .cupones-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .cupon-card {
        border-radius: 12px;
    }

    .cupon-header {
        padding: 14px;
    }

    .cupon-discount {
        font-size: 28px;
    }

    .cupon-body {
        padding: 12px;
    }

    .cupon-footer {
        padding: 10px 14px;
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }

    .suscripcion-panel {
        padding: 20px;
        border-radius: 14px;
    }

    .suscripcion-amount {
        font-size: 28px;
    }

    .suscripcion-breakdown {
        padding: 10px 12px;
    }

    .suscripcion-row {
        font-size: 12px;
        padding: 4px 0;
    }

    .cargo-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 14px;
    }

    .cargo-item .cargo-amount {
        font-size: 14px;
    }
}
