/**
 * Trial License Popup - CSS v3.0
 * Dark theme with Telegram integration
 */

/* ── Variables ── */
:root {
    --tlp-bg-overlay: rgba(10, 15, 30, 0.88);
    --tlp-modal-bg: #0d1117;
    --tlp-modal-border: rgba(255,255,255,0.08);
    --tlp-input-bg: #6c7a8a;
    --tlp-input-border: transparent;
    --tlp-input-text: #ffffff;
    --tlp-input-placeholder: rgba(255,255,255,0.7);
    --tlp-accent: #4a8fff;
    --tlp-accent-hover: #3a7aee;
    --tlp-text: #ffffff;
    --tlp-text-muted: rgba(255,255,255,0.65);
    --tlp-success: #4caf7d;
    --tlp-error-bg: rgba(239, 83, 80, 0.15);
    --tlp-error-border: rgba(239, 83, 80, 0.6);
    --tlp-error-text: #ff6b6b;
    --tlp-telegram: #0088cc;
    --tlp-telegram-hover: #0077b5;
    --tlp-radius: 12px;
    --tlp-radius-sm: 8px;
    --tlp-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

/* ── Overlay ── */
.tlp-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tlp-bg-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tlp-overlay.tlp-active {
    opacity: 1;
}

/* ── Modal ── */
.tlp-modal {
    position: relative;
    background: var(--tlp-modal-bg);
    border: 1px solid var(--tlp-modal-border);
    border-radius: var(--tlp-radius);
    box-shadow: var(--tlp-shadow);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 28px 28px;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
    color: var(--tlp-text);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.tlp-overlay.tlp-active .tlp-modal {
    transform: translateY(0) scale(1);
}

.tlp-modal::-webkit-scrollbar { width: 5px; }
.tlp-modal::-webkit-scrollbar-track { background: transparent; }
.tlp-modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ── Close button ── */
.tlp-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: var(--tlp-text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    z-index: 1;
}
.tlp-close:hover {
    color: var(--tlp-text);
    background: rgba(255,255,255,0.08);
}

/* ── Step indicator ── */
.tlp-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
}

.tlp-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.tlp-step.tlp-step-active { opacity: 1; }
.tlp-step.tlp-step-done   { opacity: 0.85; }

.tlp-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.3s, border-color 0.3s;
}

.tlp-step.tlp-step-active .tlp-step-num {
    background: var(--tlp-accent);
    border-color: var(--tlp-accent);
}

.tlp-step.tlp-step-done .tlp-step-num {
    background: var(--tlp-success);
    border-color: var(--tlp-success);
}

.tlp-step-label {
    font-size: 11px;
    color: var(--tlp-text-muted);
    white-space: nowrap;
}

.tlp-step.tlp-step-active .tlp-step-label { color: var(--tlp-text); }

.tlp-step-line {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.12);
    min-width: 40px;
    margin-bottom: 18px;
    transition: background 0.3s;
}

/* ── Modal header ── */
.tlp-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.tlp-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--tlp-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.tlp-subtitle {
    font-size: 13px;
    color: var(--tlp-text-muted);
    margin: 0;
}

/* ── Form fields ── */
.tlp-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tlp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tlp-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--tlp-text-muted);
    display: block;
}

.tlp-required {
    color: #ff6b6b;
    margin-left: 2px;
}

.tlp-field input,
.tlp-field select {
    background: var(--tlp-input-bg) !important;
    border: 1px solid var(--tlp-input-border) !important;
    border-radius: var(--tlp-radius-sm) !important;
    color: var(--tlp-input-text) !important;
    font-size: 14px;
    padding: 12px 16px !important;
    width: 100%;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.tlp-field input::placeholder {
    color: var(--tlp-input-placeholder) !important;
}

.tlp-field input:focus,
.tlp-field select:focus {
    border-color: var(--tlp-accent) !important;
    box-shadow: 0 0 0 3px rgba(74,143,255,0.18) !important;
}

.tlp-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 40px !important;
    cursor: pointer;
}

.tlp-field select option {
    background: #1a2035;
    color: #fff;
}

/* ── Telegram button (Survey step) ── */
.tlp-telegram-field {
    margin-top: 2px;
}

.tlp-telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--tlp-telegram);
    color: #fff !important;
    border-radius: var(--tlp-radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s, transform 0.1s;
    cursor: pointer;
}

.tlp-telegram-btn:hover {
    background: var(--tlp-telegram-hover);
    color: #fff !important;
}

.tlp-telegram-btn:active {
    transform: scale(0.98);
}

.tlp-telegram-btn svg {
    flex-shrink: 0;
}

