/* ================================================================
   Tronmedia Mission — Frontend CSS v2.1
================================================================ */

/* ── Popup Overlay ─────────────────────────────────────────── */
/* overlay: fixed toàn màn hình, scroll bằng chính overlay */
.tm-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 99999;
    overflow-y: auto;          /* scroll chính của trình duyệt thay vì scroll popup */
    padding: 40px 16px;
    backdrop-filter: blur(3px);
}

/* popup: width 800px, height auto, không scroll riêng */
.tm-popup {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    /* height: auto — không set max-height, không overflow-y */
    padding: 32px 28px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    position: relative;
    margin: 0 auto;            /* căn giữa ngang */
    animation: tmPopupIn .25s cubic-bezier(.34,1.56,.64,1);
}

@keyframes tmPopupIn {
    from { opacity:0; transform: scale(.93) translateY(14px); }
    to   { opacity:1; transform: scale(1)   translateY(0); }
}

/* ── Loading trong popup ────────────────────────────────────── */
.tm-popup-loading {
    text-align: center;
    padding: 48px 0;
    color: #6b7280;
}
.tm-popup-loading .tm-heart-pulse,
.tm-heart-pulse {
    font-size: 2.2rem;
    display: inline-block;
    animation: tmBeat .8s infinite;
}
@keyframes tmBeat {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.25); }
}

/* ── Notice bar ─────────────────────────────────────────────── */
.tm-popup-notice {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: .85rem;
    color: #92400e;
}
.tm-popup-notice-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #92400e;
    line-height: 1;
    flex-shrink: 0;
    padding: 0;
}

/* ── Title & Users ──────────────────────────────────────────── */
.tm-popup-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
    line-height: 1.4;
}
.tm-popup-users {
    font-size: .875rem;
    color: #6b7280;
    margin: 0 0 16px;
}

/* ── Benefits ───────────────────────────────────────────────── */
.tm-popup-benefits {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.tm-benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: .875rem;
    color: #15803d;
    line-height: 1.5;
}
.tm-benefit-icon { flex-shrink: 0; }

/* ── Instruction ────────────────────────────────────────────── */
.tm-popup-instruction {
    font-size: .9rem;
    color: #475569;
    margin: 0 0 16px;
    font-style: italic;
}

