/* =========================================
   1. GLOBAL MODAL & OVERLAY (SMOKY GLASS)
========================================= */
.hidden { display: none !important; }

.peanir-popup, .peanir-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
}

/* پس‌زمینه دودی و بلور شده */
.peanir-popup-overlay, .peanir-modal-overlay {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.75); /* رنگ دودی تیره */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer; /* برای اینکه کاربر بداند قابل کلیک است */
}

/* باکس اصلی */
.peanir-popup-content, .peanir-modal-box {
    position: relative; width: 100%; max-width: 420px;
    background: #ffffff; border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex; flex-direction: column; overflow: hidden;
}

/* =========================================
   2. TYPOGRAPHY & HEADER
========================================= */
.peanir-popup-header, .peanir-modal-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 28px 28px 16px; position: relative;
}

.header-text h3 {
    margin: 0; font-size: 20px; font-weight: 800; color: #111; letter-spacing: -0.5px;
}

.popup-subtitle, .modern-desc {
    margin: 6px 0 0; font-size: 13px; color: #71717a; font-weight: 500; line-height: 1.6;
}

/* دکمه ضربدر (سایز مناسب و قابل کلیک) */
.peanir-popup-close, .modal-close-create, .close-modal {
    border: none; background: #f4f4f5; color: #111;
    width: 44px; height: 44px; /* بزرگ‌تر شد */
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0;
}

.peanir-popup-close:hover, .modal-close-create:hover, .close-modal:hover {
    background: #e4e4e7; transform: scale(1.05);
}

/* =========================================
   3. SEARCH & INPUTS (رفع روی هم افتادگی)
========================================= */
.peanir-popup-search, .peanir-modal-body { padding: 0 28px 16px; }

.search-input-wrapper { position: relative; display: flex; align-items: center; width: 100%; }

/* آیکون جستجو سمت راست */
.search-icon { position: absolute; right: 16px; pointer-events: none; }

.peanir-board-search, .modern-input {
    width: 100%; height: 50px; background: #f4f4f5;
    border: 2px solid transparent; border-radius: 14px;
    font-size: 14px; font-family: inherit; color: #111;
    transition: all 0.2s ease; box-sizing: border-box;
}

/* پدینگ راست بیشتر برای جلوگیری از روی هم افتادن متن و آیکون */
.peanir-board-search { padding: 0 44px 0 16px !important; }
.modern-input { padding: 0 16px; }

.peanir-board-search:focus, .modern-input:focus {
    background: #ffffff; border-color: #111; outline: none; box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.modern-label { display: block; font-size: 14px; font-weight: 700; color: #111; margin-bottom: 8px; }


/* =========================================
   4. BOARDS LIST (مینیمال و ضد پرش)
========================================= */
.peanir-popup-boards {
    flex: 1; min-height: 250px; max-height: 45vh; overflow-y: auto;
    padding: 0 20px 20px; display: flex; flex-direction: column;
}

.peanir-board-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border-radius: 16px; cursor: pointer;
    transition: background 0.2s ease; margin-bottom: 6px;
    background: transparent;
}

.peanir-board-item:hover { background: #f8fafc; }
.peanir-board-item.is-loading { opacity: 0.6; pointer-events: none; }

.board-list-info { display: flex; align-items: center; gap: 14px; flex: 1; }

.board-popup-thumb {
    width: 52px; height: 52px; min-width: 52px; min-height: 52px;
    border-radius: 12px; background-color: #f1f5f9;
    flex-shrink: 0; overflow: hidden; display: flex;
    align-items: center; justify-content: center;
}

.board-popup-thumb img {
    width: 100%; height: 100%; object-fit: cover; animation: fadeIn 0.3s ease;
}

.board-title { font-size: 15px; font-weight: 700; color: #111; }

/* دکمه کپسولی (جایگزین تیک) */
.board-action-btn {
    font-size: 13px; font-weight: 700; padding: 8px 16px;
    border-radius: 20px; transition: all 0.2s ease;
    background: #f1f5f9; color: #111;
    opacity: 0; /* در حالت عادی مخفی */
}

/* نمایش دکمه در هاور یا وقتی ذخیره شده */
.peanir-board-item:hover .board-action-btn { opacity: 1; }

.peanir-board-item.saved .board-action-btn {
    opacity: 1; background: #111; color: #fff;
}


/* =========================================
   5. BUTTONS (هم‌اندازه شدن دکمه‌های دوگانه)
========================================= */
.peanir-popup-footer, .peanir-modal-footer {
    padding: 20px 28px 28px;
}

.peanir-create-board {
    background: #111111; color: #ffffff; border: none;
    border-radius: 30px; padding: 14px 24px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.15s ease, background 0.2s ease;
}
.peanir-create-board:hover { background: #000000; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.peanir-create-board:active { transform: scale(0.97); }

/* دکمه‌های هم‌سایز انصراف و تایید */
.dual-buttons { 
    display: flex; gap: 12px; width: 100%; 
}

.dual-buttons button {
    flex: 1; /* هم اندازه بودن دقیق دو دکمه */
    height: 52px; border: none; border-radius: 26px;
    font-size: 15px; font-weight: 700; cursor: pointer; 
    transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
}

.cancel-board { background: #f4f4f5; color: #111; }
.cancel-board:hover { background: #e4e4e7; }
.submit-board { background: #111; color: #fff; }
.submit-board:hover { background: #000; box-shadow: 0 6px 15px rgba(0,0,0,0.15); }

/* =========================================
   6. iOS STYLE PRIVACY TOGGLE (دکمه On/Off)
========================================= */
.modern-privacy-toggle {
    display: flex; align-items: flex-start; gap: 16px;
    margin-top: 24px; cursor: pointer;
}

.toggle-checkbox { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.toggle-checkbox input { position: absolute; opacity: 0; cursor: pointer; inset: 0; z-index: 2; margin: 0; }
.toggle-switch {
    position: absolute; inset: 0; background-color: #e4e4e7; border-radius: 28px;
    transition: background-color 0.3s ease;
}
.toggle-switch::before {
    content: ""; position: absolute; top: 3px; right: 3px; /* Right برای سایت‌های فارسی */
    height: 22px; width: 22px; background-color: white; border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.toggle-checkbox input:checked + .toggle-switch { background-color: #111; }
/* در حالت فارسی/RTL آیکون به سمت چپ حرکت میکند */
.toggle-checkbox input:checked + .toggle-switch::before { transform: translateX(-22px); }

.toggle-text { display: flex; flex-direction: column; }
.toggle-title { font-size: 15px; font-weight: 700; color: #111; margin-bottom: 4px; }
.toggle-desc { font-size: 12px; color: #71717a; line-height: 1.6; }

/* =========================================
   7. MOBILE APP NATIVE STYLE
========================================= */
@media (max-width: 768px) {
    .peanir-popup, .peanir-modal { align-items: flex-end; }
    
    .peanir-popup-content, .peanir-modal-box {
        max-width: 100%; width: 100%; border-radius: 32px 32px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    /* نوار گریپ اپلیکیشنی */
    .peanir-popup-header::before, .peanir-modal-header::before {
        content: ''; position: absolute; top: 12px; left: 50%;
        transform: translateX(-50%); width: 44px; height: 5px;
        background: #e4e4e7; border-radius: 10px;
    }
    .peanir-popup-header, .peanir-modal-header { padding-top: 36px; }
}

/* Toast */
.peanir-toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #111; color: #fff; padding: 16px 32px; border-radius: 30px;
    font-size: 14px; font-weight: 700; z-index: 999999; opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.peanir-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }