/**
 * Madara Chapter Locker — Public / Frontend Styles
 *
 * @package MadaraChapterLocker
 */

/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
    --mcl-primary:    #6c63ff;
    --mcl-primary-2:  #9333ea;
    --mcl-dark:       #1a1a2e;
    --mcl-surface:    #16213e;
    --mcl-success:    #22c55e;
    --mcl-text:       #f1f5f9;
    --mcl-muted:      #94a3b8;
    --mcl-border:     rgba(255,255,255,.12);
    --mcl-radius:     18px;
    --mcl-font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mcl-shadow:     0 12px 48px rgba(0,0,0,.5);
    --mcl-trans:      .22s cubic-bezier(.4,0,.2,1);
}

/* ─── Lock Icons in Chapter List ─────────────────────────────────────────── */

/* Added by JS to <li> or <a> elements in the chapter list */
.mcl-chapter-locked-item {
    position: relative;
}

.mcl-lock-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #6c63ff, #9333ea);
    border-radius: 4px;
    margin-right: 6px;
    flex-shrink: 0;
    vertical-align: middle;
}

.mcl-lock-icon svg {
    width: 11px;
    height: 11px;
    stroke: #fff;
}

/* Badge that appears next to the chapter title */
.mcl-chapter-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(135deg, rgba(108,99,255,.15), rgba(147,51,234,.15));
    border: 1px solid rgba(108,99,255,.35);
    color: #a78bfa;
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.mcl-chapter-unlocked-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(34,197,94,.1);
    border: 1px solid rgba(34,197,94,.3);
    color: #22c55e;
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ─── Locker Overlay ─────────────────────────────────────────────────────── */

.mcl-locker-overlay {
    position: relative;
    width: 100%;
    font-family: var(--mcl-font);
    padding: 20px 0;
}

.mcl-locker-card {
    background: linear-gradient(160deg, rgba(26,26,46,.97) 0%, rgba(22,33,62,.97) 100%);
    border: 1px solid var(--mcl-border);
    border-radius: var(--mcl-radius);
    box-shadow: var(--mcl-shadow);
    padding: 40px 40px 32px;
    margin: 0 auto;
    max-width: 520px;
    text-align: center;
    color: var(--mcl-text);
    position: relative;
    overflow: hidden;
}

/* Decorative glow */
.mcl-locker-card::before {
    content: '';
    position: absolute;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(108,99,255,.2) 0%, transparent 65%);
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Lock icon */
.mcl-locker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(108,99,255,.25), rgba(147,51,234,.25));
    border: 2px solid rgba(108,99,255,.4);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: mclLockPulse 2.5s ease-in-out infinite;
}
.mcl-locker-icon svg { stroke: #a78bfa; }
@keyframes mclLockPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(108,99,255,.4); transform: scale(1); }
    50%       { box-shadow: 0 0 0 14px rgba(108,99,255,0); transform: scale(1.04); }
}
.mcl-unlocked .mcl-locker-icon svg { stroke: #4ade80; }
.mcl-unlocked .mcl-locker-icon { border-color: rgba(34,197,94,.4); animation: none; }

.mcl-locker-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 10px;
    color: #fff;
    letter-spacing: -.02em;
}

.mcl-locker-desc {
    font-size: .95rem;
    color: var(--mcl-muted);
    margin: 0 0 28px;
    line-height: 1.65;
}

/* ─── Progress ───────────────────────────────────────────────────────────── */

.mcl-steps-container { margin: 0 0 24px; }
.mcl-steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.mcl-steps-label { font-size: .78rem; color: var(--mcl-muted); }
.mcl-steps-count { font-size: .78rem; font-weight: 700; color: var(--mcl-primary); }

.mcl-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,.1);
    border-radius: 10px;
    overflow: hidden;
}
.mcl-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mcl-primary), #a78bfa);
    border-radius: 10px;
    transition: width .5s ease;
}

.mcl-step-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}
.mcl-step-dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    transition: all var(--mcl-trans);
    display: flex; align-items: center; justify-content: center;
}
.mcl-step-dot.completed { background: var(--mcl-success); box-shadow: 0 0 8px rgba(34,197,94,.5); }
.mcl-step-dot.completed svg { stroke: #fff; width: 11px; height: 11px; }
.mcl-step-dot.current { background: var(--mcl-primary); box-shadow: 0 0 10px rgba(108,99,255,.6); transform: scale(1.3); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.mcl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 32px;
    border: none;
    border-radius: 50px;
    font-family: var(--mcl-font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    transition: all var(--mcl-trans);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}
.mcl-btn:hover::after { background: rgba(255,255,255,.12); }
.mcl-btn::after { content: ''; position: absolute; inset: 0; background: transparent; transition: background var(--mcl-trans); }

.mcl-btn--primary {
    background: linear-gradient(135deg, var(--mcl-primary), var(--mcl-primary-2));
    color: #fff;
    box-shadow: 0 4px 24px rgba(108,99,255,.4);
    width: 100%;
    font-size: 1.05rem;
}
.mcl-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(108,99,255,.55); color: #fff; }
.mcl-btn--primary:active { transform: translateY(0); }
.mcl-btn:disabled, .mcl-btn.loading { opacity: .6; cursor: not-allowed; transform: none !important; }
.mcl-btn-icon { display: inline-flex; align-items: center; }
.mcl-btn-icon svg { width: 18px; height: 18px; }

/* ─── Countdown ──────────────────────────────────────────────────────────── */

.mcl-countdown-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: rgba(108,99,255,.1);
    border: 1px solid rgba(108,99,255,.25);
    border-radius: 12px;
}
.mcl-countdown-wrap.visible { display: flex; }
.mcl-countdown-label { font-size: .8rem; color: var(--mcl-muted); }
.mcl-countdown-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--mcl-primary);
    font-variant-numeric: tabular-nums;
    min-width: 2.2ch;
    text-align: center;
}

/* ─── Status messages ────────────────────────────────────────────────────── */

.mcl-status-msg {
    padding: 11px 16px;
    border-radius: 10px;
    font-size: .875rem;
    margin-bottom: 18px;
    display: none;
    text-align: left;
    border: 1px solid transparent;
}
.mcl-status-msg.visible { display: block; }
.mcl-status-msg.success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #4ade80; }
.mcl-status-msg.error   { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #f87171; }
.mcl-status-msg.info    { background: rgba(108,99,255,.1); border-color: rgba(108,99,255,.3); color: #a78bfa; }

/* ─── Unlocked state ─────────────────────────────────────────────────────── */

.mcl-unlocked-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: linear-gradient(135deg, rgba(34,197,94,.15), rgba(20,184,166,.15));
    border: 1px solid rgba(34,197,94,.35);
    border-radius: 50px;
    color: #4ade80;
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 18px;
    animation: mclUnlockBounce .5s ease;
}
@keyframes mclUnlockBounce {
    0%  { transform: scale(.8); opacity: 0; }
    60% { transform: scale(1.08); }
    100%{ transform: scale(1); opacity: 1; }
}

/* ─── Info row ───────────────────────────────────────────────────────────── */

.mcl-visit-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--mcl-border);
    flex-wrap: wrap;
}
.mcl-visit-info-item { text-align: center; font-size: .78rem; color: var(--mcl-muted); }
.mcl-visit-info-item strong { display: block; color: var(--mcl-text); font-size: .95rem; font-weight: 700; }

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.mcl-spin { animation: mclSpinAnim .65s linear infinite; }
@keyframes mclSpinAnim { to { transform: rotate(360deg); } }

/* ─── Chapter-list unlock modal ──────────────────────────────────────────── */

.mcl-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.mcl-modal-backdrop.mcl-modal-visible {
    display: flex;
    animation: mclModalIn .22s cubic-bezier(.4,0,.2,1) both;
}
@keyframes mclModalIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mcl-modal-wrap {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: auto;
    animation: mclModalSlideIn .25s cubic-bezier(.4,0,.2,1) both;
}
@keyframes mclModalSlideIn {
    from { transform: translateY(28px) scale(.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* Make the locker card fill the modal wrapper */
.mcl-modal-wrap .mcl-locker-overlay { padding: 0; }
.mcl-modal-wrap .mcl-locker-card    { max-width: 100%; }

/* Close button (top-right corner of the card) */
.mcl-modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6c63ff, #9333ea);
    box-shadow: 0 4px 14px rgba(108,99,255,.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s, box-shadow .18s;
    padding: 0;
    overflow: hidden;
}
.mcl-modal-close:hover  { transform: scale(1.12); box-shadow: 0 6px 20px rgba(108,99,255,.7); }
.mcl-modal-close:active { transform: scale(.96); }
.mcl-modal-close > svg  { display: none; }

/* Prevent body scroll while modal is open */
body.mcl-modal-open { overflow: hidden; }

/* ─── Links Modal ────────────────────────────────────────────────────────── */

.mcl-links-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000000;
    background: rgba(0, 0, 0, .78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.mcl-links-backdrop.mcl-links-visible {
    display: flex;
    animation: mclModalIn .22s cubic-bezier(.4,0,.2,1) both;
}

.mcl-links-panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: auto;
    background: linear-gradient(160deg, rgba(26,26,46,.98) 0%, rgba(22,33,62,.98) 100%);
    border: 1px solid var(--mcl-border);
    border-radius: var(--mcl-radius);
    box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 0 80px rgba(108,99,255,.15);
    padding: 36px 32px 28px;
    color: var(--mcl-text);
    animation: mclModalSlideIn .25s cubic-bezier(.4,0,.2,1) both;
    overflow: hidden;
}
.mcl-links-panel::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(108,99,255,.15) 0%, transparent 65%);
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.mcl-links-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.06);
    color: var(--mcl-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all .18s;
    padding: 0;
    line-height: 1;
}
.mcl-links-close:hover { background: rgba(255,255,255,.12); color: #fff; }

.mcl-links-header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}
.mcl-links-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(108,99,255,.25), rgba(147,51,234,.25));
    border: 2px solid rgba(108,99,255,.4);
    border-radius: 50%;
    margin: 0 auto 14px;
}
.mcl-links-header-icon svg { stroke: #a78bfa; width: 28px; height: 28px; }
.mcl-links-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
}
.mcl-links-desc {
    font-size: .85rem;
    color: var(--mcl-muted);
    margin: 0;
    line-height: 1.5;
}