/* Telegram shake animation when not joined */
@keyframes tlp-telegram-shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-6px); }
    30%, 60%, 90% { transform: translateX(6px); }
}

.tlp-telegram-shake {
    animation: tlp-telegram-shake 0.5s ease;
    box-shadow: 0 0 0 2px var(--tlp-error-text) !important;
}

/* ── Telegram button (License step) ── */
.tlp-btn-telegram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--tlp-telegram) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--tlp-radius-sm);
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s, transform 0.1s;
    cursor: pointer;
    width: 100%;
    margin-bottom: 8px;
}

.tlp-btn-telegram:hover {
    background: var(--tlp-telegram-hover) !important;
    color: #fff !important;
}

.tlp-btn-telegram:active {
    transform: scale(0.98);
}

/* ── Error message ── */
.tlp-error-msg {
    background: var(--tlp-error-bg);
    border: 1px solid var(--tlp-error-border);
    border-radius: var(--tlp-radius-sm);
    color: var(--tlp-error-text);
    font-size: 13px;
    padding: 10px 14px;
    text-align: center;
}

/* ── Buttons ── */
.tlp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--tlp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 22px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    border: none;
    width: 100%;
    text-align: center;
}

.tlp-btn:active { transform: scale(0.98); }
.tlp-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.tlp-btn-primary {
    background: var(--tlp-accent);
    color: #fff;
}
.tlp-btn-primary:hover:not(:disabled) {
    background: var(--tlp-accent-hover);
}

.tlp-btn-outline {
    background: rgba(255,255,255,0.08);
    color: var(--tlp-text);
    border: 1px solid rgba(255,255,255,0.15) !important;
    width: auto;
    flex: 1;
}
.tlp-btn-outline:hover:not(:disabled) {
    background: rgba(255,255,255,0.14);
}

.tlp-btn-ghost {
    background: transparent;
    color: var(--tlp-text-muted);
    border: 1px solid rgba(255,255,255,0.1) !important;
    margin-top: 8px;
}
.tlp-btn-ghost:hover { color: var(--tlp-text); background: rgba(255,255,255,0.05); }

.tlp-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spinner */
.tlp-spinner {
    animation: tlp-spin 0.8s linear infinite;
}
@keyframes tlp-spin { to { transform: rotate(360deg); } }

/* ── Step 2: Captcha ── */
.tlp-captcha-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0;
}

.tlp-captcha-icon {
    color: var(--tlp-accent);
    margin-bottom: 16px;
}

.tlp-captcha-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--tlp-text);
}

.tlp-captcha-sub {
    font-size: 13px;
    color: var(--tlp-text-muted);
    margin: 0 0 24px;
}

.tlp-recaptcha-container {
    display: flex;
    justify-content: center;
    min-height: 78px;
}

/* Override reCAPTCHA background to fit dark modal */
.tlp-recaptcha-container .g-recaptcha,
.tlp-recaptcha-container > div {
    border-radius: var(--tlp-radius-sm);
    overflow: hidden;
}

/* ── Step 3: License ── */
.tlp-license-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0;
}

.tlp-success-icon {
    color: var(--tlp-success);
    margin-bottom: 14px;
    animation: tlp-pop 0.4s ease;
}

@keyframes tlp-pop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.tlp-license-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--tlp-text);
}

.tlp-license-sub {
    font-size: 13px;
    color: var(--tlp-text-muted);
    margin: 0 0 18px;
}

.tlp-license-box {
    background: var(--tlp-input-bg);
    border-radius: var(--tlp-radius-sm);
    padding: 16px 20px;
    width: 100%;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.tlp-license-key {
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1.5px;
    word-break: break-all;
}

.tlp-license-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
}

.tlp-copy-msg {
    font-size: 13px;
    color: var(--tlp-success);
    margin-bottom: 8px;
    animation: tlp-fade-in 0.3s ease;
}

@keyframes tlp-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tlp-license-note {
    font-size: 12px;
    color: var(--tlp-text-muted);
    margin: 8px 0 16px;
    line-height: 1.5;
}

/* ── Trigger button (shortcode) ── */
.tsp-trigger-btn,
.tlp-trigger-btn {
    background: var(--tlp-accent);
    color: #fff;
    border: none;
    border-radius: var(--tlp-radius-sm);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tsp-trigger-btn:hover,
.tlp-trigger-btn:hover { background: var(--tlp-accent-hover); }
.tsp-trigger-btn:active,
.tlp-trigger-btn:active { transform: scale(0.98); }

/* ── Responsive ── */
@media (max-width: 480px) {
    .tlp-modal {
        padding: 24px 18px 20px;
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }
    .tlp-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .tlp-title { font-size: 16px; }
    .tlp-license-key { font-size: 14px; letter-spacing: 1px; }
}
