/* ===========================================================
   style.css — Poora layout + styling (RESPONSIVE)
   Mobile, tablet, desktop sab pe chalta hai.
   Bug fix: dikhne/layout/overflow galat ho toh yeh file dekho.
   =========================================================== */

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

:root {
  --bg: #14101f;
  --panel: #1c1730;
  --panel2: #241d3d;
  --border: #332b4d;
  --text: #e8e6f0;
  --muted: #9a93b3;
  --accent: #6d5ae6;
}

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* desktop: no page scroll */
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.project-name {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 14px;
  flex: 1 1 160px;
  min-width: 0;
  max-width: 240px;
}
.top-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---- Layout ---- */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Left rail */
.rail {
  width: 76px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  gap: 4px;
}
.rail-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 19px;
  padding: 11px 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-left: 3px solid transparent;
}
.rail-btn span { font-size: 11px; }
.rail-btn:hover { color: var(--text); background: var(--panel2); }
.rail-btn.active {
  color: #fff;
  border-left-color: var(--accent);
  background: var(--panel2);
}

/* Center */
.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-width: 0;
}
.canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#chart-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

/* Transport */
.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  flex-wrap: wrap;
}
.timeline { flex: 1 1 120px; min-width: 0; cursor: pointer; }
.time-display {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: var(--panel2);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.pct-display {
  font-size: 12px;
  color: var(--muted);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cur-date {
  font-size: 14px;
  color: #fff;
  min-width: 54px;
  text-align: right;
  font-weight: 600;
}

/* Right side panel */
.side {
  width: 320px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-title {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.side-panel {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;        /* horizontal scroll band */
  padding: 14px 16px;
}

/* ---- Buttons ---- */
.btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #2e2750; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.icon { padding: 8px 12px; font-size: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #7c6bf0; }
.btn.block { display: block; width: 100%; margin-bottom: 10px; }

/* ---- Property rows (FIX: slider shrink so value na cut ho) ---- */
.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.prop-row label {
  font-size: 13px;
  color: var(--muted);
  flex: 0 0 92px;            /* fixed chhota */
  min-width: 0;
  word-break: break-word;
}
.prop-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;             /* <-- yeh sabse zaroori fix: slider shrink ho sake */
}
.prop-row input[type="color"] {
  width: 38px; height: 28px; border: none; background: none; cursor: pointer;
  flex-shrink: 0;
}
.prop-text {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.prop-row select {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}
.prop-val {
  font-size: 12px;
  color: #fff;
  flex: 0 0 36px;
  text-align: right;
}
.prop-toggle { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.prop-heading {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  margin: 16px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.prop-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* ---- Layers (accordion design) ---- */
.layer-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--panel);
}
.layer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(to bottom, #29224a, #221c3c);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.layer-head:hover { background: #2e2750; }
.layer-head.sel {
  background: linear-gradient(to bottom, #3a2f66, #2e2658);
  box-shadow: inset 3px 0 0 var(--accent);
}
.layer-head-left { display: flex; align-items: center; gap: 9px; }
.layer-icon {
  font-size: 14px;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(109,90,230,0.25);
  border-radius: 6px;
}
.layer-head-right { display: flex; align-items: center; gap: 8px; }
.eye-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px 4px; border-radius: 5px;
  opacity: 0.9;
}
.eye-btn:hover { background: rgba(255,255,255,0.08); }
.layer-chev {
  color: var(--muted); font-size: 12px;
  transition: transform 0.2s;
}
.layer-chev.open { transform: rotate(180deg); }

.layer-body {
  padding: 6px 12px 12px;
  background: var(--panel);
}

/* sub-sections (dropdown inside layer) */
.sub {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  overflow: hidden;
}
.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: var(--panel2);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #cfcae6;
}
.sub-head:hover { background: #2a2348; }
.sub-arrow {
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.2s;
}
.sub-head.collapsed .sub-arrow { transform: rotate(-90deg); }
.sub-body {
  padding: 12px 11px 6px;
  background: var(--panel);
}

/* ---- Data table ---- */
.tbl-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.tbl-scroll {
  overflow: auto;
  max-height: calc(100vh - 240px);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.data-table {
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 4px 6px;
}
.data-table th {
  background: var(--panel2);
  position: sticky;
  top: 0;
}
.data-table input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  width: 84px;
}
.data-table .name-in { width: 84px; }
.data-table .color-in { width: 30px; padding: 0; height: 24px; }
.data-table .date-in { width: 58px; }
.del-col, .del-row {
  background: none; border: none; color: #e24b4a;
  cursor: pointer; font-size: 12px; margin-left: 4px;
}
label.btn { display: inline-flex; align-items: center; }

/* ===========================================================
   RESPONSIVE — Tablet aur Mobile
   =========================================================== */

/* Tablet aur chhota: layout column mein, scroll allow */
@media (max-width: 900px) {
  body { overflow: auto; height: auto; min-height: 100%; }

  .layout {
    flex-direction: column;
    min-height: 0;
  }

  /* Rail upar horizontal ho jaaye */
  .rail {
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 4px 0;
  }
  .rail-btn {
    flex: 1;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 9px 0;
  }
  .rail-btn.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  /* Canvas full width */
  .center { padding: 12px; }
  .canvas-wrap { min-height: 240px; }

  /* Side panel niche, full width */
  .side {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .side-panel { max-height: 50vh; }

  .tbl-scroll { max-height: 50vh; }
}

/* Mobile chhota: top bar wrap */
@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .project-name { order: 3; max-width: none; flex-basis: 100%; }
  .top-actions { margin-left: 0; }
  .brand { font-size: 15px; }

  .prop-row label { flex-basis: 80px; font-size: 12px; }
  .panel-title { font-size: 15px; }

  .rail-btn { font-size: 17px; }
  .rail-btn span { font-size: 10px; }
}

/* ===========================================================
   DATA VIEW — full screen spreadsheet (AlienArt jaisa)
   =========================================================== */
.hidden { display: none !important; }

.data-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.data-view-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.dv-title { font-weight: 700; font-size: 18px; color: var(--accent); }
.dv-hint { font-size: 13px; color: var(--muted); }
.data-view-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 20px;
}

/* toolbar */
.dv-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #7c6bf0; }
.btn.danger { color: #ff7b7b; border-color: #5a2a3a; }
.btn.danger:hover { background: #3a1f29; }

/* scroll area */
.dv-scroll {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

/* table */
.dv-table {
  border-collapse: collapse;
  font-size: 13px;
  width: max-content;
  min-width: 100%;
}
.dv-table th, .dv-table td {
  border: 1px solid var(--border);
  padding: 0;
}

/* sticky: sirf pehli header row (names) top pe chipke */
.dv-table thead tr:first-child th {
  position: sticky;
  top: 0;
  background: var(--panel2);
  z-index: 2;
}
.sticky-l { position: sticky; left: 0; z-index: 3; background: var(--panel2) !important; }
.dv-table thead tr:first-child .corner { z-index: 4; }

/* Image row cells */
.img-cell { padding: 6px 8px !important; text-align: center; }
.img-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  background: var(--bg);
  vertical-align: middle;
}
.img-upload:hover { border-color: var(--accent); color: #fff; }
.img-thumb {
  width: 34px; height: 34px;
  object-fit: cover;
  border-radius: 6px;
}
.img-rm {
  background: none; border: none; color: #e24b4a;
  cursor: pointer; font-size: 12px; margin-left: 2px; vertical-align: middle;
}

/* corner + labels */
.corner, .row-label {
  font-weight: 700;
  color: var(--muted);
  padding: 8px 12px !important;
  text-align: left;
  white-space: nowrap;
}

/* item header */
.item-head {
  padding: 6px 8px !important;
  min-width: 120px;
}
.item-head .name-in {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  width: 110px;
}

/* color row cells */
.color-cell {
  padding: 6px 8px !important;
  text-align: center;
}
.color-cell .color-pick {
  width: 24px; height: 24px; border: none; background: none; cursor: pointer;
  vertical-align: middle;
}
.color-cell .hex-txt {
  font-size: 11px;
  color: #fff;
  margin-left: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  vertical-align: middle;
}

/* date cells */
.date-cell { padding: 6px 8px !important; white-space: nowrap; }
.date-cell .date-in {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  width: 80px;
}

/* value cells */
.val-in {
  background: var(--bg);
  border: 1px solid transparent;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  width: 120px;
  text-align: right;
}
.val-in:focus {
  outline: none;
  border-color: var(--accent);
  background: #1a1530;
}

/* delete buttons */
.del-col, .del-row {
  background: none; border: none; color: #e24b4a;
  cursor: pointer; font-size: 13px; margin-left: 4px;
}

/* mobile: data view padding kam */
@media (max-width: 560px) {
  .data-view-head { padding: 10px 12px; }
  .data-view-body { padding: 10px 12px; }
  .dv-hint { display: none; }
}

/* ===========================================================
   EXPORT — 3D progress bar + timer
   =========================================================== */
.exp-progress-wrap {
  width: 100%;
  height: 22px;
  margin: 14px 0 8px;
  border-radius: 12px;
  background: linear-gradient(to bottom, #0e0b18, #1a1430);
  box-shadow:
    inset 0 2px 5px rgba(0,0,0,0.7),
    inset 0 -1px 1px rgba(255,255,255,0.05),
    0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  border: 1px solid #0a0814;
}
.exp-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 12px;
  background: linear-gradient(to bottom,
    #9b8bff 0%, #6d5ae6 45%, #4a37c4 55%, #5a48d6 100%);
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,0.45),
    inset 0 -2px 4px rgba(0,0,0,0.35),
    0 0 12px rgba(109,90,230,0.6);
  transition: width 0.12s linear;
  position: relative;
}
/* glossy moving shine */
.exp-progress-bar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  border-radius: 12px 12px 40% 40%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(255,255,255,0));
}
.exp-timer {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  margin-bottom: 6px;
}

/* ===========================================================
   KEYBOARD SHORTCUTS overlay + selected layer
   =========================================================== */

.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.sc-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.sc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.sc-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer;
}
.sc-close:hover { color: #fff; }
.sc-tip { font-size: 12px; color: var(--muted); margin: 6px 0 14px; }
.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.sc-group h4 {
  font-size: 13px;
  color: #fff;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.sc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
  gap: 10px;
}
.sc-item.soon { opacity: 0.5; }
.sc-item kbd {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: monospace;
  color: #fff;
  white-space: nowrap;
}

/* ===========================================================
   FLAG PICKER
   =========================================================== */
.flag-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  font-size: 14px; padding: 6px 8px; margin-left: 4px;
  vertical-align: middle;
}
.flag-btn:hover { border-color: var(--accent); background: rgba(109,90,230,0.15); }

.flag-modal {
  position: fixed; inset: 0;
  background: rgba(8,6,16,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.flag-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%; max-width: 720px;
  max-height: 86vh;
  display: flex; flex-direction: column;
  padding: 18px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.flag-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 12px;
}
.flag-search-in {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}
.flag-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.flag-cell {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s;
}
.flag-cell:hover { border-color: var(--accent); transform: translateY(-2px); }
.flag-cell img {
  width: 46px; height: 31px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.flag-cell span { font-size: 11px; color: var(--muted); line-height: 1.2; }

/* ===========================================================
   FLOATING EXPORT BADGE — har tab pe dikhta hai jab export chal rahi ho
   =========================================================== */
.export-float {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #2a2255, #1c1730);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(109,90,230,0.2);
  backdrop-filter: blur(6px);
  max-width: 320px;
}
.ef-icon { font-size: 16px; }
.ef-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  min-width: 90px;
}
.ef-bar-wrap {
  width: 90px;
  height: 8px;
  border-radius: 6px;
  background: #0e0b18;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
}
.ef-bar {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(to bottom, #9b8bff, #6d5ae6);
  transition: width 0.12s linear;
}
.ef-pct {
  font-size: 11px;
  color: var(--muted);
  min-width: 30px;
  text-align: right;
}

@media (max-width: 560px) {
  .export-float { right: 10px; left: 10px; max-width: none; top: 58px; }
}

/* ===========================================================
   AUTH BOX (Google login UI in top bar)
   =========================================================== */
.auth-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #7c6bf0; }
