/* =========================================================
   PSTVPN Activate UI – Phase 1 (+ Phase 2 menu polish)
   Clean, calm, professional — FINAL (Route A ready)
   ========================================================= */

/* Box sizing safety (prevents padding/width surprises in themes/builders) */
#pstvpn-activate,
#pstvpn-activate * {
    box-sizing: border-box;
}

/* Wrapper */
#pstvpn-activate {
    max-width: 520px;
    margin: 60px auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, Helvetica, Arial, sans-serif;
}

/* Title */
#pstvpn-activate .pstvpn-activate-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 28px;
    color: #111827; /* near-black */
    text-align: center;
}

/* Status (used by JS setStatus()) */
#pstvpn-activate .pstvpn-activate-status {
    margin: 0 0 14px 0;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    border: 1px solid rgba(17,24,39,0.08);
    background: #f9fafb;
    color: #111827;
}

/* Status variants (supports either data-type attr or JS inline styles) */
#pstvpn-activate .pstvpn-activate-status[data-type="info"] {
    background: #eff6ff;
    border-color: rgba(37,99,235,0.22);
}

#pstvpn-activate .pstvpn-activate-status[data-type="warn"] {
    background: #fff7ed;
    border-color: rgba(234,88,12,0.25);
}

#pstvpn-activate .pstvpn-activate-status[data-type="error"] {
    background: #fef2f2;
    border-color: rgba(239,68,68,0.25);
}

/* Card */
#pstvpn-activate .pstvpn-activate-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px 26px 30px;
    border: 1px solid rgba(17, 24, 39, 0.06);
    box-shadow:
        0 10px 25px rgba(0,0,0,0.06),
        0 4px 10px rgba(0,0,0,0.04);
}

/* Labels */
#pstvpn-activate .pstvpn-activate-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

/* Input (shared style) */
#pstvpn-activate .pstvpn-activate-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

#pstvpn-activate .pstvpn-activate-input::placeholder {
    color: #9ca3af;
}

#pstvpn-activate .pstvpn-activate-input:focus {
    outline: none;
    border-color: #2563eb; /* PSTVPN blue */
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* Route A: Location display input (readonly picker trigger)
   - Uses same base input styling
   - Adds subtle affordance without changing layout */
#pstvpn-activate .pstvpn-location-display[readonly] {
    cursor: pointer;
}

#pstvpn-activate .pstvpn-location-display[readonly]:hover {
    background: #f9fafb;
}

/* NEW (safe): better focus-visible + disabled for readonly trigger if used */
#pstvpn-activate .pstvpn-location-display[readonly]:focus-visible {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

#pstvpn-activate .pstvpn-location-display[disabled],
#pstvpn-activate .pstvpn-location-display[aria-disabled="true"] {
    opacity: 0.65;
    cursor: not-allowed;
    background: #f9fafb;
}

/* Code display */
#pstvpn-activate .pstvpn-activate-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", monospace;
    font-size: 15px;
    padding: 12px 14px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px dashed #c7d2fe;
    color: #1e3a8a;
    margin-bottom: 12px;
}

/* Select (legacy / fallback)
   Keeping this so nothing breaks if markup still uses <select>.
   Route A uses .pstvpn-location-display + custom menu instead. */
#pstvpn-activate .pstvpn-activate-server {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    margin-bottom: 18px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;

    /* Cross-browser consistency */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Room for optional custom arrow (if added later) */
    background-clip: padding-box;
}

#pstvpn-activate .pstvpn-activate-server:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

#pstvpn-activate .pstvpn-activate-server:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: #f9fafb;
}

/* Also support the V2 select class if used (non-breaking enhancement) */
#pstvpn-activate .pstvpn-server-select-v2 {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    margin-bottom: 18px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-clip: padding-box;
}

#pstvpn-activate .pstvpn-server-select-v2:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

#pstvpn-activate .pstvpn-server-select-v2:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: #f9fafb;
}

/* Button */
#pstvpn-activate .pstvpn-activate-btn {
    width: 100%;
    height: 50px;
    border-radius: 12px;
    border: none;
    background: #2563eb;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        transform 0.05s ease,
        box-shadow 0.15s ease;
}

#pstvpn-activate .pstvpn-activate-btn:hover {
    background: #1e40af;
    box-shadow: 0 6px 14px rgba(37,99,235,0.25);
}

#pstvpn-activate .pstvpn-activate-btn:active {
    transform: translateY(1px);
}

