/* TheGuy Gated DM — Frontend Popup Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --tggdm-accent:   #6366f1;
    --tggdm-accent2:  #4f46e5;
    --tggdm-success:  #10b981;
    --tggdm-error:    #ef4444;
    --tggdm-radius:   14px;
    --tggdm-shadow:   0 25px 60px rgba(0,0,0,.35);
}

/* ── Button ──────────────────────────────────────────────────────────── */
.tggdm-shortcode-wrap { display:inline-block; }

.tggdm-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: linear-gradient(135deg, var(--tggdm-accent), var(--tggdm-accent2));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 26px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 4px 15px rgba(99,102,241,.4);
    letter-spacing: .2px;
}
.tggdm-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99,102,241,.5);
}
.tggdm-trigger-btn:active { transform: translateY(0); }

/* ── Overlay ─────────────────────────────────────────────────────────── */
.tggdm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body.tggdm-popup-open { overflow: hidden; }

/* ── Popup Card ──────────────────────────────────────────────────────── */
.tggdm-popup {
    background: #fff;
    border-radius: var(--tggdm-radius);
    box-shadow: var(--tggdm-shadow);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(.92) translateY(16px);
    opacity: 0;
    transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s;
    font-family: 'Inter', sans-serif;
}
.tggdm-popup.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Close Button ────────────────────────────────────────────────────── */
.tggdm-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(0,0,0,.08);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 32px;
    cursor: pointer;
    color: #64748b;
    z-index: 10;
    transition: background .15s, color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tggdm-close:hover { background: rgba(0,0,0,.15); color: #0f172a; }

/* ── Popup Header ────────────────────────────────────────────────────── */
.tggdm-popup-header {
    background: linear-gradient(135deg, var(--tggdm-accent), var(--tggdm-accent2));
    padding: 28px 28px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    color: #fff;
    border-radius: var(--tggdm-radius) var(--tggdm-radius) 0 0;
}

.tggdm-popup-icon {
    background: rgba(255,255,255,.2);
    border-radius: 10px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tggdm-popup-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
}

.tggdm-popup-desc {
    margin: 0;
    font-size: 13px;
    color: rgba(255,255,255,.8);
    line-height: 1.5;
}

/* ── Popup Body ──────────────────────────────────────────────────────── */
.tggdm-popup-body {
    padding: 28px;
}

/* ── Loader ──────────────────────────────────────────────────────────── */
.tggdm-loader {
    text-align: center;
    padding: 40px 0;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.tggdm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--tggdm-accent);
    border-radius: 50%;
    animation: tggdm-spin .7s linear infinite;
}

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

/* ── Form Fields ─────────────────────────────────────────────────────── */
.tggdm-form { display: block; }

.tggdm-field-group {
    margin-bottom: 18px;
}

.tggdm-field-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.tggdm-req-star { color: var(--tggdm-error); margin-left: 2px; }

.tggdm-field-group input[type="text"],
.tggdm-field-group input[type="email"],
.tggdm-field-group input[type="number"],
.tggdm-field-group input[type="tel"],
.tggdm-field-group select,
.tggdm-field-group textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.4 !important;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box !important;
    outline: none;
}

.tggdm-field-group input[type="text"],
.tggdm-field-group input[type="email"],
.tggdm-field-group input[type="number"],
.tggdm-field-group input[type="tel"] {
    height: 44px !important;
}

.tggdm-field-group select {
    height: 44px !important;
    padding: 10px 34px 10px 14px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #f8fafc !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 12px 12px !important;
    cursor: pointer !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.tggdm-field-group input:not([type="checkbox"]):not([type="radio"]):focus,
.tggdm-field-group select:focus,
.tggdm-field-group textarea:focus {
    border-color: var(--tggdm-accent) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15) !important;
    background-color: #fff !important;
}

.tggdm-field-group input[type="file"] {
    background: #fff;
    padding: 8px;
    border: 2px dashed #cbd5e1;
    cursor: pointer;
}

