@media (min-width: 1024px) {

  /* ============================================================
     1. ضبط الهيكل والحاويات (Desktop Layout)
     ============================================================ */
  .header {
    padding: 12px 40px;
  }

  .main-container {
    margin-left: 100px;
    width: calc(100% - 100px);
    padding: 20px;
    min-height: calc(100vh - 65px);
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  /* عند فتح القوائم، نزيح التصميم لليمين */
  body.panel-is-open .main-container {
    margin-left: 380px;
    width: calc(100% - 380px);
    transition:
      margin-left 0.3s ease,
      width 0.3s ease;
  }

  /* ============================================================
     2. شريط الأدوات الرئيسي (Main Floating Toolbar)
     يتحول من شريط سفلي أفقي -> شريط أيسر عمودي
     ============================================================ */
  .floating-toolbar {
    position: fixed;
    top: 83px;
    left: 20px;
    bottom: auto;
    right: auto;
    width: 65px;
    height: auto;
    max-height: calc(100vh - 120px);
    background: var(--bg-panel);
    border-radius: 35px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px;
    padding: 20px 0;
    transform: none;
    z-index: 1000;
  }

  .toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .logo-img {
    height: 45px;
    width: auto;
    display: block;
    transform: scale(1.1);
    transform-origin: center;
  }

  /* ============================================================
     3. تنسيق الأزرار (Desktop Buttons)
     ============================================================ */


  /* ============================================================
     4. القوائم الجانبية العائمة (Sidebar Panels)
     تتحول من Bottom Sheet -> Floating Left Panel
     ============================================================ */
  .sidebar-panel,
  .toolbar-group {
    position: fixed;
    top: 90px;
    left: 95px;
    /* بجوار الشريط العمودي */
    bottom: auto;
    right: auto;
    width: 300px;
    height: auto;
    max-height: calc(100vh - 120px);
    background: var(--bg-panel);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 10px 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1300;
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translate3d(-30px, 0, 0);
    /* تطلع من الشمال */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
  }

  .toolbar-group {
    top: -43px;
    /* ضبط موقع القوائم الفرعية */
  }

  .sidebar-panel.active,
  .toolbar-group.active-tab {
    visibility: visible;
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .panel-header .panel-close {
    display: none;
    /* إخفاء زر الإغلاق */
  }

  .pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  /* ============================================================
     5. أشرطة التعديل الفرعية (Sub-Toolbars)
     ============================================================ */
  .text-edit-toolbar,
  #imageEditToolbar,
  #patternEditToolbar {
    position: fixed;
    top: 380px;
    left: 20px;
    width: 65px;
    /* max-height: calc(100vh - 400px); */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    border: none;
    z-index: 1200;
    visibility: hidden;
    opacity: 0;
    transform: translate3d(-50px, 0, 0);
    transition:
      transform 0.4s,
      opacity 0.4s,
      visibility 0.4s;
  }

  .text-edit-toolbar.active,
  #imageEditToolbar.active,
  #patternEditToolbar.active {
    visibility: visible;
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .text-edit-toolbar::-webkit-scrollbar,
  #imageEditToolbar::-webkit-scrollbar,
  #patternEditToolbar::-webkit-scrollbar {
    width: 0;
  }

  /* ============================================================
     6. أدوات التحكم الداخلية (Dock Navigation)
     ============================================================ */
  /* ============================================================
   💻 DESKTOP BUTTONS & DOCK (مقاسات الكمبيوتر فقط)
   ============================================================ */

  /* 1. أزرار الشريط الجانبي (عمودية) */
  .tool-btn {
    width: 50px;
    height: auto;
    padding: 5px 0;
    margin: 0 auto;
    flex-direction: column;
    gap: 4px;
    border-radius: 12px;
  }

  .floating-toolbar .tool-btn i {
    font-size: 1.4rem;
    margin-bottom: 2px;
  }

  .floating-toolbar .btn-label {
    font-size: 0.65rem;
    display: block;
  }

  /* أزرار صغيرة (لأدوات النصوص) */
  .tool-btn.small {
    width: 40px;
    height: 40px;
    flex-direction: row;
    /*background: var(--text-light);*/
    /* يمكن تعديلها لاحقاً */
  }

  .tool-btn.small i {
    font-size: 1rem;
    margin: 0;
  }

  /* 2. شريط الدوك (قائمة جانبية عمودية) */
  .dock-navigation {
    width: 100%;
    flex-direction: column;
    /* عمودي */
    gap: 9px;
    padding: 20px 5px;
    border-radius: 35px;
    /* دوران كامل */
    position: relative;
    top: -56px;
  }

  .dock-btn {
    width: 100%;
    min-height: 40px;
    flex-direction: column;
    gap: 3px;
    border-radius: 15px;
  }

  .dock-btn span {
    font-size: 9px;
  }

  /* الفاصل الأفقي */
  .dock-navigation>div[style] {
    width: 60%;
    height: 1px;
    background: #e2e8f0;
    margin: 2px auto;
  }

  /* زر الإغلاق */
  .dock-btn.close {
    width: 100%;
    /* كامل العرض */
    height: 40px;
    border-radius: 15px;
    /* ليس دائرياً تماماً في الكمبيوتر */
    margin: 5px 0;
  }


  .flip-card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    transform-origin: center center;
    /* التأكيد على الدوران من المركز */
    will-change: transform;
  }

  .flip-card.is-flipped {
    transform: rotateY(180deg);
  }

  .card-back {
    transform: rotateY(180deg);
  }

  .printable-wrapper {
    position: absolute;
    z-index: 10;
    overflow: visible;
    border: 1px dashed transparent;
    transition: border-color 0.3s ease;
  }

  .printable-wrapper:hover {
    border-color: rgba(37, 99, 235, 0.5);
  }

  .card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
    transition: height 0s;
  }

  .card-face.active-face {
    pointer-events: auto;
    z-index: 10;
  }

  /* ============================================================
     7. إعدادات متنوعة (Misc)
     ============================================================ */
  .editor-container {
    position: relative;
    top: 32%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    border: 1px solid #eee;
  }

  .pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .pattern-item {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
  }





  #saveBtn {
    position: relative;
    bottom: auto;
    left: 410px;
    z-index: 10;
    transform: none;
    width: auto;
    padding: 8px 20px;
    border-radius: 10px;
    box-shadow: none;
    margin-left: 10px;
  }

  #saveBtn:hover {
    transform: translateY(-2px);
  }


  /* ============================================================
   1. ضبط الهيكل والتوسط (Desktop Layout Centering)
   استبدل هذا الجزء في css_pc.css
   ============================================================ */

  .main-container {
    margin-left: 80px;
    width: calc(100% - 80px);
    height: calc(100vh - 65px);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .design-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ============================================================
   ضبط حجم ومكان التيشرت (Flip Scene & Editor)
   ============================================================ */
  .flip-scene {
    height: 85vh;
    width: auto;
    aspect-ratio: 1 / 1.2;
    max-width: 650px;
    margin: 0 auto;
    perspective: 1000px;

    top: 28%;

  }

  .editor-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    /* تنظيف الشكل */
    background: transparent;
    box-shadow: none;
    border: none;
    margin: 0;
  }

  /* ضبط الصورة لتملأ الحاوية دون أن تُقص */
  .product-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* ============================================================
   💻 DESKTOP PANELS (Sidebars)
   ============================================================ */

  /* 1. القوائم تظهر من اليسار (بجوار الشريط) */
  .sidebar-panel,
  .toolbar-group {
    position: fixed;
    /*top: 90px;*/
    left: 95px;
    bottom: auto;
    right: auto;

    width: 300px;
    height: auto;
    max-height: calc(100vh - 120px);
    border-radius: 20px;

    /* الحالة المخفية: تختفي لليسار */
    transform: translate3d(-20px, 0, 0);
    opacity: 0;
    visibility: hidden;
  }

  /* الحالة النشطة */
  .sidebar-panel.active,
  .toolbar-group.active-tab {
    transform: translate3d(0, 0, 0);
    opacity: 1;
    visibility: visible;
  }

  /* إخفاء زر الإغلاق في الكمبيوتر (لأننا بنقفل بالضغط بره) */
  .panel-close {
    display: none;
  }

  /* 2. الحاوية المجمعة لليمين (Right Controls) */
  .right-sidebar-controls {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);

    /* الحاوية دي بتضم الألوان والمعرض مع بعض */
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 10px;
    width: auto;
    border-radius: 30px;
  }

  /* 3. إلغاء التنسيق الفردي للأطفال داخل الحاوية */
  /* لأنهم بقوا جوه الكونتينر الكبير، مش محتاجين بورد ولا خلفية لوحدهم */
  .right-sidebar-controls .color-switcher-group,
  .right-sidebar-controls .view-gallery {
    position: static;
    transform: none;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* 4. الفاصل (Divider) */
  .sidebar-divider {
    width: 25px;
    height: 1px;
    background: var(--border-color);
    display: block;
    margin: 5px auto;
  }

  /* الأحجام في الكمبيوتر */
  .color-btn {
    width: 32px;
    height: 32px;
    margin: 0;
  }

  .view-thumb {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    /* مربع بحواف دائرية */
  }

  .thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 9px;
    padding: 2px 0;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .view-thumb:hover .thumb-label {
    opacity: 1;
  }

  /* 1. ضبط الزر ليكون حراً في الحركة */
  .flip-toggle-btn {
    position: fixed;
    /* تثبيت بالنسبة للشاشة مش للصندوق */

    /* 2. الإحداثيات الجديدة (أعلى يمين منطقة العمل) */
    top: -166px;
    /* تحت الهيدر مباشرة */
    right: -57px;
    /* بعيد عن القائمة الجانبية اليمين */
    left: auto;
    bottom: auto;

    /* 3. إلغاء أي تأثيرات قديمة */
    transform: none;
    margin: 0;

    /* 4. التنسيق الجمالي (كبسولة) */
    width: auto;
    height: 40px;
    padding: 5px 20px;
    border-radius: 50px;

    /* 5. الألوان (متوافقة مع الدارك مود) */
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);

    z-index: 1100;
    /* فوق كل العناصر */

    /* فليكس لضبط الأيقونة والنص */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  /* إظهار النص في الكمبيوتر */
  .flip-toggle-btn span {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
  }

  /* تأثير الهوفر */
  .flip-toggle-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
  }


  /* ============================================================
   💻 DESKTOP JOYSTICK (دائماً مفتوح)
   ============================================================ */

  /* إخفاء زر التوسيع بتاع الموبايل */
  .mobile-expand-btn {
    display: none;
  }

  /* ضمان إن الأسهم ظاهرة دائماً */
  .d-pad-wrapper {
    max-height: none;
    opacity: 1;
    display: block;
  }

  /* إلغاء بادينج الموبايل */
  .floating-joystick {
    padding-bottom: 0;
  }

  .floating-joystick.collapsed-mobile .d-pad-wrapper {
  max-height: 100%;
  opacity: 1;
}
}


