/* ============================================================
   EXTRAS.CSS – جستجو، نظرات، امتیاز، برچسب، لایت‌باکس، PWA
   ============================================================ */

/* ============ سرچ‌باکس هدر ============ */
.search-form {
    display: inline-flex;
    align-items: center;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 3px;
    transition: all .25s;
    max-width: 220px;
}
.search-form:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
    max-width: 260px;
}
.search-form input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 6px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: .82rem;
    min-width: 0;
}
.search-form input::placeholder { color: var(--text-mute); }
.search-form button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .25s;
}
.search-form button:hover { transform: scale(1.08); }

/* سرچ در موبایل */
@media (max-width: 900px) {
    .search-form { max-width: 160px; }
    .search-form input { padding: 6px 10px; font-size: .78rem; }
}
@media (max-width: 600px) {
    .search-form { display: none; }
}

/* ============ صفحه‌ی جستجو ============ */
.search-page-form {
    display: flex;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}
.search-page-form input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-alt);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}
.search-page-form input:focus {
    border-color: var(--gold);
    outline: none;
    box-shadow: 0 0 0 4px var(--gold-soft);
}
.search-page-form button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #f5cd5a, #e0a82e);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 18px var(--gold-glow);
    transition: all .25s;
}
.search-page-form button:hover { transform: translateY(-2px); }

.search-results-count {
    color: var(--text-soft);
    margin-bottom: 24px;
    text-align: center;
    font-size: .95rem;
}
.search-results-count strong { color: var(--gold); font-size: 1.3rem; }

/* ============ برچسب‌ها ============ */
.miracle-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    background: var(--gold-soft);
    color: var(--gold);
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all .25s;
}
.tag-badge:hover {
    background: var(--gold);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--gold-glow);
}

/* ============ امتیازدهی ============ */
.rating-widget {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 18px;
    background: var(--bg-alt);
    border-radius: 12px;
    margin: 20px 0;
}
.rating-stars {
    display: inline-flex;
    gap: 4px;
    direction: ltr;
}
.rating-stars button {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--border);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all .2s;
}
.rating-stars button.filled { color: var(--gold); text-shadow: 0 0 10px var(--gold-glow); }
.rating-stars button.half { color: var(--gold); opacity: .55; }
.rating-stars button.hover { color: var(--gold-3); transform: scale(1.15); }
.rating-stars button:disabled { cursor: default; opacity: .85; }
.rating-stars button:not(:disabled):hover { transform: scale(1.2); }
.rating-text {
    color: var(--text-soft);
    font-size: .88rem;
    font-weight: 600;
}

/* ============ نظرات ============ */
.comments-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}
.comments-section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    margin-bottom: 24px;
    border-right: 4px solid var(--gold);
    padding-right: 12px;
}
.comments-count {
    background: var(--gold-soft);
    color: var(--gold);
    padding: 2px 12px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 700;
}

.comment-form {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 30px;
}
.comment-form h3 {
    margin: 0 0 18px;
    font-size: 1.05rem;
    color: var(--text);
}
.comment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.comment-form label {
    display: block;
    font-weight: 700;
    font-size: .85rem;
    color: var(--text);
    margin-bottom: 6px;
}
.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: .92rem;
    transition: all .25s;
}
.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--gold);
    outline: none;
    box-shadow: 0 0 0 4px var(--gold-soft);
}
.comment-form textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.8;
}
.comment-form button[type=submit] {
    margin-top: 14px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #f5cd5a, #e0a82e);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-family: inherit;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    box-shadow: 0 6px 18px var(--gold-glow);
    transition: all .25s;
}
.comment-form button[type=submit]:hover { transform: translateY(-2px); }
.comment-form button[type=submit]:disabled { opacity: .7; cursor: not-allowed; }