.tggdm-field-group textarea { resize: vertical; min-height: 90px; }

.tggdm-field-group.tggdm-invalid input,
.tggdm-field-group.tggdm-invalid select,
.tggdm-field-group.tggdm-invalid textarea,
input.tggdm-invalid, select.tggdm-invalid, textarea.tggdm-invalid {
    border-color: var(--tggdm-error);
    background: #fff5f5;
}

.tggdm-field-error {
    display: block;
    font-size: 12px;
    color: var(--tggdm-error);
    margin-top: 4px;
    min-height: 16px;
}

.tggdm-field-heading { font-size: 16px; font-weight: 700; color: #0f172a; margin: 8px 0 4px; }
.tggdm-field-paragraph { font-size: 13px; color: #64748b; margin: 0 0 12px; }
.tggdm-field-hint { font-size: 11px; color: #94a3b8; display: block; margin-top: 4px; }

.tggdm-inline-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
    cursor: pointer;
}
.tggdm-radio-wrap, .tggdm-check-wrap { padding: 4px 0; }

/* Force native rendering for checkbox/radio in the frontend popup */
.tggdm-popup input[type="checkbox"],
.tggdm-popup input[type="radio"] {
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    float: none !important;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    cursor: pointer;
}

/* ── Submit Button ───────────────────────────────────────────────────── */
.tggdm-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--tggdm-accent), var(--tggdm-accent2));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity .2s, transform .1s;
    margin-top: 8px;
    letter-spacing: .2px;
}
.tggdm-submit-btn:hover:not(:disabled) { opacity: .92; }
.tggdm-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

.tggdm-btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tggdm-spin .6s linear infinite;
}

/* ── Result Boxes ────────────────────────────────────────────────────── */
.tggdm-result-box {
    text-align: center;
    padding: 32px 20px;
    border-radius: 10px;
}

.tggdm-success {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    color: #166534;
}

.tggdm-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.tggdm-success-icon { font-size: 48px; margin-bottom: 12px; }
.tggdm-result-box h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.tggdm-result-box p  { margin: 0; font-size: 13px; opacity: .8; }

.tggdm-dl-link {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--tggdm-success);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
}
.tggdm-dl-link:hover { opacity: .88; }

/* ── Honeypot ────────────────────────────────────────────────────────── */
#tggdm-honeypot-wrap {
    display: none !important;
    position: absolute;
    left: -9999px;
    visibility: hidden;
}


/* ── Column Layout (2-column half-width fields) ──────────────────────── */
.tggdm-col-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    width: 100%;
}

.tggdm-col-row > * {
    min-width: 0 !important;
    max-width: 100% !important;
}

.tggdm-col-row .tggdm-field-group {
    margin-bottom: 0;
    min-width: 0 !important;
    width: 100% !important;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .tggdm-popup { border-radius: 12px; }
    .tggdm-popup-header { padding: 20px 20px 18px; gap: 12px; }
    .tggdm-popup-body { padding: 20px; }
    .tggdm-popup-icon { width: 42px; height: 42px; }
    .tggdm-popup-title { font-size: 16px; }
    /* Stack 2-column layout on mobile */
    .tggdm-col-row { grid-template-columns: 1fr; gap: 0; }
}

