/* ==========================================================================
   OSCA INDIA STUDIO — Zero-Scroll Viewport-Locked Responsive Layout
   Fits completely inside 100dvh on Phone, Tablet, and Desktop (No page scroll / no tab slide)
   ========================================================================== */

html,
body {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.app-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 45% at 15% -10%, rgba(249, 115, 22, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 40% at 88% -5%, rgba(37, 99, 235, 0.12), transparent 52%),
    var(--bg-shell);
}

/* Header Bar — Clean Non-Overlapping on All Widths */
.studio-header {
  flex-shrink: 0;
  z-index: 50;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.36);
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Main Locked Workstation Container */
.studio-main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 8px 12px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 10px;
  overflow: hidden;
}

.studio-main.preview-fullscreen {
  grid-template-columns: minmax(0, 1fr);
}

.studio-main.preview-fullscreen .studio-right-col {
  display: none;
}

/* Left Canvas Workspace */
.studio-left-col {
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.canvas-topbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  padding: 6px 9px;
}

.canvas-stage-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(25, 35, 52, 0.92), rgba(15, 23, 42, 0.96));
}

.canvas-stage-wrap {
  container-type: size;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.45), rgba(6, 10, 20, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.12);
}

/* Exact Aspect-Ratio Scaling Inside Any Screen */
.canvas-viewport {
  position: relative;
  height: auto;
  max-height: 96cqh;
  max-width: 96cqw;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-stage);
  background-color: var(--bg-stage);
  background-image:
    linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.canvas-viewport.ratio-4-5 {
  aspect-ratio: 4 / 5;
  width: min(96cqw, calc(96cqh * 0.8));
}

.canvas-viewport.ratio-1-1 {
  aspect-ratio: 1 / 1;
  width: min(96cqw, 96cqh);
}

.canvas-viewport.ratio-9-16 {
  aspect-ratio: 9 / 16;
  width: min(96cqw, calc(96cqh * 0.5625));
}

#studioCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#studioCanvas:active {
  cursor: grabbing;
}

/* Right Studio Inspector — Fixed Height, Zero Sliding Tabs */
.studio-right-col {
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
}

/* 4x2 Visible Tool Button Grid — ZERO horizontal scrolling */
.studio-tabs-bar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.studio-panels-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.studio-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-panel[data-panel-hidden="true"] {
  display: none !important;
}

.panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  scrollbar-width: thin;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 9px 11px;
}

/* Medium Laptops */
@media (max-width: 1140px) {
  .studio-main {
    grid-template-columns: minmax(0, 1fr) 390px;
    padding: 6px 8px;
    gap: 8px;
  }
}

/* Tablets & Mobile Phones (<= 959px) — Zero Page Scroll App Layout */
@media (max-width: 959px) {
  .studio-header {
    flex-direction: column;
    align-items: stretch;
    padding: 5px 8px;
    gap: 5px;
  }

  .header-brand-group {
    justify-content: space-between;
    width: 100%;
  }

  .brand-title {
    font-size: 13px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }

  .studio-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .studio-main.preview-fullscreen {
    grid-template-rows: minmax(0, 1fr);
  }

  .studio-left-col {
    height: auto;
    min-height: 0;
    gap: 5px;
  }

  .canvas-topbar {
    padding: 5px 7px;
    gap: 4px;
  }

  .canvas-stage-card {
    padding: 6px;
    gap: 5px;
  }

  .studio-right-col {
    height: auto;
    max-height: 45dvh;
    min-height: 225px;
    gap: 5px;
  }

  .card {
    padding: 8px 9px;
  }
}

/* Small Smartphones (<= 420px / <= 700px height) */
@media (max-width: 420px) {
  .studio-header {
    padding: 4px 6px;
    gap: 4px;
  }

  .brand-title {
    font-size: 12px;
  }

  .studio-main {
    padding: 4px 5px calc(5px + env(safe-area-inset-bottom));
    gap: 5px;
  }

  .studio-right-col {
    max-height: 47dvh;
    min-height: 210px;
  }
}
