/**
 * Ẩn Nội Dung Pro — Frontend styles.
 *
 * Architecture:
 *  - CSS custom properties (--anopro-*) set per-wrapper via inline style
 *  - Base styles use var() with fallbacks
 *  - Template classes (.anopro-template-*) override layout/feel
 *  - Button classes (.anopro-btn-*) override button look
 *  - Mobile responsive via @media
 *
 * States: form, checking, error, locked, countdown, loading, unlocked.
 *
 * @package AnoiDungPro
 */

/* ═══════════════════════════════════════════════════
 *  BASE — CSS Custom Properties + Core Structure
 * ═══════════════════════════════════════════════════ */

.anopro-wrapper {
    position: relative;
    border: var(--anopro-border-width, 1px) var(--anopro-border-style, solid) var(--anopro-border-color, #e2e8f0);
    border-radius: var(--anopro-box-radius, 10px);
    background: var(--anopro-bg, #f8fafc);
    padding: var(--anopro-box-padding, 24px);
    margin: 20px 0;
    max-width: var(--anopro-max-width, 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    box-shadow: var(--anopro-box-shadow, 0 1px 3px rgba(0, 0, 0, 0.06));
    transition: box-shadow 0.3s ease;
    box-sizing: border-box;
}

.anopro-wrapper *,
.anopro-wrapper *::before,
.anopro-wrapper *::after {
    box-sizing: border-box;
}

.anopro-wrapper:hover {
    box-shadow: var(--anopro-box-shadow-hover, 0 2px 8px rgba(0, 0, 0, 0.1));
}

/* ─── Label ────────────────────────────────────── */

.anopro-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ─── Intro content ───────────────────────────── */

.anopro-intro {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    line-height: 1.5;
}

.anopro-intro p {
    margin: 0 0 6px;
}

.anopro-intro a {
    color: var(--anopro-btn-primary, #2563eb);
    text-decoration: underline;
}

/* ─── Remember checkbox ───────────────────────── */

.anopro-remember-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    margin-top: 8px;
    cursor: pointer;
    user-select: none;
}

.anopro-remember-check {
    margin: 0;
    cursor: pointer;
    accent-color: var(--anopro-btn-primary, #2563eb);
}

/* ─── Input group (flex container) ─────────────── */

.anopro-input-group {
    display: flex;
    flex-direction: var(--anopro-direction, row);
    gap: var(--anopro-gap, 0);
    max-width: 480px;
    align-items: stretch;
}

/* ─── Password input ──────────────────────────── */

.anopro-password-input {
    flex: var(--anopro-input-w, 1);
    min-width: 0;
    padding: 10px 14px;
    font-size: var(--anopro-input-font, 15px);
    border: 1px solid #cbd5e1;
    border-radius: var(--anopro-input-radius, 8px 0 0 8px);
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
}

.anopro-password-input:focus {
    border-color: var(--anopro-focus, #bb0000);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--anopro-focus, #bb0000) 12%, transparent);
}

.anopro-password-input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
 *  BUTTON — Base + 7 Styles
 * ═══════════════════════════════════════════════════ */

.anopro-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: var(--anopro-btn-padding, 10px 20px);
    font-size: 14px;
    font-weight: 600;
    color: var(--anopro-btn-text, #fff);
    background: var(--anopro-primary, #bb0000);
    border: 2px solid var(--anopro-primary, #bb0000);
    border-radius: var(--anopro-btn-radius, 0 8px 8px 0);
    cursor: pointer;
    white-space: nowrap;
    text-transform: var(--anopro-btn-transform, none);
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease, color 0.2s ease;
    -webkit-appearance: none;
    line-height: 1.4;
}

.anopro-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Icon inside button */
.anopro-btn-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.anopro-btn-icon svg {
    display: block;
}

/* Button full width */
.anopro-btn-full .anopro-submit-btn {
    width: 100%;
}

/* ─── Style: solid (default) ─────────────────── */

.anopro-btn-solid .anopro-submit-btn:hover:not(:disabled) {
    background: var(--anopro-hover, #a00000);
    border-color: var(--anopro-hover, #a00000);
}

.anopro-btn-solid .anopro-submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* ─── Style: outline ─────────────────────────── */

.anopro-btn-outline .anopro-submit-btn {
    background: transparent;
    color: var(--anopro-primary, #bb0000);
}

.anopro-btn-outline .anopro-submit-btn:hover:not(:disabled) {
    background: var(--anopro-primary, #bb0000);
    color: #fff;
}

/* ─── Style: gradient ────────────────────────── */

.anopro-btn-gradient .anopro-submit-btn {
    background: linear-gradient(135deg, var(--anopro-primary, #ea580c), var(--anopro-hover, #dc2626));
    border-color: transparent;
}

.anopro-btn-gradient .anopro-submit-btn:hover:not(:disabled) {
    box-shadow: 0 0 20px color-mix(in srgb, var(--anopro-primary, #ea580c) 40%, transparent);
    transform: translateY(-1px);
}

.anopro-btn-gradient .anopro-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* ─── Style: soft ────────────────────────────── */

.anopro-btn-soft .anopro-submit-btn {
    background: color-mix(in srgb, var(--anopro-primary, #bb0000) 12%, transparent);
    color: var(--anopro-primary, #bb0000);
    border-color: transparent;
}

.anopro-btn-soft .anopro-submit-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--anopro-primary, #bb0000) 20%, transparent);
}

/* ─── Style: 3d ──────────────────────────────── */

.anopro-btn-3d .anopro-submit-btn {
    box-shadow: var(--anopro-btn-shadow, 0 4px 0 #8b0000);
    transform: translateY(0);
}

.anopro-btn-3d .anopro-submit-btn:hover:not(:disabled) {
    background: var(--anopro-hover, #a00000);
    border-color: var(--anopro-hover, #a00000);
    transform: translateY(-2px);
    box-shadow: var(--anopro-btn-shadow, 0 6px 0 #8b0000);
}

.anopro-btn-3d .anopro-submit-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--anopro-primary, #bb0000) 60%, #000);
}

/* ─── Style: pill ────────────────────────────── */

.anopro-btn-pill .anopro-submit-btn {
    border-radius: 50px;
    padding: 10px 28px;
}

.anopro-btn-pill .anopro-submit-btn:hover:not(:disabled) {
    background: var(--anopro-hover, #a00000);
    border-color: var(--anopro-hover, #a00000);
    transform: scale(1.03);
}

/* ─── Style: link ────────────────────────────── */

.anopro-btn-link .anopro-submit-btn {
    background: transparent;
    border-color: transparent;
    color: var(--anopro-primary, #bb0000);
    padding: 10px 8px;
    text-decoration: underline;
}

.anopro-btn-link .anopro-submit-btn:hover:not(:disabled) {
    color: var(--anopro-hover, #a00000);
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════
 *  MESSAGE / COUNTDOWN / LOADING
 * ═══════════════════════════════════════════════════ */

.anopro-message-area {
    margin-top: 10px;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 6px;
    transition: opacity 0.3s ease;
}

.anopro-message-area:empty {
    display: none;
}

.anopro-msg-error {
    color: #dc2626;
    background: #fef2f2;
    padding: 10px 14px;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.anopro-msg-warning {
    color: #d97706;
    background: #fffbeb;
    padding: 10px 14px;
    border: 1px solid #fde68a;
    border-radius: 6px;
}

.anopro-msg-success {
    color: #16a34a;
    background: #f0fdf4;
    padding: 10px 14px;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
}

.anopro-msg-locked {
    color: #9333ea;
    background: #faf5ff;
    padding: 10px 14px;
    border: 1px solid #e9d5ff;
    border-radius: 6px;
}

/* Countdown */
.anopro-countdown-area {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--anopro-primary, #bb0000);
    animation: anopro-pulse 2s ease-in-out infinite;
}

@keyframes anopro-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

/* Loading */
.anopro-loading-area {
    text-align: center;
    padding: 20px;
    font-size: 15px;
    color: #64748b;
}

.anopro-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--anopro-primary, #bb0000);
    border-radius: 50%;
    animation: anopro-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes anopro-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════
 *  CONTENT AREA (after unlock)
 * ═══════════════════════════════════════════════════ */

.anopro-content-area {
    line-height: 1.7;
    color: #1e293b;
}

.anopro-content-area:empty {
    display: none;
}

/* Animation: fade */
.anopro-content-reveal {
    animation: anopro-fadeIn 0.5s ease-out;
}

@keyframes anopro-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Animation: slide */
.anopro-anim-slide {
    animation: anopro-slideIn 0.4s ease-out;
}

@keyframes anopro-slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Animation: scale */
.anopro-anim-scale {
    animation: anopro-scaleIn 0.35s ease-out;
}

@keyframes anopro-scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* State: checking */
.anopro-checking .anopro-submit-btn {
    position: relative;
}

/* State: unlocked */
.anopro-wrapper[data-state="unlocked"] {
    border-color: #bbf7d0;
    background: #fff;
}

/* ─── Phase 7: Unlock Counter ───────────────────── */

.anopro-unlock-count {
    font-size: 0.85em;
    color: var(--anopro-text-muted, #888);
    margin-top: 8px;
    text-align: center;
    padding: 4px 0;
}

/* ─── Phase 7: Source Gate ───────────────────────── */

.anopro-gate-checking {
    text-align: center;
    padding: 20px 16px;
    color: var(--anopro-text-muted, #888);
    font-size: 0.9em;
}

.anopro-gate-fail {
    text-align: center;
    padding: 16px;
    color: var(--anopro-error, #d63638);
    font-size: 0.9em;
    line-height: 1.5;
}

/* ─── Notices ─────────────────────────────────── */

.anopro-notice {
    padding: 16px 20px;
    margin: 16px 0;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
    font-size: 14px;
    line-height: 1.5;
}

.anopro-error {
    padding: 16px 20px;
    margin: 16px 0;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    line-height: 1.5;
}

/* Countdown pill style */
.anopro-countdown-pill {
    display: inline-block;
    padding: 8px 20px;
    background: color-mix(in srgb, var(--anopro-primary, #bb0000) 10%, transparent);
    border-radius: 50px;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════
 *  TEMPLATE: basic-clean (default — already base styles)
 * ═══════════════════════════════════════════════════ */

.anopro-template-basic-clean .anopro-password-input {
    border-right: none;
}

/* ═══════════════════════════════════════════════════
 *  TEMPLATE: modern-card
 *  Card-style, centered, elevated, stacked layout
 * ═══════════════════════════════════════════════════ */

.anopro-template-modern-card {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.anopro-template-modern-card .anopro-label {
    font-size: 17px;
    color: #1e293b;
    margin-bottom: 16px;
}

.anopro-template-modern-card .anopro-input-group {
    max-width: 100%;
}

.anopro-template-modern-card .anopro-password-input {
    border: 1px solid #d1d5db;
    text-align: center;
    font-size: 15px;
    padding: 14px 16px;
}

.anopro-template-modern-card .anopro-submit-btn {
    font-size: 15px;
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════
 *  TEMPLATE: gradient-button
 *  Warm feel, pill inputs, gradient CTA button
 * ═══════════════════════════════════════════════════ */

.anopro-template-gradient-button .anopro-label {
    color: #92400e;
    font-size: 15px;
}

.anopro-template-gradient-button .anopro-input-group {
    max-width: 520px;
}

.anopro-template-gradient-button .anopro-password-input {
    border: 1px solid #fbbf24;
    padding: 12px 18px;
}

.anopro-template-gradient-button .anopro-password-input:focus {
    border-color: var(--anopro-focus, #ea580c);
}

/* ═══════════════════════════════════════════════════
 *  TEMPLATE: minimal-inline
 *  No box, tight, inline feel for body text
 * ═══════════════════════════════════════════════════ */

.anopro-template-minimal-inline {
    margin: 8px 0;
}

.anopro-template-minimal-inline .anopro-label {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

.anopro-template-minimal-inline .anopro-input-group {
    max-width: 360px;
}

.anopro-template-minimal-inline .anopro-password-input {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
}

.anopro-template-minimal-inline .anopro-submit-btn {
    font-size: 13px;
}

.anopro-template-minimal-inline .anopro-message-area {
    font-size: 13px;
    margin-top: 4px;
}

.anopro-template-minimal-inline .anopro-countdown-area,
.anopro-template-minimal-inline .anopro-loading-area {
    padding: 10px;
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════
 *  TEMPLATE: download-box
 *  File download look: left border accent, icon, stacked
 * ═══════════════════════════════════════════════════ */

.anopro-template-download-box .anopro-label {
    font-size: 16px;
    color: #0c4a6e;
    margin-bottom: 14px;
}

.anopro-template-download-box .anopro-label::before {
    content: "🔒 ";
}

.anopro-template-download-box .anopro-input-group {
    max-width: 100%;
}

.anopro-template-download-box .anopro-password-input {
    border: 1px solid #7dd3fc;
    padding: 12px 16px;
}

.anopro-template-download-box .anopro-password-input:focus {
    border-color: var(--anopro-focus, #0ea5e9);
}

.anopro-template-download-box .anopro-submit-btn {
    font-size: 15px;
    letter-spacing: 0.2px;
}

.anopro-template-download-box .anopro-countdown-area {
    color: #0369a1;
}

.anopro-template-download-box[data-state="unlocked"] {
    border-color: #34d399;
    background: #ecfdf5;
}

/* Content border for download-box */
.anopro-template-download-box .anopro-content-area:not(:empty) {
    border-top: 1px solid #e0f2fe;
    padding-top: 16px;
    margin-top: 16px;
}

/* ═══════════════════════════════════════════════════
 *  RESPONSIVE — Mobile
 * ═══════════════════════════════════════════════════ */

@media (max-width: 600px) {
    .anopro-wrapper {
        padding: var(--anopro-m-padding, 16px);
    }

    .anopro-input-group {
        flex-direction: var(--anopro-m-direction, column);
        gap: var(--anopro-m-gap, 8px);
        max-width: 100%;
    }

    .anopro-password-input {
        width: var(--anopro-m-input-w, 100%);
        flex: none;
        border-right: 1px solid #cbd5e1;
        border-radius: var(--anopro-input-radius, 8px);
    }

    .anopro-submit-btn {
        width: var(--anopro-m-btn-w, 100%);
        border-radius: var(--anopro-btn-radius, 8px);
        padding: 12px 20px;
    }

    /* Override connected border-radius for mobile stacked */
    .anopro-template-basic-clean .anopro-password-input {
        border-right: 1px solid #cbd5e1;
        border-radius: 8px;
    }

    .anopro-template-basic-clean .anopro-submit-btn {
        border-radius: 8px;
    }

    /* minimal-inline stays row on mobile if fits */
    .anopro-template-minimal-inline .anopro-input-group {
        flex-direction: var(--anopro-m-direction, row);
    }

    .anopro-template-minimal-inline .anopro-password-input {
        flex: 1;
        min-width: 0;
        border-right: 1px solid #d1d5db;
        border-radius: 6px;
    }

    .anopro-template-minimal-inline .anopro-submit-btn {
        width: auto;
        border-radius: 6px;
    }
}