/* ── RTL Support ─────────────────────────────────────────────────────── */
.tggdm-popup[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

/* Close button: move from top-right to top-left in RTL */
.tggdm-popup[dir="rtl"] .tggdm-close {
    right: auto;
    left: 16px;
}

/* Required star: flip margin side */
.tggdm-popup[dir="rtl"] .tggdm-req-star {
    margin-left: 0;
    margin-right: 2px;
}

/* Field labels align right */
.tggdm-popup[dir="rtl"] .tggdm-field-group label {
    text-align: right;
}

/* Text inputs: override left-only padding for RTL */
.tggdm-popup[dir="rtl"] .tggdm-field-group input[type="text"],
.tggdm-popup[dir="rtl"] .tggdm-field-group input[type="email"],
.tggdm-popup[dir="rtl"] .tggdm-field-group input[type="number"],
.tggdm-popup[dir="rtl"] .tggdm-field-group input[type="tel"],
.tggdm-popup[dir="rtl"] .tggdm-field-group select,
.tggdm-popup[dir="rtl"] .tggdm-field-group textarea {
    text-align: right;
}

.tggdm-popup[dir="rtl"] .tggdm-field-group select {
    padding: 10px 14px 10px 34px !important;
    background-position: left 14px center !important;
}

/* Radio / checkbox inline labels: reverse flex direction */
.tggdm-popup[dir="rtl"] .tggdm-inline-label {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* Error messages align right in RTL */
.tggdm-popup[dir="rtl"] .tggdm-field-error {
    text-align: right;
}

/* Success / error result boxes stay centered */
.tggdm-popup[dir="rtl"] .tggdm-result-box {
    text-align: center;
}

/* Popup header in RTL: inherited direction:rtl from .tggdm-popup[dir="rtl"]
   already reverses flex item order (icon right, text left).
   DO NOT add flex-direction:row-reverse — it would cancel the inherited direction
   and push items back to LTR order. Instead ensure text inside aligns right. */
.tggdm-popup[dir="rtl"] .tggdm-popup-header > div {
    text-align: right;
    direction: rtl;
}

/* Title text — explicit override so it doesn't inherit LTR from theme styles */
.tggdm-popup[dir="rtl"] .tggdm-popup-title {
    text-align: right !important;
    direction: rtl;
}

/* Description text — same */
.tggdm-popup[dir="rtl"] .tggdm-popup-desc {
    text-align: right !important;
    direction: rtl;
}

/* ── Hidden & Page URL fields (never visible to visitor) ──────────────── */
input[type="hidden"],
input[data-type="page_url"],
.tggdm-field-group:has(input[type="hidden"]),
.tggdm-field-group:has(input[data-type="page_url"]),
.tggdm-field-group-hidden,
.tggdm-field-group-page_url {
    display: none !important;
}

/* ── Package (inline multi-file form -> ZIP by email) ───────────────── */
.tggdm-package {
    --tggdm-pkg-accent: #009688;
    --tggdm-pkg-title: #0b666a;
    box-sizing: border-box;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px 26px 26px;
    font-family: inherit;
    color: #222;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}
.tggdm-package *, .tggdm-package *::before, .tggdm-package *::after { box-sizing: border-box; }
.tggdm-package__title {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .025em;
    text-transform: uppercase;
    color: var(--tggdm-pkg-title);
    line-height: 1.35;
}
.tggdm-package__files {
    list-style: none;
    margin: 0;
    padding: 0 6px 0 0;
    max-height: 130px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--tggdm-pkg-accent) transparent;
}
.tggdm-package__files::-webkit-scrollbar { width: 4px; }
.tggdm-package__files::-webkit-scrollbar-thumb { background: var(--tggdm-pkg-accent); border-radius: 4px; }
.tggdm-package__file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background .15s ease;
}
.tggdm-package__file:hover { background: #f8fafc; }
.tggdm-package__file label { cursor: pointer; font-size: 13.5px; margin: 0; flex: 1; display: inline-flex; }
.tggdm-package__file-name { text-decoration: underline; color: #1a202c; font-weight: 500; }
.tggdm-package__file input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    transition: all .15s ease;
}
.tggdm-package__file input[type="checkbox"]:checked {
    background: var(--tggdm-pkg-accent);
    border-color: var(--tggdm-pkg-accent);
}
.tggdm-package__file input[type="checkbox"]:checked::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.tggdm-package__note {
    margin: 14px 0 10px;
    font-size: 11px;
    color: #64748b;
    text-transform: capitalize;
    font-weight: 400;
}
.tggdm-package__fields {
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.tggdm-package .tggdm-field-group { margin: 0; position: relative; }
.tggdm-input-wrap {
    position: relative;
    width: 100%;
}
.tggdm-input-wrap input,
.tggdm-input-wrap textarea,
.tggdm-select-wrap select {
    width: 100%;
    background: #f1f3f5;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-family: inherit;
    color: #1e293b;
    outline: none;
    transition: all .2s ease;
}
.tggdm-input-wrap textarea {
    border-radius: 18px;
    resize: vertical;
}
.tggdm-input-wrap input:focus,
.tggdm-input-wrap textarea:focus,
.tggdm-select-wrap select:focus {
    border-color: var(--tggdm-pkg-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 150, 136, 0.12);
}
.tggdm-floating-label {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #717171;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1;
    transition: opacity .15s ease, visibility .15s ease;
    user-select: none;
    margin: 0;
    display: inline-flex;
    align-items: center;
}
.tggdm-input-wrap textarea + .tggdm-floating-label {
    top: 14px;
    transform: none;
}
.tggdm-input-wrap input:focus + .tggdm-floating-label,
.tggdm-input-wrap input:not(:placeholder-shown) + .tggdm-floating-label,
.tggdm-input-wrap textarea:focus + .tggdm-floating-label,
.tggdm-input-wrap textarea:not(:placeholder-shown) + .tggdm-floating-label {
    opacity: 0;
    visibility: hidden;
}
.tggdm-req-star {
    color: #e53e3e;
    font-weight: bold;
    margin-left: 3px;
}
.tggdm-package .tggdm-invalid {
    border-color: var(--tggdm-error) !important;
}
.tggdm-package .tggdm-field-error {
    display: block;
    min-height: 0;
    font-size: 11px;
    color: var(--tggdm-error);
    padding: 3px 16px 0;
}
.tggdm-package .tggdm-field-error:empty { display: none; }
.tggdm-package__group-label { display: block; font-size: 12px; margin: 4px 0; color: #475569; }
.tggdm-package__choices { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.tggdm-package__privacy {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 14px 0 4px;
    font-size: 10.5px;
    color: #475569;
}
.tggdm-package__privacy input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    margin: 0;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
}
.tggdm-package__privacy input[type="checkbox"]:checked {
    background: var(--tggdm-pkg-accent);
    border-color: var(--tggdm-pkg-accent);
}
.tggdm-package__privacy input[type="checkbox"]:checked::after {
    content: "";
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.tggdm-package__privacy label { margin: 0; cursor: pointer; line-height: 1.4; }
.tggdm-package__privacy a { color: inherit; text-decoration: underline; font-weight: 600; }
.tggdm-package__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    padding: 13px 24px;
    border: 0;
    border-radius: 999px;
    background: var(--tggdm-pkg-accent);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 4px 14px rgba(0, 150, 136, 0.25);
}
.tggdm-package__submit:hover {
    background: #008477;
    box-shadow: 0 6px 18px rgba(0, 150, 136, 0.35);
    transform: translateY(-1px);
}
.tggdm-package__submit:active { transform: translateY(0); }
.tggdm-package__submit:disabled { opacity: .75; cursor: wait; transform: none; box-shadow: none; }
.tggdm-package__message { margin-top: 14px; padding: 11px 16px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.tggdm-package__message.is-success { background: #e6f6f4; color: #00695c; border: 1px solid #b2dfdb; }
.tggdm-package__message.is-error { background: #fdecec; color: #b42318; border: 1px solid #fecdca; }
.tggdm-package__modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tggdm-package__modal-box {
    position: relative;
    width: min(640px, 100%);
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.tggdm-package__modal-box h4 { margin: 0 0 14px; font-size: 18px; color: var(--tggdm-pkg-title); }
.tggdm-package__modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: 0;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}