/* Disabled button state (enabled only after location selection) */
#pstvpn-activate .pstvpn-activate-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

/* Accessible: keyboard focus on button */
#pstvpn-activate .pstvpn-activate-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
}

/* ---------------------------------------------------------
   NEW (SAFE): "Choices" grid helpers (for your 4 mobile / 3 desktop)
   Usage:
   - Wrap your 3/4 choice buttons/cards in a container:
       <div class="pstvpn-choice-grid"> ... </div>
   This does NOTHING unless that class exists in markup.
   --------------------------------------------------------- */
.pstvpn-choice-grid {
    display: grid;
    gap: 10px;
}

/* Desktop: 3 choices */
@media (min-width: 768px) {
    .pstvpn-choice-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile: 4 choices */
@media (max-width: 767px) {
    .pstvpn-choice-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Optional styling for choice buttons/cards (only if you use these classes) */
.pstvpn-choice {
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(17,24,39,0.10);
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
}

.pstvpn-choice:hover {
    background: #f9fafb;
    box-shadow: 0 6px 14px rgba(0,0,0,0.06);
}

.pstvpn-choice:active {
    transform: translateY(1px);
}

.pstvpn-choice.is-active,
.pstvpn-choice[aria-pressed="true"] {
    border-color: rgba(37,99,235,0.45);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ---------------------------------------------------------
   Phase 2: Dropdown menu polish (actions menu)
   NOTE:
   - Menu is appended to document.body by JS to avoid overflow issues.
   - Keep these selectors generic so it works with either class naming.
   --------------------------------------------------------- */

/* Menu container (JS sets inline styles; these are safe defaults) */
.pstvpn-activate-menu {
    border-radius: 12px;
    border: 1px solid rgba(17,24,39,0.12);
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* Menu items — supports both class variants */
.pstvpn-activate-menu .pstvpn-activate-menu-item,
.pstvpn-activate-menu .pstvpn-action-item {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.12s ease;
}

/* Hover/feel */
.pstvpn-activate-menu .pstvpn-activate-menu-item:hover,
.pstvpn-activate-menu .pstvpn-action-item:hover {
    background: #f9fafb !important;
}

/* Focus */
.pstvpn-activate-menu .pstvpn-activate-menu-item:focus-visible,
.pstvpn-activate-menu .pstvpn-action-item:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(37,99,235,0.25);
}

/* ---------------------------------------------------------
   Route A: Custom Location Picker (rich items)
   - Enables: flags, bold country, normal city, (virtual) small
   - Menu is appended to document.body (safe vs overflow hidden)
   --------------------------------------------------------- */

.pstvpn-menu {
    background: #ffffff;
    border: 1px solid rgba(17,24,39,0.12);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    /* If theme has weird stacking contexts, JS should apply a high z-index inline.
       Keeping CSS neutral to avoid collisions. */
}

.pstvpn-menu-inner {
    max-height: 420px;
    overflow: auto;
    padding: 6px;
}

.pstvpn-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
}

.pstvpn-menu-item:hover {
    background: #f9fafb;
}

/* NEW (safe): keyboard focus for menu items */
.pstvpn-menu-item:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(37,99,235,0.20);
    background: #f9fafb;
}

.pstvpn-menu-item--header {
    cursor: default;
    font-size: 12px;
    opacity: 0.70;
    padding: 8px 10px;
}

.pstvpn-flag {
    width: 22px;
    text-align: center;
}

.pstvpn-country strong {
    font-weight: 700;
}

.pstvpn-sep {
    opacity: 0.65;
}

.pstvpn-city {
    opacity: 0.95;
}

.pstvpn-virtual {
    margin-left: 6px;
    font-size: 12px;
    opacity: 0.65;
}

/* Optional: nicer scrollbars where supported (non-breaking) */
.pstvpn-menu-inner::-webkit-scrollbar {
    width: 10px;
}
.pstvpn-menu-inner::-webkit-scrollbar-thumb {
    background: rgba(17,24,39,0.12);
    border-radius: 10px;
}
.pstvpn-menu-inner::-webkit-scrollbar-track {
    background: rgba(17,24,39,0.04);
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 480px) {
    #pstvpn-activate {
        margin-top: 40px;
    }

    #pstvpn-activate .pstvpn-activate-title {
        font-size: 26px;
    }

    /* Small padding tuning on mobile for calmer look */
    #pstvpn-activate .pstvpn-activate-card {
        padding: 22px 18px 24px;
    }
}