.comment-login-notice {
    background: var(--gold-soft);
    border: 1px dashed var(--gold);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    color: var(--text-soft);
    margin-bottom: 24px;
}
.comment-login-notice a { color: var(--gold); font-weight: 700; }

.comment-list { display: grid; gap: 16px; }
.comment-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    transition: all .25s;
}
.comment-item:hover {
    border-color: var(--gold);
    box-shadow: var(--shadow-sm);
}
.comment-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(140,95,10,.3);
}
.comment-meta { flex: 1; }
.comment-meta strong { display: block; color: var(--text); font-size: .92rem; }
.comment-meta small { color: var(--text-mute); font-size: .75rem; }
.comment-body {
    color: var(--text-soft);
    line-height: 1.9;
    font-size: .92rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ============ لایت‌باکس ============ */
.qt-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 23, .95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    transition: opacity .35s;
}
.qt-lightbox.open {
    display: flex;
    opacity: 1;
}
.qt-lb-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.qt-lb-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0,0,0,.7);
    animation: lbIn .4s ease;
}
@keyframes lbIn {
    from { opacity: 0; transform: scale(.9); }
    to   { opacity: 1; transform: scale(1); }
}
.qt-lb-caption {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}
.qt-lb-counter {
    color: rgba(255,255,255,.6);
    font-size: .85rem;
    direction: ltr;
}
.qt-lb-close,
.qt-lb-prev,
.qt-lb-next {
    position: fixed;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .25s;
    z-index: 2;
}
.qt-lb-close { top: 25px; left: 25px; font-size: 2rem; }
.qt-lb-prev { top: 50%; right: 25px; transform: translateY(-50%); }
.qt-lb-next { top: 50%; left: 25px; transform: translateY(-50%); }
.qt-lb-close:hover,
.qt-lb-prev:hover,
.qt-lb-next:hover {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
    transform: scale(1.1);
}
.qt-lb-prev:hover, .qt-lb-next:hover { transform: translateY(-50%) scale(1.1); }

/* ============ Toast ============ */
.qt-toast {
    position: fixed;
    bottom: 30px;
    right: 50%;
    transform: translate(50%, 100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-right: 4px solid var(--gold);
    border-radius: 12px;
    padding: 14px 22px;
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    font-size: .92rem;
    color: var(--text);
    z-index: 100000;
    opacity: 0;
    transition: all .35s cubic-bezier(.2,.9,.3,1.2);
    max-width: 90vw;
    text-align: center;
}
.qt-toast.show {
    transform: translate(50%, 0);
    opacity: 1;
}
.qt-toast-success { border-right-color: #4caf50; color: #2e7d32; }
.qt-toast-error { border-right-color: #e57373; color: #c62828; }
html[data-theme="dark"] .qt-toast-success { color: #81c784; }
html[data-theme="dark"] .qt-toast-error { color: #ef9a9a; }

/* ============ PWA Install Button ============ */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #f5cd5a, #e0a82e);
    color: #fff;
    padding: 12px 22px;
    border: none;
    border-radius: 30px;
    font-family: inherit;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    box-shadow: 0 10px 30px var(--gold-glow);
    z-index: 9998;
    display: none;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(140,95,10,.3);
    transition: all .3s;
}
.pwa-install-btn.show { display: inline-flex; }
.pwa-install-btn:hover { transform: translateY(-3px); }

/* ============ ریسپانسیو ============ */
@media (max-width: 600px) {
    .comment-form .form-row { grid-template-columns: 1fr; }
    .rating-widget { padding: 10px 14px; flex-direction: column; align-items: flex-start; }
    .qt-lightbox { padding: 15px; }
    .qt-lb-close, .qt-lb-prev, .qt-lb-next { width: 44px; height: 44px; font-size: 1.4rem; }
    .qt-lb-close { top: 15px; left: 15px; }
    .qt-lb-prev { right: 15px; }
    .qt-lb-next { left: 15px; }
    .qt-lb-img { max-height: 70vh; }
}