/* ================================
   MAP WRAPPER & CONTAINER
================================ */
.escape-map-widget,
.map-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: #000;
}

.map-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1;
}

.google-map {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    filter: grayscale(100%) invert(94%) contrast(150%) brightness(85%) sepia(35%) hue-rotate(320deg) saturate(600%);
    transition: filter 1s ease;
}

.map-wrapper.searching .google-map,
.escape-map-widget.searching .google-map {
    filter: grayscale(100%) invert(90%) contrast(170%) brightness(55%) sepia(55%) hue-rotate(330deg) saturate(700%);
}

.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 5;
}

.overlay-container .search-panel,
.overlay-container .player-dot,
.overlay-container .radar-scan,
.overlay-container #status-box,
.overlay-container #proposal-box {
    pointer-events: auto;
}

/* ================================
   RADAR
================================ */
.radar-scan {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 420px;
    height: 420px;
    max-width: 80vw;
    max-height: 80vw;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(255, 0, 0, 0.25);
    pointer-events: none;
    z-index: 3;
    opacity: 0.55;
    transition: opacity 0.6s ease;
    background: repeating-radial-gradient(
        circle,
        rgba(255, 0, 0, 0.10) 0,
        rgba(255, 0, 0, 0.10) 1px,
        transparent 1px,
        transparent 70px
    );
}

.radar-scan::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(255, 0, 0, 0.45), transparent 35%);
    animation: radar-sweep 3.5s linear infinite;
}

.radar-scan::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 45px rgba(255, 0, 0, 0.35);
}

.map-wrapper.searching .radar-scan,
.escape-map-widget.searching .radar-scan {
    opacity: 1;
}

@keyframes radar-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ================================
   SEARCH PANEL & BOXES
================================ */
.search-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 290px;
    padding: 24px;
    /* با اضافه شدن انتخاب «نوع جستجو» و سه سلکت گیم‌نت، پنل می‌تواند از ارتفاع
       نقشه بلندتر شود؛ پس خودش اسکرول می‌گیرد تا دکمه‌ها بیرون نیفتند. */
    max-height: calc(100% - 40px);
    overflow-y: auto;
    text-align: center;
    color: #fff;
    background: rgba(10, 10, 10, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    border: 1px solid rgba(255, 0, 0, 0.4);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.75);
    z-index: 10;
}

.search-panel h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #fff;
}

.search-panel label {
    display: block;
    text-align: right;
    margin-bottom: 5px;
    font-size: 13px;
    color: #ccc;
}

.search-panel select,
.search-panel input[type="number"] {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #111;
    color: #fff;
    font-family: inherit;
    box-sizing: border-box;
}

.search-panel select:focus,
.search-panel input[type="number"]:focus {
    outline: none;
    border-color: red;
}

/* ================================
   SEARCH TYPE (اتاق فرار / گیم‌نت)
================================ */
.search-type-group {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-type-group .mode-select-option {
    flex: 1;
    justify-content: center;
    font-weight: bold;
}

/* ================================
   نزدیک‌ترین گیم‌نت‌ها (موقعیت مکانی)
================================ */
#gamenet-near-btn {
    width: 100%;
    margin: 0 0 10px;
    padding: 10px;
    border: 1px dashed rgba(255, 0, 0, 0.45);
    border-radius: 8px;
    background: rgba(255, 0, 0, 0.06);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

#gamenet-near-btn:hover:not(:disabled) {
    background: rgba(255, 0, 0, 0.14);
    border-color: #ff2a2a;
}

#gamenet-near-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.gamenet-geo-note {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    line-height: 1.8;
    text-align: right;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ccc;
}

.gamenet-geo-note.is-ok {
    color: #7ddc9a;
    border-color: rgba(125, 220, 154, 0.35);
    background: rgba(125, 220, 154, 0.08);
}

.gamenet-geo-note.is-warn {
    color: #ffcc66;
    border-color: rgba(255, 204, 102, 0.35);
    background: rgba(255, 204, 102, 0.08);
}

#gamenet-near-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.gamenet-near-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #eee;
    font-family: inherit;
    font-size: 12px;
    text-align: right;
    cursor: pointer;
}

.gamenet-near-item:hover {
    border-color: rgba(255, 0, 0, 0.5);
    background: rgba(255, 0, 0, 0.08);
}

.gamenet-near-item.is-active {
    border-color: #ff2a2a;
    background: rgba(255, 0, 0, 0.14);
}

.gamenet-near-name {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gamenet-near-dist {
    flex-shrink: 0;
    color: #7ddc9a;
    font-size: 11px;
}

/* ================================
   MODE SELECT (تکی / تیمی)
================================ */
.mode-select-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    text-align: right;
}

.mode-select-option {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-size: 12px;
    color: #ddd;
    margin-bottom: 0 !important;
}

.mode-select-option input[type="radio"] {
    accent-color: #ff2a2a;
    cursor: pointer;
}

.mode-select-option:has(input:checked) {
    border-color: rgba(255, 0, 0, 0.55);
    background: rgba(255, 0, 0, 0.08);
}

#team-size-warning {
    color: #ff8080;
}

/* ================================
   BUTTONS
================================ */
#search-btn, #cancel-btn, #escape-search-btn, #accept-btn, #reject-btn {
    width: 100%;
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.2s ease;
    margin-top: 8px;
}

#search-btn, #escape-search-btn, #accept-btn {
    background: linear-gradient(135deg, #cc0000, #ff2a2a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
}

#search-btn:hover, #escape-search-btn:hover, #accept-btn:hover {
    background: linear-gradient(135deg, #e60000, #ff4444);
    transform: translateY(-1px);
}

