/*
 * VIO Advance Search — Frontend Styles v1.1.0
 * Author: Hossein Nazari & VIO Team | vioweb.ir
 */

/* ==============================
   Variables — روی :root تعریف می‌شن
   تا در همه contexts در دسترس باشن
   ============================== */
:root {
  --as-primary:      #1a73e8;
  --as-primary-dark: #1256c2;
  --as-text:         #202124;
  --as-muted:        #80868b;
  --as-border:       #dadce0;
  --as-bg:           #ffffff;
  --as-hover-bg:     #f1f3f4;
  --as-radius:       10px;
  --as-shadow:       0 4px 24px rgba(0,0,0,.12);
  --as-transition:   0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

/* ==============================
   Wrapper
   ============================== */
.vio-as-wrapper {
  position: relative;
  display: inline-block;
  font-family: inherit;
  direction: rtl;
}
.vio-as-mode-inline {
  display: block;
  width: 100%;
}

/* ==============================
   Form wrap
   ============================== */
.vio-as-form-wrap { width: 100%; }

/* ==============================
   Input group
   ============================== */
.vio-as-input-group {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #dadce0;
  border-radius: var(--as-radius);
  overflow: hidden;
  transition: border-color var(--as-transition), box-shadow var(--as-transition);
}
.vio-as-input-group:focus-within {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,.18);
}

.vio-as-input-icon {
  display: flex;
  align-items: center;
  padding: 0 10px 0 4px;
  color: #80868b;
  flex-shrink: 0;
  line-height: 0;
}
.vio-as-input-icon svg { display: block; }

.vio-as-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 11px 4px 11px 0;
  font-size: 15px;
  color: #202124;
  direction: rtl;
  width: 100%;
  -webkit-appearance: none;
}
.vio-as-input::placeholder { color: #80868b; }
.vio-as-input::-webkit-search-cancel-button,
.vio-as-input::-webkit-search-decoration { -webkit-appearance: none; }

/* =====================
   دکمه جستجو
   ===================== */
.vio-as-submit-btn {
  flex-shrink: 0;
  border: none;
  outline: none;
  cursor: pointer;
  background-color: #1a73e8;   /* رنگ ثابت — بدون CSS variable */
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  transition: background-color var(--as-transition), transform .1s;
  white-space: nowrap;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  border-radius: 0;
}
.vio-as-submit-btn:hover  { background-color: #1256c2; }
.vio-as-submit-btn:active { transform: scale(.97); }

/* ==============================
   Results
   ============================== */
.vio-as-results-wrap {
  display: none;
  background: #ffffff;
  border: 1.5px solid #dadce0;
  border-top: none;
  border-radius: 0 0 var(--as-radius) var(--as-radius);
  box-shadow: var(--as-shadow);
  max-height: 360px;
  overflow-y: auto;
  direction: rtl;
}
.vio-as-results-wrap.vio-open {
  display: block;
  animation: vioSlideDown .18s ease both;
}
@keyframes vioSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.vio-as-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #dadce0;
  transition: background var(--as-transition);
}
.vio-as-result-item:last-child { border-bottom: none; }
.vio-as-result-item:hover      { background: #f1f3f4; }

.vio-as-result-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f1f3f4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #80868b;
}
.vio-as-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.vio-as-thumb-placeholder svg { width: 20px; height: 20px; }

.vio-as-result-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.vio-as-result-type {
  font-size: 10px;
  font-weight: 700;
  color: #1a73e8;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.vio-as-result-title {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.vio-as-result-excerpt {
  font-size: 12px;
  color: #80868b;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vio-as-no-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: #80868b;
  font-size: 14px;
}
.vio-as-no-result svg { width: 18px; height: 18px; }

.vio-as-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: #80868b;
  font-size: 13px;
}
.vio-as-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #dadce0;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: vioSpin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes vioSpin { to { transform: rotate(360deg); } }

