/* ==========================================
   لود کردن آیکون‌های متریال گوگل به صورت آفلاین
   ========================================== */
@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/MaterialIcons-Regular.woff2') format('woff2');
}

.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;  /* اندازه پیش‌فرض آیکون‌ها */
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;

  /* رندر بهتر و نرم‌تر آیکون‌ها در مرورگرهای مختلف */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
}   
   
   
   /* لود کردن فونت از پوشه محلی پروژه */
    @font-face {
      font-family: 'Peyda';
      font-weight: 400;
      src: url('./fonts/Peyda-Regular.woff2') format('woff2');
      font-display: swap;
    }

    @font-face {
      font-family: 'Peyda';
      font-weight: 700;
      src: url('./fonts/Peyda-Bold.woff2') format('woff2');
      font-display: swap;
    }
    
    

    :root {
      --paper: #fcfbf9;
      --line: #ddd6c8;
      --accent: #d25701;
      --accent-hover: #e86b15;
      --sidebar-bg: #fdf6f2;
    }

    /* ==========================================
       🌙 حالت تاریک — با اینورت کل صفحه (ساده و مؤثر، بدون نیاز به
       بازنویسی تک‌تک رنگ‌ها). عکس/ویدیو (اگر باشه) دوباره اینورت می‌شه
       تا رنگ طبیعیش برگرده.
       ========================================== */
    body.dark-mode {
      filter: invert(1) hue-rotate(180deg);
      background: #fff;
    }
    body.dark-mode img,
    body.dark-mode video {
      filter: invert(1) hue-rotate(180deg);
    }

    @font-face {
      font-family: 'Bravura';
      src: url('./fonts/Bravura.otf');
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      padding: 0;
      width: 100vw;
      height: 100vh;
      overflow: hidden;
      font-family: 'Peyda', system-ui, -apple-system, sans-serif;
      background-color: #eee;
    }

main {
      width: 100%;
      height: 100%;
      display: flex;
      position: relative; /* اضافه شده برای قرارگیری درست خط پخش */
    }

    score-viewer {
      width: 100%;
      height: 100%;
      --score-scale: 45;
    }

/* --- استایل خط عمودی متحرک (آماده برای حرکت پیوسته و نرم) --- */
    #playback-cursor {
      position: absolute;
      width: 2px;
      background-color: var(--accent); /* هماهنگ با رنگ نارنجی */
      box-shadow: 0 0 8px rgba(210, 87, 1, 0.6);
      z-index: 50;
      display: none; 
      pointer-events: none;
    }

    /* --------------------------------------------------- */
    /* نوار دکمه‌های شناور پایین صفحه */
    /* --------------------------------------------------- */
    .bottom-bar {
      position: fixed;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      gap: 12px;
      z-index: 100;
    }

    .fab-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: var(--accent);
      color: #fff;
      border: none;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(210, 87, 1, 0.4);
      transition: transform 0.2s, background 0.2s;
    }

    .fab-btn:hover {
      background: var(--accent-hover);
      transform: scale(1.05);
    }

    .fab-btn .material-icons {
      font-size: 24px;
    }

    /* دکمه پلی بزرگتر */
    .fab-play {
      width: 60px;
      height: 60px;
      background-color: #f79042;
      /* رنگ کمی روشن تر برای پلی بر اساس عکس */
    }

    .fab-play .material-icons {
      font-size: 32px;
    }

    /* مخفی کردن اینپوت آپلود */
    .fab-btn input[type=file] {
      display: none;
    }

    /* --------------------------------------------------- */
    /* سایدبار (منوی کشویی سمت چپ) */
    /* --------------------------------------------------- */
