
/* =========================
   ROOT VARIABLES
========================= */

:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;

  --accent: #6366f1;
  --accent2: #22c55e;
}

/* DARK MODE */
body.dark {
  --bg: #0f172a;
  --card: #020617;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #1e293b;
}

/* =========================
   BASE
========================= */



/* =========================
   LAYOUT
========================= */

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 1400px;
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* =========================
   PANELS
========================= */

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}

.sidebar-left,
.sidebar-right {
  position: sticky;
  top: 20px;
}

.sidebar-right {
  min-width: 320px;
  border-color: rgba(99,102,241,0.35);
  box-shadow: 0 10px 28px rgba(99,102,241,0.12);
}

.app-layout-toolbar {
  width: 100%;
  max-width: 1400px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.app-layout-toolbar button {
  padding: 10px 12px;
  font-size: 13px;
}

.app-layout.app-layout-fullscreen {
  width: 100%;
  max-width: 100%;
  height: 100%;
  grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
  align-items: start;
}

@media (max-width: 1100px) {
  .app-layout.app-layout-fullscreen {
    grid-template-columns: 1fr;
  }
}

.main-center {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =========================
   BUTTONS
========================= */

button {
  border: none;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(135deg,var(--accent),var(--accent2));
  color: white;
  transition: all 0.25s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.15);
}

button:active {
  transform: scale(0.98);
}

/* =========================
   INPUT GRID
========================= */

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

/* =========================
   FLOATING INPUT
========================= */

.input-group {
  position: relative;
}

.input-group input {
  width: 90%;
  padding: 14px 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  transition: all 0.25s ease;
}

/* label */
.input-group label {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
  transition: all 0.2s ease;
}

/* focus + filled */
.input-group input:focus,
.input-group input:not(:placeholder-shown) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: -6px;
  left: 8px;
  font-size: 11px;
  background: var(--card);
  padding: 0 4px;
  color: var(--accent);
}

/* hover */
.input-group:hover input {
  border-color: var(--accent);
}

/* =========================
   RESULT BOX
========================= */

.result,
.recommendation {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  margin-top: 10px;
  animation: fadeInUp 0.4s ease;
}

/* =========================
   HISTORY
========================= */

.history-box {
  font-size: 13px;
  color: var(--muted);
}

/* =========================
   ANIMATION
========================= */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}








/* =========================
   SLIDER GROUP
========================= */

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.slider-top label {
  color: var(--muted);
}

.slider-value {
  width: 70px;
  text-align: center;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
}

/* =========================
   SLIDER STYLE
========================= */

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--accent) 50%, var(--border) 50%);
  outline: none;
  transition: 0.2s;
}

/* thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Firefox */
input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--accent);
}

/* =========================
   DARK FIX
========================= */

body.dark input[type="range"] {
  background: linear-gradient(to right, var(--accent) 50%, #1e293b 50%);
}

/* =========================
   V3 SIMULATION CONTROLS
========================= */

.sim-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sim-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.sim-field label.mini-label,
.mini-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.sim-field select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}

.sim-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.sim-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

button.preset-btn {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.preset-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.battery-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.battery-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(99,102,241,0.04);
}

body.dark .battery-card {
  background: rgba(99,102,241,0.08);
}

.battery-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.battery-card .big {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.stress-low { color: #22c55e; }
.stress-med { color: #eab308; }
.stress-high { color: #ef4444; }

.range-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.range-pill {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}

.state-safe { color: #16a34a; }
.state-border { color: #ca8a04; }
.state-bad { color: #dc2626; }
.state-deep { color: #b91c1c; }

.recommendation.action-line {
  font-weight: 600;
  margin-top: 8px;
}

/* =========================
   HISTORY (ADD-ON)
========================= */

.history-save-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

#historySaveName {
  width: 100%;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
}

#historySaveBtn {
  width: 100%;
  padding: 10px;
  font-size: 13px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 2px;
  position: relative;
}

.history-list::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(180deg, rgba(99,102,241,0.45), rgba(99,102,241,0.08));
  pointer-events: none;
}

.history-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 18px 8px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  line-height: 1.45;
}

.history-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 10px 10px 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(34,197,94,0.06));
  box-shadow: 0 6px 16px rgba(15,23,42,0.08);
  animation: historyCardIn 0.35s ease;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease, transform 0.25s ease;
  position: relative;
}

body.dark .history-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(2,6,23,0.6));
}

.history-card::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.history-card.history-card-removing {
  opacity: 0;
  transform: translateX(8px);
}

.history-card.history-compare-on {
  border-color: rgba(99,102,241,0.65);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.24), 0 12px 24px rgba(99,102,241,0.14);
}

@keyframes historyCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.history-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.history-range-pill {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  background: rgba(34,197,94,0.26);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.history-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.history-energy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 8px;
}

.history-energy-tag {
  font-size: 11px;
  color: var(--muted);
}

.history-energy-value {
  font-size: 12px;
  font-weight: 700;
}

.history-eff-bar {
  grid-column: 1 / -1;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(148,163,184,0.35);
  overflow: hidden;
}

.history-eff-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #0ea5e9);
  transition: width 0.25s ease;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-actions button {
  flex: 1 1 auto;
  min-width: 44px;
  padding: 8px 6px;
  font-size: 12px;
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 600;
}

.history-actions button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15,23,42,0.14);
}

.history-loading-fx {
  display: inline-block;
  opacity: 0;
  transform: translateY(2px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.history-loading-fx.active {
  opacity: 1;
  transform: translateY(0);
}

.history-restore-fade {
  animation: historyRestoreFade 0.7s ease;
}

@keyframes historyRestoreFade {
  0% { opacity: 0.2; filter: saturate(0.85); }
  100% { opacity: 1; filter: saturate(1); }
}

.history-name-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  margin-bottom: 6px;
  box-sizing: border-box;
}

.history-compare-panel {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(99,102,241,0.06);
  font-size: 12px;
}

body.dark .history-compare-panel {
  background: rgba(99,102,241,0.1);
}

.history-compare-panel h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text);
}

.history-cmp-table {
  width: 100%;
  border-collapse: collapse;
}

.history-cmp-table th,
.history-cmp-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 4px;
  text-align: left;
  vertical-align: top;
}

.history-cmp-best {
  background: rgba(34,197,94,0.18);
  font-weight: 700;
  border-radius: 6px;
}

.history-cmp-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}




.tool-header {
  width: 96%;
  max-width: 1400px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border-radius: 16px;

  background: linear-gradient(135deg, #ffffff, #f1f5ff);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

body.dark .tool-header {
  background: linear-gradient(135deg, #0b1220, #0f172a);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tool-header-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  background: var(--accent2);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(34,197,94,0.6);
}

.tool-title {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.title-icon img {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

body.dark .theme-toggle {
  background: rgba(0,0,0,0.25);
}






.tool-header {
  position: sticky;
  top: 0;
  z-index: 999;
  transition: all 0.25s ease;
}

/* מצב רגיל */
.tool-header {
  padding: 16px 20px;
  transform: scale(1);
}

/* מצב קומפקטי */
.tool-header.compact {
  padding: 8px 16px;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.7);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

body.dark .tool-header.compact {
  background: rgba(15,23,42,0.75);
}

/* טקסטים קטנים יותר במצב קומפקטי */
.tool-header.compact .tool-title {
  font-size: 16px;
}

.tool-header.compact .subtitle {
  display: none;
}

.tool-header.compact .usage-progress {
  display: none; /* אופציונלי – חוסך מקום */
}

.tool-header.compact .brand-title {
  font-size: 14px;
}