.vio-as-results-wrap::-webkit-scrollbar       { width: 4px; }
.vio-as-results-wrap::-webkit-scrollbar-thumb { background: #dadce0; border-radius: 4px; }

/* ==============================
   Trigger Button (icon / fullscreen)
   رنگ پیش‌فرض مشخص — نه currentColor
   ============================== */
.vio-as-trigger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #202124;          /* رنگ پیش‌فرض تیره — قابل override توسط المنتور */
  padding: 6px;
  border-radius: 6px;
  transition: color var(--as-transition), background var(--as-transition), transform .15s;
  line-height: 0;
}
.vio-as-trigger-btn:hover  { color: #1a73e8; }
.vio-as-trigger-btn:active { transform: scale(.93); }
.vio-as-trigger-btn svg    { display: block; width: 22px; height: 22px; }

/* ==============================
   Icon Mode — Dropdown
   ============================== */
.vio-as-mode-icon .vio-as-icon-close { display: none; }
.vio-as-mode-icon.vio-open .vio-as-icon-open  { display: none; }
.vio-as-mode-icon.vio-open .vio-as-icon-close { display: flex; }

.vio-as-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: #ffffff;
  border: 1.5px solid #dadce0;
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow);
  padding: 10px;
  z-index: 9999;
  direction: rtl;
}
.vio-as-dropdown.vio-open {
  display: block;
  animation: vioSlideDown .2s ease both;
}
.vio-as-dropdown .vio-as-results-wrap {
  border-left: none;
  border-right: none;
  border-radius: 0 0 6px 6px;
  max-height: 260px;
}

@media (max-width: 500px) {
  .vio-as-dropdown {
    width: calc(100vw - 24px);
    right: 50%;
    transform: translateX(50%);
  }
}

/* ==============================
   Fullscreen Mode
   ============================== */
.vio-as-fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(12,12,26,0.97);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
  direction: rtl;
}
.vio-as-fs-overlay.vio-open {
  opacity: 1;
  pointer-events: all;
}

.vio-as-fs-inner {
  width: 100%;
  max-width: 700px;
  padding: 20px 16px 40px;
  position: relative;
  transform: translateY(30px);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
}
.vio-as-fs-overlay.vio-open .vio-as-fs-inner {
  transform: translateY(0);
}

.vio-as-fs-close {
  position: absolute;
  top: -4px;
  left: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, transform .2s;
  border-radius: 6px;
  line-height: 0;
}
.vio-as-fs-close svg   { width: 24px; height: 24px; }
.vio-as-fs-close:hover { color: #fff; transform: rotate(90deg); }

.vio-as-fs-content .vio-as-input-group {
  background: rgba(255,255,255,.08);
  border: none;
  border-bottom: 2px solid rgba(255,255,255,.25);
  border-radius: 0;
}
.vio-as-fs-content .vio-as-input-group:focus-within {
  border-bottom-color: #ffffff;
  box-shadow: none;
}
.vio-as-fs-content .vio-as-input {
  color: #ffffff;
  font-size: 22px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.vio-as-fs-content .vio-as-input::placeholder { color: rgba(255,255,255,.38); }
.vio-as-fs-content .vio-as-input-icon         { color: rgba(255,255,255,.5); }

.vio-as-fs-content .vio-as-submit-btn {
  background-color: rgba(255,255,255,.12);
  font-size: 15px;
  padding: 14px 24px;
  border-radius: 6px;
  margin: 0 6px;
}
.vio-as-fs-content .vio-as-submit-btn:hover { background-color: #1a73e8; }

.vio-as-fs-content .vio-as-results-wrap {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--as-radius);
  margin-top: 16px;
  max-height: 50vh;
}
.vio-as-fs-content .vio-as-result-item       { border-bottom-color: rgba(255,255,255,.07); }
.vio-as-fs-content .vio-as-result-item:hover { background: rgba(255,255,255,.08); }
.vio-as-fs-content .vio-as-result-title      { color: #ffffff; }
.vio-as-fs-content .vio-as-result-excerpt    { color: rgba(255,255,255,.5); }
.vio-as-fs-content .vio-as-no-result         { color: rgba(255,255,255,.45); }
.vio-as-fs-content .vio-as-loading           { color: rgba(255,255,255,.45); }
.vio-as-fs-content .vio-as-spinner {
  border-color: rgba(255,255,255,.2);
  border-top-color: #ffffff;
}

body.vio-fs-active { overflow: hidden; }