.sidebar {
      position: fixed;
      top: 0;
      left: 0;
      height: 100vh;
      width: 340px;
      background-color: var(--sidebar-bg);
      border-right: 2px solid var(--accent);
      transform: translateX(-100%);
      /* اضافه شدن انیمیشن تغییر شفافیت به ترانزیشن */
      transition: transform 0.3s ease, opacity 0.3s ease;
      /* شفافیت اولیه (کمرنگ بودن) */
      opacity: 0.5;
      z-index: 200;
      display: flex;
      flex-direction: column;
      box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    /* وقتی موس روی سایدبار قرار می‌گیرد، کاملاً پررنگ می‌شود */
    .sidebar:hover {
      opacity: 1;
    }

    .sidebar.open {
      transform: translateX(0);
    }

    .sidebar-toggle {
      position: absolute;
      right: -25px;
      /* بیرون زدگی از لبه راست سایدبار */
      top: 50%;
      transform: translateY(-50%);
      width: 25px;
      height: 50px;
      background-color: #fff;
      border: 1px solid var(--accent);
      border-left: none;
      border-radius: 0 8px 8px 0;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
    }

    /* محتوای داخل سایدبار به صورت راست‌چین */
    .sidebar-content {
      flex: 1;
      padding: 15px;
      overflow-y: auto;
      direction: rtl;
      /* متن‌ها فارسی و راست‌چین */
      font-size: 14px;
      color: var(--accent);
    }

    .setting-box {
      border-left: 2px solid var(--accent);
      border-right: 2px solid var(--accent);
      background-color: #fff;
      margin-bottom: 10px;
      padding: 10px;
      border-radius: 4px;
    }

    .setting-box:last-child {
      border-bottom: 2px solid var(--accent);
    }

    .setting-title {
      font-weight: bold;
      margin-bottom: 8px;
      color: #333;
    }

    /* استایل‌های عمومی برای فرم‌های داخل سایدبار */
    select,
    input[type="number"],
    input[type="text"] {
      width: 100%;
      padding: 6px;
      border: 1px solid var(--accent);
      border-radius: 4px;
      font-family: inherit;
      color: var(--accent);
      outline: none;
    }

    .btn-group {
      display: flex;
      gap: 5px;
      margin-bottom: 8px;
    }

    .btn-group button {
      flex: 1;
      padding: 6px;
      background: #ffeee2;
      border: 1px solid var(--accent);
      color: var(--accent);
      border-radius: 4px;
      cursor: pointer;
      font-family: inherit;
      font-size: 12px;
    }

    .btn-group button:hover {
      background: #faddc9;
    }

    .toggle-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 5px;
      color: #333;
      cursor: pointer;
    }

    /* سوییچ‌های زیبا به‌جای چک‌باکس خام مرورگر */
    .toggle-wrap input[type="checkbox"] {
      appearance: none;
      -webkit-appearance: none;
      width: 40px;
      height: 22px;
      background: #e2d6c8;
      border-radius: 11px;
      position: relative;
      cursor: pointer;
      flex-shrink: 0;
      outline: none;
      margin: 0;
      transition: background 0.2s ease;
    }

    .toggle-wrap input[type="checkbox"]::before {
      content: '';
      position: absolute;
      top: 2px;
      left: 2px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
      transition: transform 0.2s ease;
    }

    .toggle-wrap input[type="checkbox"]:checked {
      background: var(--accent);
    }

    .toggle-wrap input[type="checkbox"]:checked::before {
      transform: translateX(18px);
    }

    .input-row {
      display: flex;
      gap: 5px;
      margin-bottom: 8px;
    }

    /* =========================================
       استایل‌های پنجره تنظیمات (میکسر و تمپو)
       ========================================= */
    .settings-popup {
      position: fixed;
      bottom: 90px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      width: 320px;
      max-height: 70vh; /* 🆕 محدودیت ارتفاع تا از لبه‌ی صفحه بیرون نزنه */
      background: #fff;
      border-radius: 8px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
      display: flex;
      flex-direction: column;
      z-index: 150;
      opacity: 0;
      pointer-events: none;
      transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
      direction: rtl;
      overflow: hidden; /* هدر ثابت می‌مونه، فقط بدنه اسکرول می‌شه */
    }

    .settings-popup.open {
      transform: translateX(-50%) translateY(0);
      opacity: 1;
      pointer-events: auto;
    }

    .popup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15px 20px;
      border-bottom: 1px solid #eee;
      font-weight: bold;
      font-size: 16px;
      color: #333;
      flex-shrink: 0; /* 🆕 هدر هیچ‌وقت کوچک/اسکرول نمی‌شه */
    }

    .popup-header .material-icons {
      cursor: pointer;
      color: #555;
      font-size: 20px;
    }

    .popup-body {
      padding: 20px;
      min-height: 0; /* 🆕 رفع باگ کلاسیک فلکس‌باکس: بدون این، فرزند flex هیچ‌وقت واقعاً جمع نمی‌شود و overflow فعال نمی‌شود */
      overflow-y: auto;
      flex: 1;
    }

    .tab-content {
      display: none;
    }

    .tab-content.active {
      display: block;
    }

    /* =========================================
       اصلاحات نوار لغزان و Tooltip
       ========================================= */
    .slider-container {
      position: relative;
      width: 100%;
      margin: 10px 0 15px 0;
    }

    input[type=range] {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 24px;
      /* افزایش فضای قابل کلیک */
      background: transparent;
      margin: 0;
      cursor: pointer;
    }

    input[type=range]:focus {
      outline: none;
    }

    input[type=range]::-webkit-slider-runnable-track {
      width: 100%;
      height: 4px;
      background: #fdd8bd;
      border-radius: 2px;
    }

    input[type=range]::-webkit-slider-thumb {
      height: 16px;
      width: 16px;
      border-radius: 50%;
      background: var(--accent);
      -webkit-appearance: none;
      appearance: none;
      margin-top: -6px;
    }

    /* Tooltip نمایش عدد ولوم */
    .vol-tooltip {
      position: absolute;
      top: -22px;
      background: var(--accent);
      color: #fff;
      font-size: 11px;
      font-weight: bold;
      padding: 2px 6px;
      border-radius: 4px;
      opacity: 0;
      transition: opacity 0.2s;
      pointer-events: none;
      transform: translateX(50%);
      /* تنظیم مرکز টুল‌تیپ در حالت RTL */
    }

    .vol-tooltip::after {
      content: '';
      position: absolute;
      bottom: -4px;
      left: 50%;
      transform: translateX(-50%);
      border-width: 4px 4px 0;
      border-style: solid;
      border-color: var(--accent) transparent transparent transparent;
    }

    /* وقتی موس روی اسلایدر است یا در حال کشیدن هستیم، عدد نمایش داده شود */
    input[type=range]:active~.vol-tooltip,
    input[type=range]:hover~.vol-tooltip {
      opacity: 1;
    }

    .mixer-row {
      margin-bottom: 20px;
    }

    /* =========================================
       استایل‌های تب کوک سرکلید
       ========================================= */
    .tuning-warning {
      background: #fff4e5;
      border: 1px solid #f0c27b;
      color: #7a4a00;
      font-size: 12px;
      line-height: 1.9;
      padding: 10px 12px;
      border-radius: 6px;
      margin-bottom: 14px;
    }

    .tuning-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 0;
      border-bottom: 1px solid #f0f0f0;
    }

    .tuning-row:last-child {
      border-bottom: none;
    }

    .tuning-note-name {
      font-weight: bold;
      font-size: 14px;
      color: #333;
      width: 36px;
      flex-shrink: 0;
    }

    .tuning-step-controls {
      display: flex;
      align-items: center;
      gap: 6px;
      flex: 1;
      justify-content: center;
    }

    .tuning-step-btn {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      border: 1px solid var(--accent);
      background: #fff;
      color: var(--accent);
      font-size: 14px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .tuning-step-btn:hover {
      background: #ffeee2;
    }

    .tuning-step-btn:disabled {
      opacity: 0.3;
      cursor: default;
    }

    .tuning-step-label {
      font-size: 12px;
      color: #555;
      min-width: 72px;
      text-align: center;
    }

    .tuning-preview-btn {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      border: none;
      background: #ffeee2;
      color: var(--accent);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 14px;
    }

    .tuning-preview-btn:hover {
      background: #faddc9;
    }

    .mixer-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
    }

    .mute-btn {
      background: #fff;
      border: 1px solid #ddd;
      color: var(--accent);
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 12px;
      font-weight: bold;
      cursor: pointer;
      transition: 0.2s;
    }

    .mute-btn.muted {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
    }

    .popup-tabs {
      display: flex;
      border-top: 1px solid #eee;
    }

    .popup-tab-btn {
      flex: 1;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 12px 0;
      cursor: pointer;
      background: #fff;
      color: #777;
      border-bottom: 3px solid transparent;
      transition: all 0.2s;
    }

    .popup-tab-btn:first-child {
      border-bottom-right-radius: 8px;
    }

    .popup-tab-btn:last-child {
      border-bottom-left-radius: 8px;
    }

    .popup-tab-btn.active {
      background: #ffeee2;
      color: var(--accent);
      border-bottom: 3px solid var(--accent);
    }

    .popup-tab-btn svg {
      width: 24px;
      height: 24px;
      fill: currentColor;
    }

/* ==========================================
       اصلاح فونت دکمه‌های سایدبار (انتقال، دانلود و...)
       ========================================== */
    .sidebar button,
    .sidebar input,
    .sidebar select {
      font-family: 'Peyda', system-ui, -apple-system, sans-serif !important;
    }



/* ==========================================
       مخفی کردن کامل سایدبار تنظیمات (موقتی)
       ========================================== */
   /*    
    #sidebar {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
      pointer-events: none !important;
      width: 0 !important;
      height: 0 !important;
      overflow: hidden !important;
      position: absolute !important;
      left: -9999px !important;
    }

*/