/* Individual link items */
.mcl-links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mcl-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    transition: all .22s;
}
.mcl-link-item:hover { background: rgba(255,255,255,.07); }
.mcl-link-item.mcl-link-completed {
    background: rgba(34,197,94,.08);
    border-color: rgba(34,197,94,.25);
}
.mcl-link-item.mcl-link-visiting {
    background: rgba(108,99,255,.08);
    border-color: rgba(108,99,255,.3);
}

.mcl-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(108,99,255,.15);
    transition: all .22s;
}
.mcl-link-icon svg { width: 18px; height: 18px; stroke: #a78bfa; }
.mcl-link-completed .mcl-link-icon {
    background: rgba(34,197,94,.2);
}
.mcl-link-completed .mcl-link-icon svg { stroke: #4ade80; }
.mcl-link-visiting .mcl-link-icon {
    background: rgba(108,99,255,.2);
    animation: mclLinkPulse 1.5s ease-in-out infinite;
}
@keyframes mclLinkPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(108,99,255,.3); }
    50% { box-shadow: 0 0 0 6px rgba(108,99,255,0); }
}

.mcl-link-info {
    flex: 1;
    min-width: 0;
}
.mcl-link-label {
    display: block;
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mcl-link-meta {
    display: block;
    font-size: .75rem;
    color: var(--mcl-muted);
    margin-top: 2px;
}
.mcl-link-completed .mcl-link-meta { color: #4ade80; }
.mcl-link-visiting .mcl-link-meta { color: #a78bfa; }

.mcl-link-countdown {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--mcl-primary);
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
    text-align: center;
    flex-shrink: 0;
    display: none;
}
.mcl-link-visiting .mcl-link-countdown { display: block; }

.mcl-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--mcl-primary), var(--mcl-primary-2));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: var(--mcl-font);
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(108,99,255,.3);
}
.mcl-link-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(108,99,255,.5); }
.mcl-link-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }
.mcl-link-btn svg { width: 14px; height: 14px; }

.mcl-link-check {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--mcl-success);
    flex-shrink: 0;
    animation: mclUnlockBounce .4s ease;
}
.mcl-link-check svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; }
.mcl-link-completed .mcl-link-check { display: flex; }
.mcl-link-completed .mcl-link-btn { display: none; }

/* Links modal progress */
.mcl-links-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.mcl-links-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,.1);
    border-radius: 10px;
    overflow: hidden;
}
.mcl-links-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mcl-primary), #a78bfa);
    border-radius: 10px;
    transition: width .5s ease;
    width: 0%;
}
.mcl-links-progress-text {
    font-size: .78rem;
    font-weight: 700;
    color: var(--mcl-primary);
    white-space: nowrap;
}

.mcl-links-status {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: .82rem;
    text-align: center;
    display: none;
    border: 1px solid transparent;
    margin-bottom: 14px;
}
.mcl-links-status.visible { display: block; }
.mcl-links-status.success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #4ade80; }
.mcl-links-status.error   { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #f87171; }
.mcl-links-status.info    { background: rgba(108,99,255,.1); border-color: rgba(108,99,255,.3); color: #a78bfa; }

.mcl-links-verify-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50px;
    color: var(--mcl-muted);
    font-family: var(--mcl-font);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
}
.mcl-links-verify-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.mcl-links-verify-btn svg { width: 16px; height: 16px; }

/* Loading state inside links modal */
.mcl-links-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .mcl-locker-card  { padding: 28px 20px 24px; }
    .mcl-locker-title { font-size: 1.3rem; }
    .mcl-btn--primary { padding: 13px 24px; }
    .mcl-modal-close  { top: -10px; right: -10px; width: 30px; height: 30px; }
    .mcl-links-panel  { padding: 28px 18px 22px; }
    .mcl-link-item    { padding: 12px; gap: 10px; }
    .mcl-link-btn     { padding: 7px 12px; font-size: .75rem; }
    .mcl-links-title  { font-size: 1.1rem; }
}

