/* =============================================================================
   BOXD - Dedicated Full-Window Visual CMS Studio Stylesheet
   ============================================================================= */

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

body.studio-body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #0f0f11;
  color: #f4f4f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

/* Header Bar */
.studio-header {
  height: 64px;
  background: #18181b;
  border-bottom: 2px solid #27272a;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 100;
  flex-shrink: 0;
}

.studio-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.studio-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #27272a;
  border: 1px solid #3f3f46;
  color: #e4e4e7;
  padding: 7px 12px;
  border-radius: var(--radius-sm, 6px);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.studio-back-btn:hover {
  background: #3f3f46;
  border-color: #9333ea;
  color: #ffffff;
}

.studio-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-logo {
  height: 32px;
  object-fit: contain;
}

.studio-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-badge {
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.studio-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #064e3b;
  color: #34d399;
  border: 1px solid #059669;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

.studio-live-pill .pulse-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
  animation: studioPulse 1.6s infinite;
}

@keyframes studioPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

/* Center Toolbar Controls */
.studio-header-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-pills-group {
  display: flex;
  align-items: center;
  background: #27272a;
  border-radius: var(--radius-sm, 6px);
  padding: 3px;
  gap: 3px;
}

.studio-pill {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 7px 13px;
  border-radius: 4px;
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.studio-pill:hover {
  color: #ffffff;
  background: #3f3f46;
}

.studio-pill.active {
  background: #9333ea;
  color: #ffffff;
}

.studio-device-group {
  display: flex;
  background: #27272a;
  border-radius: var(--radius-sm, 6px);
  padding: 3px;
  gap: 3px;
}

.studio-device-btn {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 7px 11px;
  border-radius: 4px;
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.studio-device-btn:hover {
  color: #ffffff;
  background: #3f3f46;
}

.studio-device-btn.active {
  background: #059669;
  color: #ffffff;
}

.studio-tool-btn {
  background: #27272a;
  border: 1.5px solid #3f3f46;
  color: #e4e4e7;
  padding: 7px 12px;
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 0.95rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.studio-tool-btn:hover {
  background: #3f3f46;
  border-color: #a855f7;
}

.studio-tool-btn.active {
  background: #9333ea;
  border-color: #9333ea;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(147, 51, 234, 0.6);
}

/* Right Toolbar Controls */
.studio-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-lang-group {
  display: flex;
  background: #27272a;
  border-radius: var(--radius-sm, 6px);
  padding: 3px;
  gap: 3px;
}

.studio-lang-pill {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 7px 11px;
  border-radius: 4px;
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.studio-lang-pill:hover {
  color: #ffffff;
  background: #3f3f46;
}

.studio-lang-pill.active {
  background: #d97706;
  color: #ffffff;
}

.studio-action-btn {
  padding: 7px 13px;
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.studio-action-btn.btn-secondary {
  background: #27272a;
  border-color: #3f3f46;
  color: #ffffff;
}

.studio-action-btn.btn-secondary:hover {
  background: #3f3f46;
  border-color: #9333ea;
}

.studio-action-btn.btn-danger {
  background: #27272a;
  border-color: #ef4444;
  color: #f87171;
}

.studio-action-btn.btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
}

.studio-action-btn.btn-save {
  background: #9333ea;
  border-color: #9333ea;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4);
}

.studio-action-btn.btn-save:hover {
  background: #7e22ce;
  transform: translateY(-1px);
}

/* Canvas Viewport */
.studio-canvas-area {
  flex: 1;
  height: calc(100vh - 64px);
  background-color: #09090b;
  background-image: radial-gradient(#27272a 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  position: relative;
}

.studio-viewport-shell {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), height 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-radius 0.3s ease;
}

.studio-viewport-shell.mobile {
  width: 390px;
  height: 844px;
  max-height: 94%;
  border: 10px solid #18181b;
  border-radius: 44px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 2px #3f3f46;
  padding-top: 28px;
}

.studio-mobile-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 18px;
  background: #18181b;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}

.studio-speaker {
  width: 38px;
  height: 4px;
  background: #27272a;
  border-radius: 2px;
}

.studio-camera {
  width: 7px;
  height: 7px;
  background: #1e1b4b;
  border-radius: 50%;
}

.studio-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.studio-loader {
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 27, 0.85);
  backdrop-filter: blur(4px);
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
}

.studio-loader i {
  font-size: 2.4rem;
  color: #9333ea;
}

.studio-loader.active {
  display: flex;
}

/* Quick Visual Edit Modal Dialog */
.studio-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: studioFadeIn 0.15s ease-out;
}

@keyframes studioFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.studio-modal-card {
  background: #18181b;
  color: #f4f4f5;
  border: 2px solid #3f3f46;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(147, 51, 234, 0.3);
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.studio-modal-header {
  padding: 16px 22px;
  background: #27272a;
  border-bottom: 1.5px solid #3f3f46;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.studio-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-modal-icon-badge {
  width: 40px;
  height: 40px;
  background: rgba(147, 51, 234, 0.15);
  border: 1.5px solid #9333ea;
  color: #a855f7;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.studio-modal-title {
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.studio-modal-section-badge {
  display: inline-block;
  background: #3f3f46;
  color: #a1a1aa;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-top: 3px;
}

.studio-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-modal-stepper {
  display: flex;
  align-items: center;
  background: #18181b;
  border: 1.5px solid #3f3f46;
  border-radius: 6px;
  padding: 2px 6px;
  gap: 4px;
}

.studio-stepper-btn {
  background: transparent;
  border: none;
  color: #a1a1aa;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.studio-stepper-btn:hover {
  background: #9333ea;
  color: #ffffff;
}

.studio-stepper-counter {
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 0.9rem;
  font-weight: 800;
  color: #9333ea;
  padding: 0 4px;
}

.studio-modal-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #a1a1aa;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.studio-modal-close:hover {
  color: #ef4444;
}

.studio-modal-sync-bar {
  background: #422006;
  border-bottom: 1.5px solid #854d0e;
  padding: 8px 22px;
  font-size: 0.92rem;
  color: #fef08a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-modal-inputs-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.studio-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  color: #e4e4e7;
}

.studio-lang-tag {
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 900;
}

.studio-lang-tag.en {
  background: #1e3a8a;
  color: #93c5fd;
}

.studio-lang-tag.ar {
  background: #78350f;
  color: #fde68a;
}

.studio-form-input, .studio-form-textarea {
  width: 100%;
  background: #09090b;
  border: 1.5px solid #3f3f46;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.studio-form-input:focus, .studio-form-textarea:focus {
  border-color: #9333ea;
  box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.4);
}

.studio-form-textarea {
  resize: vertical;
}

.studio-modal-footer {
  padding: 16px 22px;
  background: #27272a;
  border-top: 1.5px solid #3f3f46;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.studio-modal-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
}

.studio-modal-btn.btn-revert {
  margin-right: auto;
  background: transparent;
  border-color: #f59e0b;
  color: #fbbf24;
}

.studio-modal-btn.btn-revert:hover {
  background: #f59e0b;
  color: #000000;
}

.studio-modal-btn.btn-cancel {
  background: transparent;
  border-color: #52525b;
  color: #d4d4d8;
}

.studio-modal-btn.btn-cancel:hover {
  background: #3f3f46;
  color: #ffffff;
}

.studio-modal-btn.btn-apply {
  background: #9333ea;
  border-color: #9333ea;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.35);
}

.studio-modal-btn.btn-apply:hover {
  background: #7e22ce;
}

/* Slide-Out Drawer */
.studio-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  justify-content: flex-end;
  animation: studioFadeIn 0.2s ease;
}

.studio-drawer {
  width: 480px;
  max-width: 90vw;
  height: 100%;
  background: #18181b;
  color: #f4f4f5;
  border-left: 2px solid #3f3f46;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  animation: studioSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes studioSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

[dir="rtl"] .studio-drawer {
  border-left: none;
  border-right: 2px solid #3f3f46;
}

.studio-drawer-header {
  padding: 18px 20px;
  background: #27272a;
  border-bottom: 1.5px solid #3f3f46;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-drawer-title {
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.studio-drawer-subtitle {
  font-size: 0.92rem;
  color: #a1a1aa;
  margin: 2px 0 0;
}

.studio-drawer-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #a1a1aa;
  cursor: pointer;
}

.studio-drawer-close:hover {
  color: #ef4444;
}

.studio-drawer-search {
  padding: 12px 20px;
  background: #202023;
  border-bottom: 1.5px solid #3f3f46;
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-drawer-search i {
  color: #71717a;
  font-size: 1.1rem;
}

.studio-drawer-search input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  color: #ffffff;
}

.studio-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.studio-drawer-item {
  background: #27272a;
  border: 1.5px solid #3f3f46;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}

.studio-drawer-item:hover {
  border-color: #9333ea;
  background: #2e2638;
  transform: translateX(-3px);
}

.studio-drawer-item-title {
  font-family: var(--font-display, 'Impact', sans-serif);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.studio-drawer-item-preview {
  font-size: 0.9rem;
  color: #a1a1aa;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.studio-drawer-item-btn {
  background: rgba(147, 51, 234, 0.18);
  color: #c084fc;
  border: 1px solid #9333ea;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.9rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.studio-drawer-item:hover .studio-drawer-item-btn {
  background: #9333ea;
  color: #ffffff;
}

@media (max-width: 992px) {
  .studio-header {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .studio-header-center {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .studio-canvas-area {
    height: calc(100vh - 120px);
  }
}
