/* ========================================
   Subscription Timer Widget
   Global hourglass in topbar
   ======================================== */

/* --- Container in Topbar --- */
.duo-sub-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-size: 12px;
    white-space: nowrap;
}

.duo-sub-timer:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* --- SVG Hourglass --- */
.sub-hourglass {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: filter 0.3s ease;
}

.sub-hourglass .hg-frame {
    fill: #c0c4cc;
}

.sub-hourglass .hg-sand-top {
    transition: height 1s ease-out, y 1s ease-out;
}

.sub-hourglass .hg-sand-bottom {
    transition: height 1s ease-out;
}

.sub-hourglass .hg-sand-stream {
    opacity: 0.7;
}

/* --- Date & Remaining Text --- */
.sub-timer-dates {
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    direction: ltr;
}

.sub-timer-remaining {
    font-weight: 700;
    font-size: 12px;
    color: #fff;
}

/* ========================================
   Color Phases
   ======================================== */

/* Phase: Safe (> 60 days) — Green */
.duo-sub-timer.phase-safe .sub-hourglass .hg-sand-top,
.duo-sub-timer.phase-safe .sub-hourglass .hg-sand-bottom,
.duo-sub-timer.phase-safe .sub-hourglass .hg-sand-stream {
    fill: #34d399;
}

.duo-sub-timer.phase-safe .sub-timer-remaining {
    color: #6ee7b7;
}

/* Phase: Warning (30–60 days) — Yellow */
.duo-sub-timer.phase-warning .sub-hourglass .hg-sand-top,
.duo-sub-timer.phase-warning .sub-hourglass .hg-sand-bottom,
.duo-sub-timer.phase-warning .sub-hourglass .hg-sand-stream {
    fill: #fbbf24;
}

.duo-sub-timer.phase-warning .sub-timer-remaining {
    color: #fde68a;
}

/* Phase: Urgent (15–30 days) — Orange */
.duo-sub-timer.phase-urgent .sub-hourglass .hg-sand-top,
.duo-sub-timer.phase-urgent .sub-hourglass .hg-sand-bottom,
.duo-sub-timer.phase-urgent .sub-hourglass .hg-sand-stream {
    fill: #fb923c;
}

.duo-sub-timer.phase-urgent .sub-timer-remaining {
    color: #fdba74;
}

.duo-sub-timer.phase-urgent {
    animation: subtlePulse 3s ease-in-out infinite;
}

/* Phase: Critical (< 15 days) — Red + Glow */
.duo-sub-timer.phase-critical .sub-hourglass .hg-sand-top,
.duo-sub-timer.phase-critical .sub-hourglass .hg-sand-bottom,
.duo-sub-timer.phase-critical .sub-hourglass .hg-sand-stream {
    fill: #f87171;
}

.duo-sub-timer.phase-critical .sub-timer-remaining {
    color: #fca5a5;
}

.duo-sub-timer.phase-critical {
    animation: glowPulse 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.4);
}

/* Phase: Expired — Gray/Red */
.duo-sub-timer.expired {
    background: rgba(239, 68, 68, 0.15);
    cursor: default;
}

.duo-sub-timer.expired .sub-hourglass .hg-sand-top,
.duo-sub-timer.expired .sub-hourglass .hg-sand-stream {
    fill: transparent;
}

.duo-sub-timer.expired .sub-hourglass .hg-sand-bottom {
    fill: #6b7280;
}

.duo-sub-timer.expired .sub-hourglass .hg-frame {
    fill: #6b7280;
}

.duo-sub-timer.expired .sub-timer-remaining {
    color: #f87171;
    font-weight: 800;
}

/* ========================================
   Animations
   ======================================== */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(251, 146, 60, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(251, 146, 60, 0.6), 0 0 40px rgba(251, 146, 60, 0.2);
    }
}

@keyframes subtlePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* ========================================
   Smart Tooltip (Hover)
   ======================================== */
.sub-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

.sub-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: #1e293b;
    transform: rotate(45deg);
    border-radius: 2px;
}

.duo-sub-timer:hover .sub-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-tooltip-label {
    color: #94a3b8;
}

.sub-tooltip-value {
    color: #fff;
    font-weight: 600;
}

/* ========================================
   Referral Modal
   ======================================== */
.sub-referral-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sub-referral-overlay.active {
    display: flex;
}

.sub-referral-modal {
    background: linear-gradient(145deg, #1a1f2e, #141824);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 28px 24px;
    max-width: 380px;
    width: 100%;
    position: relative;
    animation: modalSlideUp 0.3s ease;
    direction: rtl;
    text-align: center;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sub-referral-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sub-referral-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Modal Header */
.sub-referral-header {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
}

.sub-referral-subtitle {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Progress Bar */
.sub-referral-progress {
    margin-bottom: 20px;
}

.sub-progress-bar-track {
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
}

.sub-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #34d399, #10b981);
    border-radius: 99px;
    transition: width 0.8s ease;
    min-width: 4px;
}

.sub-progress-text {
    font-size: 12px;
    color: #94a3b8;
}

.sub-progress-text strong {
    color: #34d399;
}

.sub-progress-discount {
    display: inline-block;
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
}

/* Code & URL Boxes */
.sub-referral-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.sub-referral-box-label {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    text-align: right;
    font-weight: 600;
}

.sub-referral-box-value {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 1px;
    direction: ltr;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sub-referral-url .sub-referral-box-value {
    font-size: 11px;
    letter-spacing: 0;
}

.sub-referral-copy-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sub-referral-copy-btn:hover {
    background: rgba(99, 102, 241, 0.3);
}

.sub-referral-copy-btn.copied {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

/* WhatsApp Share */
.sub-referral-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: none;
    background: #25d366;
    color: #fff;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
    font-family: inherit;
}

.sub-referral-whatsapp:hover {
    background: #20bd5a;
    transform: translateY(-1px);
}

/* Motivational footer */
.sub-referral-footer {
    margin-top: 16px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}

.sub-referral-footer span {
    color: #fbbf24;
}

/* ========================================
   Referral Discount Tiers Table
   ======================================== */
.sub-referral-tiers {
    margin-top: 18px;
    text-align: right;
}

.sub-referral-tiers-title {
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 10px;
}

.sub-referral-tiers-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sub-tier-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.3s ease;
    font-size: 13px;
}

/* Achieved tier */
.sub-tier-row.tier-achieved {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.15);
}

/* Current active tier — highlighted */
.sub-tier-row.tier-current {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.4);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

/* Locked tier */
.sub-tier-row.tier-locked {
    opacity: 0.5;
}

.sub-tier-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.sub-tier-friends {
    flex: 1;
    color: #cbd5e1;
    font-weight: 600;
}

.sub-tier-row.tier-current .sub-tier-friends {
    color: #6ee7b7;
}

.sub-tier-arrow {
    color: #475569;
    font-size: 12px;
}

.sub-tier-discount {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    min-width: 42px;
    text-align: center;
}

.sub-tier-row.tier-achieved .sub-tier-discount,
.sub-tier-row.tier-current .sub-tier-discount {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.sub-tier-cap {
    text-align: center;
    font-size: 11px;
    color: #64748b;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
    .sub-timer-dates {
        display: none;
    }

    .duo-sub-timer {
        padding: 4px 8px;
        gap: 4px;
    }

    .sub-referral-modal {
        padding: 22px 18px;
        margin: 0 10px;
    }
}