#cancel-btn, #reject-btn {
    background: #2a2a2a;
    color: #fff;
}

#cancel-btn:hover, #reject-btn:hover {
    background: #3a3a3a;
}

#search-btn:disabled, #cancel-btn:disabled, #accept-btn:disabled, #reject-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ================================
   MATCHMAKING STATUS & PROPOSAL
================================ */
#status-box {
    margin-top: 15px;
    padding: 15px;
    border: 1px dashed rgba(255, 0, 0, 0.5);
    border-radius: 8px;
    background: rgba(255, 0, 0, 0.05);
    color: #fff;
}

#timer-container {
    font-weight: bold;
    margin-top: 8px;
    color: #ff4444;
}

#proposal-box {
    margin-top: 15px;
    padding: 15px;
    border: 2px solid #28a745;
    border-radius: 8px;
    background: rgba(40, 167, 69, 0.15);
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.2);
}

#proposal-box p {
    font-weight: bold;
    color: #28a745;
    margin: 0 0 10px 0;
}

.proposal-partner-info p {
    color: #fff;
    font-weight: normal;
    margin: 4px 0;
    font-size: 13px;
    text-align: right;
}

#waiting-partner-msg {
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 204, 0, 0.08);
    border: 1px dashed rgba(255, 204, 0, 0.4);
}

#accept-btn {
    background: linear-gradient(135deg, #1e7e34, #28a745);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

#accept-btn:hover {
    background: linear-gradient(135deg, #218838, #2b964c);
}

/* ================================
   LOGIN OVERLAY & BOX
================================ */
.login-overlay {
    position: absolute;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    pointer-events: all;
}

.login-overlay.active {
    display: flex;
}

.login-box {
    background: rgba(15, 15, 15, 0.95);
    color: #fff;
    padding: 30px;
    width: 90%;
    max-width: 390px;
    border-radius: 20px;
    border: 1px solid rgba(255, 0, 0, 0.7);
    text-align: center;
    box-shadow: 0 0 45px rgba(255, 0, 0, 0.22);
}

.login-box h3 {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.8;
}

.login-box p {
    margin: 0;
    color: #d6d6d6;
    line-height: 2;
    font-size: 14px;
}

.login-btn {
    display: inline-block;
    background: linear-gradient(135deg, #b30000, #ff1e1e);
    color: #fff;
    padding: 12px 22px;
    margin-top: 18px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: bold;
    box-shadow: 0 8px 24px rgba(255, 0, 0, 0.3);
}

.login-btn:hover {
    background: linear-gradient(135deg, #d10000, #ff3c3c);
    transform: translateY(-2px);
}

.map-wrapper.login-locked .search-panel,
.escape-map-widget.login-locked .search-panel {
    pointer-events: none !important;
    opacity: 0.4;
    user-select: none;
}

/* ================================
   RESPONSIVE (MOBILE) — پنل نقشه
================================ */
@media (max-width: 768px) {
    .escape-map-widget, .map-wrapper {
        height: 80vh;
        height: 80dvh;
    }
    .search-panel {
        width: 85%;
        padding: 18px;
    }
    .login-box {
        padding: 24px;
    }
}

/* ================================================================
   پنل «درخواست‌های من» — [escape_my_requests]
================================================================ */
.escape-requests-widget {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px;
    color: #fff;
    font-family: inherit;
    direction: rtl;
}

.escape-requests-title {
    margin: 0 0 16px;
    font-size: 20px;
    color: #fff;
    text-align: right;
}

.escape-requests-login-msg {
    text-align: center;
    color: #ccc;
    padding: 20px;
    border: 1px dashed rgba(255, 0, 0, 0.35);
    border-radius: 10px;
    background: rgba(255, 0, 0, 0.04);
}

.escape-requests-empty {
    text-align: center;
    color: #999;
    padding: 24px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
}

.escape-requests-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.escape-request-card {
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(255, 0, 0, 0.35);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: opacity 0.35s ease, transform 0.35s ease;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.escape-request-card-fading {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    pointer-events: none;
}

.escape-request-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.escape-request-mode-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid rgba(255, 0, 0, 0.4);
    color: #ff8080;
}

.escape-request-game {
    font-size: 13px;
    color: #ccc;
    font-weight: bold;
}

.escape-request-card-body p {
    margin: 4px 0;
    font-size: 13px;
    color: #eee;
    text-align: right;
}

.escape-request-card-body strong {
    color: #fff;
}

.escape-request-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.escape-request-card-actions button {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: all 0.2s ease;
}

.escape-request-accept-btn {
    background: linear-gradient(135deg, #1e7e34, #28a745);
    color: #fff;
}

.escape-request-accept-btn:hover {
    background: linear-gradient(135deg, #218838, #2b964c);
}

.escape-request-reject-btn {
    background: #2a2a2a;
    color: #fff;
}

.escape-request-reject-btn:hover {
    background: #3a3a3a;
}

.escape-request-card-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.escape-request-waiting-msg {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: #ffcc00;
    border-radius: 8px;
    background: rgba(255, 204, 0, 0.08);
    border: 1px dashed rgba(255, 204, 0, 0.4);
}

@media (max-width: 768px) {
    .escape-requests-widget { padding: 14px; }
    .escape-request-card { padding: 14px; }
}

/* Safari روی iOS ورودی با فونت کوچک‌تر از ۱۶px را هنگام فوکوس زوم می‌کند و
   نقشه/پنل جستجو از قاب بیرون می‌زند. */
@media (max-width: 782px) {
    .search-panel select,
    .search-panel input,
    .escape-requests-widget input,
    .escape-requests-widget select {
        font-size: 16px;
    }
}