/* ── Steps ──────────────────────────────────────────────────── */
.tm-popup-step {
    margin-bottom: 18px;
}
.tm-step-label {
    font-size: .9rem;
    color: #1e293b;
    margin: 0 0 10px;
    line-height: 1.6;
}
.tm-step-label a {
    color: #2563eb;
    text-decoration: underline;
}
.tm-step-visual {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .875rem;
    color: #475569;
}
.tm-step-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ── Keyword ────────────────────────────────────────────────── */
.tm-keyword-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f9ff;
    border: 2px dashed #38bdf8;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.tm-keyword {
    font-weight: 700;
    font-size: 1rem;
    color: #0369a1;
    flex: 1;
    word-break: break-all;
}
.tm-copy-btn {
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: .8rem;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.tm-copy-btn:hover  { background: #0284c7; }
.tm-copy-btn.copied { background: #16a34a; }

/* ── Google mock ────────────────────────────────────────────── */
.tm-google-mock {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* Logo Google căn giữa */
.tm-google-logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 10px;
    text-align: center;   /* ← căn giữa */
}

.tm-google-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: .9rem;
    color: #374151;
}
.tm-google-search-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.tm-google-keyword-text { word-break: break-all; }
.tm-google-result-img {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
}
.tm-google-result-img img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* ── External link button ───────────────────────────────────── */
.tm-external-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2563eb;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: .9rem;
    font-weight: 600;
    transition: background .2s;
    margin-top: 6px;
}
.tm-external-link-btn:hover { background: #1d4ed8; }

/* ── Share buttons ──────────────────────────────────────────── */
.tm-share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.tm-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: opacity .2s;
}
.tm-share-btn:hover { opacity: .85; }
.tm-share-fb   { background: #1877f2; color: #fff !important; }
.tm-share-zalo { background: #0068ff; color: #fff !important; }

/* ── Unlock input ───────────────────────────────────────────── */
.tm-popup-unlock-wrap {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.tm-code-input {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: .9rem;
    outline: none;
    transition: border-color .2s;
    min-width: 0;
}
.tm-code-input:focus { border-color: #6366f1; }
.tm-code-input.tm-shake {
    animation: tmShake .4s;
    border-color: #ef4444;
}
@keyframes tmShake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-7px); }
    40%      { transform: translateX(7px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}
.tm-popup-unlock-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 11px 22px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .2s;
    flex-shrink: 0;
}
.tm-popup-unlock-btn:disabled          { opacity: .6; cursor: not-allowed; }
.tm-popup-unlock-btn:hover:not(:disabled) { opacity: .9; }
.tm-code-error {
    color: #ef4444;
    font-size: .85rem;
    margin: 8px 0 0;
    display: none;
}

/* ── Mission wrap ───────────────────────────────────────────── */
.tm-mission-wrap {
    display: flex;
    flex-direction: column;
}

/* ── Countdown Bar ──────────────────────────────────────────── */
.tm-countdown-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 9px 14px;
    margin-bottom: 18px;
    font-size: .875rem;
    color: #0369a1;
}
.tm-countdown-label { font-weight: 500; }
.tm-countdown {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0369a1;
    min-width: 44px;
    text-align: right;
    transition: color .3s;
}
.tm-countdown-urgent {
    color: #ef4444 !important;
    animation: tmCountdownBlink .8s infinite;
}
@keyframes tmCountdownBlink {
    0%,100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* ── Timeout Overlay ────────────────────────────────────────── */
.tm-timeout-overlay {
    position: absolute;
    inset: 0;                          /* phủ toàn popup như cũ */
    background: rgba(255,255,255,.96);
    border-radius: 16px;
    z-index: 10;
    display: flex;
    align-items: flex-start;           /* align lên trên */
    justify-content: center;
    padding-top: 100px;                /* ← box thông báo cách top 100px */
    backdrop-filter: blur(2px);
}
.tm-timeout-box { text-align: center; max-width: 340px; }
.tm-timeout-icon {
    font-size: 3.2rem;
    margin-bottom: 14px;
    animation: tmTimeoutShake .5s ease;
    display: block;
}
@keyframes tmTimeoutShake {
    0%,100% { transform: rotate(0); }
    25%      { transform: rotate(-15deg); }
    75%      { transform: rotate(15deg); }
}
.tm-timeout-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ef4444;
    margin: 0 0 10px;
}
.tm-timeout-msg {
    font-size: .9rem;
    color: #64748b;
    line-height: 1.7;
    margin: 0 0 22px;
}
.tm-timeout-reload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 30px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
}
.tm-timeout-reload-btn:hover  { opacity: .9; transform: translateY(-1px); }
.tm-timeout-reload-btn:active { transform: translateY(0); }

/* ── Retry button ───────────────────────────────────────────── */
.tm-retry-btn {
    display: block;
    margin: 12px auto 0;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 24px;
    font-size: .9rem;
    cursor: pointer;
    transition: opacity .2s;
}
.tm-retry-btn:hover { opacity: .85; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .tm-popup-overlay { padding: 20px 12px; }
    .tm-popup { padding: 22px 16px 20px; }
    .tm-popup-unlock-wrap { flex-direction: column; }
    .tm-popup-unlock-btn  { width: 100%; }
    .tm-share-buttons     { flex-direction: column; }
    .tm-share-btn         { justify-content: center; }
}


/* ── Success message ────────────────────────────────────────── */
.tm-success-msg {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px 16px;
    color: #16a34a;
    font-weight: 600;
    font-size: .95rem;
    text-align: center;
    margin-bottom: 16px;
    animation: tmFadeIn .3s ease;
}
@keyframes tmFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}