/* ============================================================
   DESIGN SYSTEM — CSS Custom Properties
   ============================================================ */
:root {
  /* Dark mode (default) — Gemini-style mat koyu */
  --bg-base:       #131314;
  --bg-surface:    #1e1f20;
  --bg-elevated:   #282a2c;
  --bg-dark:       #131314;
  --bg-purple:     #1e1f20;

  --glass-bg:      rgba(255, 255, 255, 0.04);
  --glass-border:  rgba(255, 255, 255, 0.09);
  --glass-blur:    blur(12px);

  /* Accent: soft muted blue — neon-free */
  --accent:        #8ab4f8;
  --accent-dim:    rgba(138, 180, 248, 0.15);
  --accent-border: rgba(138, 180, 248, 0.25);

  /* Legacy aliases (prevents breakage of old rules) */
  --neon-blue:   #8ab4f8;
  --neon-purple: #c084fc;
  --neon-pink:   #e879f9;
  --danger-red:  #f28b82;

  --text-primary:   #e3e3e3;
  --text-secondary: rgba(227, 227, 227, 0.65);
  --text-dim:       rgba(227, 227, 227, 0.35);

  --btn-num-bg:  rgba(255, 255, 255, 0.06);
  --btn-op-bg:   rgba(138, 180, 248, 0.1);
  --btn-sci-bg:  rgba(192, 132, 252, 0.08);

  --sidebar-width: 280px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
  overflow-y: hidden;
}

::selection {
  background: var(--accent-dim);
  color: var(--text-primary);
}

/* Arka plan orbs kaldırıldı — minimal tasarım */
.bg-orb { display: none; }

/* ============================================================
   DASHBOARD CONTAINER
   ============================================================ */
.dashboard {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   MOBILE OVERLAY
   ============================================================ */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  opacity: 0;
  pointer-events: none !important;
  transition: opacity 0.3s ease;
}

.mobile-overlay--active {
  opacity: 1;
  pointer-events: auto !important;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100dvh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}

.sidebar--open {
  transform: translateX(0);
}

.sidebar__header {
  padding: 48px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.sidebar__lang-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: background 0.2s ease, color 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.sidebar__lang-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.sidebar__menu {
  list-style: none;
  flex: 1;
  flex-grow: 1;
  padding: 12px 0;
  overflow-y: auto;
  min-height: 0;
}

/* Accordion Sidebar */
.menu-group {
  margin-bottom: 5px;
}
.accordion-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 24px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.25s ease;
}
.accordion-btn:hover {
  background: var(--glass-bg);
}
.acc-icon {
  font-size: 10px;
  transition: transform 0.3s ease;
  color: var(--text-dim);
}
.accordion-btn.open .acc-icon {
  transform: rotate(180deg);
}
.accordion-content {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}
.accordion-content.show {
  max-height: 500px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px 12px 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  border-left: 4px solid transparent;
}

.sidebar__item:hover {
  background: rgba(128, 128, 128, 0.05);
  color: var(--text-primary);
}

.sidebar__item--active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
}

.dashboard-nav-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  justify-content: center;
  font-weight: 600;
  width: 100%;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dashboard-nav-btn:hover {
  background: var(--bg-elevated);
}

.dashboard-nav-btn.sidebar__item--active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.sidebar__icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar__footer {
  padding-top: 15px;
  padding-bottom: 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  flex-shrink: 0;
}

/* ============================================================
   AUTH UI
   ============================================================ */
.sidebar__auth {
  margin-top: auto;
  margin-bottom: 15px;
  padding: 0 15px;
}

.btn--auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 10px 15px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn--auth:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.auth-icon {
  width: 20px;
  height: 20px;
}

.auth-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 8px 12px;
  border-radius: 8px;
}

.auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  object-fit: cover;
}

.auth-name {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn--logout {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  padding: 4px;
}

.btn--logout:hover {
  opacity: 1;
  transform: scale(1.1);
}

.sidebar__version {
  color: var(--text-dim);
  font-size: 11px;
}

.sidebar__brand {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar__brand-text {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar__brand-name {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.sidebar__brand-link {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.sidebar__brand-link:hover {
  color: var(--text-primary);
}

/* ============================================================
   MOBILE MENU BUTTON
   ============================================================ */
.mobile-menu-btn,
.hamburger-btn {
  display: flex;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10000;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.mobile-menu-btn:hover,
.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace {
  margin-left: 0;
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 32px;
  padding-top: 80px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace--shifted {
  margin-left: var(--sidebar-width);
}

/* Custom scrollbar for workspace and sidebar */
.workspace::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 4px; /* Thin scrollbar */
  height: 4px;
}

.workspace::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.workspace::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.workspace::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   WORKSPACE PANELS
   ============================================================ */
.workspace__panel {
  display: none;
}

.workspace__panel--active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   PANEL CARDS
   ============================================================ */
.panel-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
}

/* ============================================================
   PANEL TITLE
   ============================================================ */
.panel-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

/* ============================================================
   STANDARD TAB — TOPBAR
   ============================================================ */
.calc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.topbar-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.topbar-btn--mode {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.topbar-btn--mode:hover {
  background: rgba(138, 180, 248, 0.2);
}

.topbar-btn--active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-border);
}

.topbar-nav {
  display: flex;
  gap: 6px;
}

.topbar-btn--nav:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ============================================================
   STANDARD TAB — DISPLAY
   ============================================================ */
.display {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  min-height: 160px;
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.display__expr-container {
  overflow-x: auto;
  margin-bottom: 8px;
}

.display__expr-container::-webkit-scrollbar {
  height: 3px;
}

.display__expr-container::-webkit-scrollbar-track {
  background: transparent;
}

.display__expr-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

math-field {
  font-size: 24px;
  background-color: transparent;
  color: var(--accent);
  border: none;
  width: 100%;
  --caret-color: var(--accent);
  --selection-background-color: rgba(138, 180, 248, 0.2);
  --selection-color: #fff;
  outline: none;
}

math-field:focus-within {
  outline: none;
}

.display__expr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  color: var(--text-dim);
  text-align: right;
  min-height: 28px;
  word-break: break-all;
}

.display__expr .katex {
  font-size: 20px !important;
  color: var(--text-secondary) !important;
}

.display__result,
.display-result {
  font-family: 'JetBrains Mono', monospace;
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  overflow-x: auto;
  white-space: nowrap;
  margin-top: 10px;
  align-self: flex-end;
  font-weight: bold;
}

.display__result::-webkit-scrollbar {
  height: 3px;
}

.display__result::-webkit-scrollbar-track {
  background: transparent;
}

.display__result::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.display__result--small {
  font-size: 26px;
}

.display__result .katex {
  font-size: 42px !important;
}

.katex-display {
  margin: 0 !important;
}

/* ============================================================
   CALC GRIDS — SIDE BY SIDE LAYOUT
   ============================================================ */
.calc-grids {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

/* ============================================================
   BUTTON GRIDS
   ============================================================ */
.btn-grid--sci {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.btn-grid--main {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.btn:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
}

/* Number buttons */
.btn--num {
  background: var(--btn-num-bg);
}

.btn--num:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn--num:active {
  transform: scale(0.95);
}

/* Operator buttons */
.btn--op {
  background: var(--btn-op-bg);
  color: var(--accent);
}

.btn--op:hover {
  background: rgba(138, 180, 248, 0.18);
}

.btn--op:active {
  transform: scale(0.95);
}

/* Scientific buttons */
.btn--sci {
  background: var(--btn-sci-bg);
  color: var(--neon-purple);
  font-size: 13px;
}

.btn--sci:hover {
  background: rgba(192, 132, 252, 0.16);
}

.btn--sci:active {
  transform: scale(0.95);
}

/* Danger button (AC) */
.btn--danger {
  background: rgba(242, 139, 130, 0.1);
  color: var(--danger-red);
}

.btn--danger:hover {
  background: rgba(242, 139, 130, 0.2);
}

.btn--danger:active {
  transform: scale(0.95);
}

/* Equals button */
.btn--equals {
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}

.btn--equals:hover {
  background: rgba(138, 180, 248, 0.25);
}

.btn--equals:active {
  transform: scale(0.93);
}

/* ============================================================
   PANEL COMMON ELEMENTS
   ============================================================ */
.panel-field {
  margin-bottom: 14px;
}

.panel-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
}

.panel-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.panel-input:focus {
  border-color: var(--accent);
}

.panel-input::placeholder {
  color: var(--text-dim);
}

.panel-input--narrow {
  max-width: 120px;
}

.panel-input--sm {
  flex: 1;
  min-width: 0;
}

.panel-select {
  width: 100%;
  padding: 12px 36px 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(227,227,227,0.5)' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.panel-select:focus {
  border-color: var(--accent);
}

/* Koyu Mod Varsayılanı (Tüm select ve option'lar) */
select, .panel-select {
  background-color: var(--bg-surface);
  color: #ffffff;
}

option, .panel-select option {
  background: #1e1e24;
  color: #ffffff;
}

/* Açık Mod Override */
[data-theme="light"] select, [data-theme="light"] .panel-select {
  background-color: #ffffff;
  color: #333333;
}

[data-theme="light"] option, [data-theme="light"] .panel-select option {
  background: #ffffff;
  color: #333333;
}

.panel-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 20px 0 10px;
}

.panel-result {
  background: var(--bg-base);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--accent);
  min-height: 52px;
  white-space: pre-wrap;
  word-break: break-all;
}

.panel-result--matrix {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.8;
}

.btn--panel-action {
  padding: 12px 20px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.btn--panel-action:hover {
  background: rgba(138, 180, 248, 0.22);
}

.btn--panel-action--wide {
  width: 100%;
  margin-top: 12px;
}

.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ============================================================
   INFO BANNER
   ============================================================ */
.info-banner {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================================
   MATRIX TAB
   ============================================================ */
.matrix-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.matrix-block {
  width: 100%;
}

.matrix-grid-wrapper {
  overflow: auto;
  max-height: 400px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
  padding: 12px;
}

.matrix-grid-wrapper::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.matrix-grid-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.matrix-grid-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.matrix-grid {
  display: grid;
  gap: 6px;
}

.matrix-grid input {
  width: 100%;
  padding: 8px 6px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.matrix-grid input:focus {
  border-color: var(--accent);
}

/* ============================================================
   EQUATION TAB
   ============================================================ */
.eqn-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.eqn-inputs {
  margin: 16px 0;
  display: grid;
  gap: 8px;
}

.eqn-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eqn-field label {
  min-width: 30px;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   COMPLEX NUMBER TAB
   ============================================================ */
.cmplx-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}

.cmplx-group {
  /* standard block */
}

.cmplx-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmplx-sign {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
}

/* ============================================================
   CONVERTER TAB
   ============================================================ */
.conv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.conv-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color 0.25s ease;
}

.conv-card:hover {
  border-color: rgba(0, 212, 255, 0.15);
}

.conv-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.conv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.conv-row:last-child {
  margin-bottom: 0;
}

.conv-row .panel-input,
.conv-row .panel-select {
  flex: 1 1 150px;
  min-width: 120px;
}

.conv-row input,
.conv-result {
  text-overflow: ellipsis;
  word-wrap: break-word;
  font-size: min(16px, 4vw);
}

.conv-arrow {
  color: var(--neon-blue);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   BASE-N TAB
   ============================================================ */
.base-display {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.base-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.base-row:last-child {
  border-bottom: none;
}

.base-label {
  width: 50px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
}

.base-value {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: #fff;
  text-align: right;
  word-break: break-all;
}

.base-mode-btns {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.btn--base {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.btn--base:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn--base-active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-border);
}

.logic-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

/* ============================================================
   CONSTANTS TAB
   ============================================================ */
.custom-const-form {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.custom-const-form .panel-subtitle {
  margin-top: 0;
  margin-bottom: 12px;
}

.custom-const-form .action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0;
}

.custom-const-form .panel-input {
  flex: 1;
  min-width: 120px;
}

.custom-const-form .btn--panel-action {
  flex-shrink: 0;
  background: rgba(138, 180, 248, 0.1);
  border-color: var(--accent-border);
  color: var(--accent);
}

.custom-const-form .btn--panel-action:hover {
  background: rgba(138, 180, 248, 0.2);
}

.const-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.const-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.const-list::-webkit-scrollbar {
  width: 5px;
}

.const-list::-webkit-scrollbar-track {
  background: transparent;
}

.const-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.const-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.const-item:hover {
  background: rgba(0, 212, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.15);
}

.const-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
  text-align: center;
}

.const-info {
  flex: 1;
}

.const-name {
  font-size: 13px;
  color: var(--text-secondary);
  display: block;
}

.const-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

.const-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #a0a0a0;
  margin-left: 8px;
}

.btn-del-const {
  background: rgba(255, 50, 50, 0.2);
  border: 1px solid rgba(255, 50, 50, 0.5);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  transition: all 0.2s ease;
  font-size: 14px;
}
.btn-del-const:hover {
  background: rgba(255, 50, 50, 0.5);
  transform: scale(1.1);
}

/* ============================================================
   NUMBER INPUT SPINNER REMOVAL
   ============================================================ */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

/* ============================================================
   GLOBAL CUSTOM SCROLLBARS (WebKit)
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   PLOT TAB
   ============================================================ */
.plot-wrapper {
  position: relative;
  margin-top: 20px;
  overflow: hidden;
  border-radius: var(--radius-md);
}

#plot-container {
  width: 100%;
  height: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: crosshair;
}

/* Axis label overlays */
.plot-axis-label-x {
  position: absolute;
  bottom: 6px;
  right: 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  pointer-events: none;
  user-select: none;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--accent-border);
}

.plot-axis-label-y {
  position: absolute;
  top: 16px;
  left: 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  pointer-events: none;
  user-select: none;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--accent-border);
}

.plot-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  text-align: center;
}

/* Clamp functionPlot coordinate tooltip inside wrapper */
.plot-wrapper .function-plot .top-right-legend,
.plot-wrapper .fps {
  position: absolute !important;
  right: 10px !important;
  top: 10px !important;
  left: auto !important;
  z-index: 100 !important;
  max-width: calc(100% - 20px) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Plot origin axes for functionPlot */
path.domain, .origin {
  stroke: var(--accent) !important;
  stroke-width: 1.5px !important;
  opacity: 0.6 !important;
}

/* ============================================================
   MACRO TAB
   ============================================================ */
.macro-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.macro-create, .macro-execute {
  background: rgba(0, 0, 0, 0.15);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow-y: auto;
}

/* (duplicate workspace block removed — merged into main .workspace rule above) */

.macro-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.btn--macro-del {
  background: rgba(255, 71, 87, 0.15);
  color: var(--danger-red);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
}

.btn--macro-del:hover {
  background: rgba(255, 71, 87, 0.3);
}

/* ============================================================
   TOOLKIT TAB
   ============================================================ */
.toolkit-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.filter-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Açık Mod Filtre Butonları */
[data-theme="light"] .filter-btn {
  background: #f1f3f5;
  border-color: #dee2e6;
  color: #495057;
}

[data-theme="light"] .filter-btn:hover {
  background: #e9ecef;
}

[data-theme="light"] .filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toolkit-card.fade-in {
  animation: fadeInCard 0.4s ease forwards;
}

.btn-bom-add {
  background: var(--success, #2ecc71);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.btn-bom-add:hover {
  background: #27ae60;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
  transform: translateY(-2px);
}

.btn-bom-add span {
  font-size: 16px;
  font-weight: 700;
}

/* Toast Bildirim */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-msg {
  background: var(--bg-elevated, #2d3436);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border-left: 4px solid var(--success, #2ecc71);
  animation: slideInRight 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-msg.fade-out {
  animation: fadeOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.toolkit-card {
  display: flex;
  flex-direction: column;
}

.toolkit-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

.toolkit-card .btn--export-pdf {
  margin-top: auto;
}

.plot-error-alert {
  display: none;
  background: rgba(242, 139, 130, 0.12);
  border: 1px solid rgba(242, 139, 130, 0.4);
  border-radius: 8px;
  padding: 10px 16px;
  margin-top: 12px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--danger-red);
  word-break: break-all;
}

.plot-error-inline {
  padding: 24px;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--danger-red);
  text-align: center;
}

/* ============================================================
   EXPORT BUTTONS
   ============================================================ */
.export-group {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.btn--export {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.btn--export-pdf {
  color: var(--danger-red);
  border: 1px solid rgba(242, 139, 130, 0.4);
}

.btn--export-pdf:hover {
  background: rgba(242, 139, 130, 0.12);
  border-color: var(--danger-red);
}

.btn--export-excel {
  color: #34c985;
  border: 1px solid rgba(52, 201, 133, 0.4);
}

.btn--export-excel:hover {
  background: rgba(52, 201, 133, 0.12);
  border-color: #34c985;
}

/* ============================================================
   RESPONSIVE — SMALL DESKTOP / TABLET (max-width: 900px)
   ============================================================ */
@media (max-width: 900px) {
  .calc-grids {
    grid-template-columns: 1fr;
  }

  .btn-grid--sci {
    grid-template-columns: repeat(5, 1fr);
  }

  .matrix-workspace {
    grid-template-columns: 1fr;
  }

  .cmplx-workspace {
    grid-template-columns: 1fr;
  }

  .macro-layout {
    grid-template-columns: 1fr;
  }

  .conv-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   RESPONSIVE — TABLET (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
  .btn-grid--sci {
    grid-template-columns: repeat(4, 1fr);
  }

  .sidebar {
    width: 85%;
    max-width: 320px;
    z-index: 9999;
  }

  .workspace--shifted {
    margin-left: 0 !important;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (max-width: 600px)
   ============================================================ */
@media (max-width: 600px) {
  .display__result {
    font-size: 26px;
  }

  .display__result .katex {
    font-size: 26px !important;
  }

  .btn {
    padding: 11px 4px;
    font-size: 13px;
  }

  .btn--sci {
    font-size: 11px;
    padding: 10px 3px;
  }

  .btn-grid--sci {
    grid-template-columns: repeat(3, 1fr);
  }

  .btn--equals {
    font-size: 17px;
  }

  .panel-title {
    font-size: 18px;
  }

  .display {
    padding: 14px 16px;
    min-height: 110px;
  }

  .panel-card {
    padding: 12px;
  }

  .action-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .eqn-controls {
    flex-direction: column;
  }

  .toolkit-grid {
    grid-template-columns: 1fr;
  }

  #plot-container {
    height: 280px;
  }

  .logic-row {
    flex-wrap: wrap;
  }

  .base-mode-btns {
    flex-wrap: wrap;
  }

  math-field {
    font-size: 18px;
  }
}

/* ============================================================
   PDF EXPORT MODE (High Contrast)
   ============================================================ */
.pdf-export-mode {
  background: #0f172a !important; /* Solid dark blue */
  color: #ffffff !important;
}

.pdf-export-mode .panel-card,
.pdf-export-mode .matrix-grid-wrapper,
.pdf-export-mode .panel-input,
.pdf-export-mode .panel-select,
.pdf-export-mode .panel-result,
.pdf-export-mode .toolkit-card,
.pdf-export-mode .macro-create,
.pdf-export-mode .macro-execute,
.pdf-export-mode .custom-const-form,
.pdf-export-mode .const-item,
.pdf-export-mode #plot-container {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

.pdf-export-mode .panel-title,
.pdf-export-mode .panel-subtitle,
.pdf-export-mode .panel-label,
.pdf-export-mode .toolkit-card__title,
.pdf-export-mode .const-item__name,
.pdf-export-mode .const-hint {
  color: #e2e8f0 !important;
}

.pdf-export-mode .panel-result {
  color: #00ffff !important; /* Bright cyan for results */
}

.pdf-export-mode .math-field,
.pdf-export-mode math-field {
  color: #ffffff !important;
}

.pdf-export-mode .conv-row.pdf-hide {
  display: none !important;
}

.pdf-export-mode .btn--base {
  opacity: 1 !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

/* ============================================================
   DISPLAY ACTIONS (Code Export)
   ============================================================ */
.display__actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 16px 0;
}

.btn--code-export {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 5px 14px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s ease;
}

.btn--code-export:hover {
  background: rgba(138, 180, 248, 0.2);
}

/* ============================================================
   BOM TABLE
   ============================================================ */
.bom-header-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 40px;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bom-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 40px;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: center;
}

.bom-row input, .bom-row select {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 5px 8px;
  color: #fff;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

[data-theme="light"] .bom-row input, [data-theme="light"] .bom-row select {
  color: var(--text-primary);
}

.bom-row input:focus, .bom-row select:focus {
  border-color: var(--neon-blue);
}

.bom-row-total {
  color: var(--neon-blue);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.bom-row-del {
  background: rgba(255,50,50,0.1);
  border: 1px solid rgba(255,50,50,0.2);
  color: #ff6b6b;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.bom-row-del:hover {
  background: rgba(255,50,50,0.25);
}

.bom-total {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: right;
}

.bom-total strong {
  color: var(--accent);
  font-size: 18px;
  margin-left: 8px;
}

/* ============================================================
   BOM PANEL SPECIFIC LAYOUT
   ============================================================ */
.bom-layout {
  display: flex;
  gap: 24px;
  height: calc(100vh - 180px);
  min-height: 500px;
}

.bom-sidebar {
  width: 280px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.bom-project-list {
  list-style: none;
  padding: 0;
  margin: 15px 0 0 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bom-project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.bom-project-item:hover {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.bom-project-item span {
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bom-project-item .folder-actions {
  opacity: 0;
  display: flex;
  gap: 5px;
  transition: opacity 0.2s;
}

.rte-tree-node:hover .folder-actions {
  opacity: 1;
}

.folder-del-btn, .folder-edit-btn {
  background: transparent;
  border: none;
  color: var(--text-dim, #606080);
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
}

.folder-del-btn:hover {
  color: #ff4a4a;
}
.folder-edit-btn:hover {
  color: var(--accent, #00f3ff);
}

.bom-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.bom-header-row--large {
  font-size: 13px;
  padding: 12px 6px;
}

.bom-row--large input {
  font-size: 14px;
  padding: 8px 12px;
}

.bom-row--large .bom-row-total {
  font-size: 15px;
}

.bom-total--large {
  font-size: 18px;
}

.bom-total--large strong {
  font-size: 24px;
}

/* ============================================================
   TRUTH TABLE (Digital Logic)
   ============================================================ */
.truth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

.truth-table th {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 8px 12px;
  text-align: center;
  border: 1px solid var(--accent-border);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.truth-table td {
  padding: 7px 12px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-secondary);
  transition: background 0.15s;
}

.truth-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

.truth-table td.tt-true {
  color: #34c985;
  font-weight: 700;
}

.truth-table td.tt-false {
  color: var(--danger-red);
}

/* ============================================================
   RESPONSIVE — MOBILE (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100vw;
  }

  .sidebar__footer {
    margin-top: auto;
    flex-shrink: 0;
    padding-bottom: 80px;
  }

  .mobile-menu-btn {
    top: 10px;
    left: 10px;
  }

  .workspace {
    padding: 10px;
    padding-top: 70px;
    overflow-x: hidden;
  }

  .calc-grids {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .btn-grid--sci {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .btn {
    padding: 13px 4px;
    font-size: 14px;
  }

  .btn--sci {
    font-size: 11px;
    padding: 11px 3px;
  }

  .display {
    padding: 12px 14px;
    min-height: 100px;
  }

  .display__result {
    font-size: 26px;
    word-break: break-all;
  }

  .display__result .katex {
    font-size: 26px !important;
  }

  .panel-card {
    padding: 12px;
  }

  .panel-title {
    font-size: 20px;
  }

  .matrix-workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cmplx-workspace {
    grid-template-columns: 1fr;
  }

  .macro-layout {
    grid-template-columns: 1fr;
  }

  .conv-grid {
    grid-template-columns: 1fr;
  }

  .toolkit-grid {
    grid-template-columns: 1fr;
  }

  /* Prevent overflow on BOM and other modules */
  .bom-layout {
    flex-direction: column;
    height: auto;
  }

  .bom-sidebar {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
  }

  .bom-header-row, .bom-header-row--large {
    display: none;
  }

  .bom-row, .bom-row--large {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .bom-row input, .bom-row--large input {
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
  }

  .bom-row-total {
    text-align: left;
    font-size: 18px;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .bom-row-del {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .conv-row {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .conv-row input, .conv-row select {
    width: 100%;
    box-sizing: border-box;
  }

  #plot-container {
    height: 300px;
  }

  .logic-row {
    flex-wrap: wrap;
  }

  .eqn-controls {
    flex-direction: column;
    gap: 8px;
  }

  .custom-const-form .action-bar {
    flex-direction: column;
    gap: 8px;
  }

  .custom-const-form .panel-input {
    width: 100%;
    flex: none;
  }

  .action-bar {
    flex-wrap: wrap;
  }
}

/* ============================================================
   RESPONSIVE — TABLET (769px - 1024px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar__footer {
    margin-top: auto;
    flex-shrink: 0;
    padding-bottom: 80px;
  }

  .calc-grids {
    grid-template-columns: 1fr 1fr;
  }

  .workspace {
    padding: 16px 20px;
    padding-top: 76px;
  }
}

/* ============================================================
   SIDEBAR THEME BUTTON
   ============================================================ */
.sidebar__theme-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: background 0.2s ease, color 0.2s ease;
  font-family: 'Inter', sans-serif;
  margin-top: 8px;
  width: 100%;
}

.sidebar__theme-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ============================================================
   LIGHT THEME OVERRIDES  (data-theme="light")
   ============================================================ */
[data-theme="light"] {
  --bg-base:       #F8F9FA;
  --bg-surface:    #FFFFFF;
  --bg-elevated:   #F0F4F9;
  --bg-dark:       #E9ECEF;
  --bg-purple:     #F8F9FA;

  --glass-bg:      rgba(0, 0, 0, 0.02);
  --glass-border:  #DEE2E6;

  --accent:        #0D6EFD;
  --accent-dim:    rgba(13, 110, 253, 0.10);
  --accent-border: rgba(13, 110, 253, 0.22);

  --neon-blue:     #0D6EFD;
  --neon-purple:   #0D6EFD;
  --danger-red:    #d93025;

  --text-primary:   #333333;
  --text-secondary: #495057;
  --text-dim:       #6C757D;

  --btn-num-bg:    #FFFFFF;
  --btn-op-bg:     #E9ECEF;
  --btn-sci-bg:    #F8F9FA;
}

[data-theme="light"] body {
  background: var(--bg-base);
}

[data-theme="light"] .sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
}

[data-theme="light"] .dashboard-nav-btn {
  color: #1a1a1a !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .dashboard-nav-btn:hover {
  background: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .sidebar__item {
  color: #495057;
}

[data-theme="light"] .sidebar__item:hover {
  color: #1a1a1a;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar__item--active:not(.dashboard-nav-btn) {
  color: var(--accent);
  background: var(--accent-dim);
}

[data-theme="light"] .accordion-btn {
  color: #1a1a1a;
}

[data-theme="light"] .display {
  background: var(--bg-elevated);
  border-color: var(--glass-border);
}

[data-theme="light"] math-field {
  color: var(--accent);
  --selection-background-color: rgba(26, 115, 232, 0.15);
  --selection-color: var(--text-primary);
}

[data-theme="light"] .panel-card {
  background: var(--bg-surface);
  border-color: var(--glass-border);
}

[data-theme="light"] .panel-result {
  background: var(--bg-elevated);
}

[data-theme="light"] .mobile-menu-btn,
[data-theme="light"] .hamburger-btn {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-color: var(--glass-border) !important;
}

[data-theme="light"] .panel-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ============================================================
   INFO BUTTON (toolkit cards)
   ============================================================ */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 6px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

.info-btn:hover {
  background: rgba(138, 180, 248, 0.25);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(138, 180, 248, 0.35);
}

/* ============================================================
   TOOLKIT MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 16px;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none !important;
  opacity: 0;
}

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  width: min(450px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--danger-red);
}

#modalTitle {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 18px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
}

#modalBody {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

#modalBody h4 {
  color: var(--accent);
  margin: 15px 0 5px;
  font-size: 13px;
  text-transform: uppercase;
}

#modalBody h4:first-child {
  margin-top: 0;
}

.info-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
  background: var(--bg-surface);
  border-radius: 8px;
  overflow: hidden;
}
.info-modal__table th {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 10px;
  text-align: left;
  border-bottom: 2px solid var(--accent-border);
}
.info-modal__table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border);
}
.info-modal__table tr:nth-child(even) td {
  background: rgba(128, 128, 128, 0.05);
}

.info-modal__formula {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  padding: 10px 15px;
  margin: 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--accent);
  white-space: pre-wrap;
}

/* ============================================================
   SYMBOLIC RESULT DISPLAY (Derivative / Integral panels)
   ============================================================ */
.sym-result-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.sym-result-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  color: var(--accent);
  padding: 10px 0 4px;
  line-height: 1.5;
  word-break: break-all;
}

/* ============================================================
   SEO FOOTER
   ============================================================ */
.seo-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 20px;
  background-color: transparent;
  line-height: 1.5;
  opacity: 0.7;
}

/* ============================================================
   DASHBOARD / WELCOME SCREEN
   ============================================================ */
#panel-dashboard.workspace__panel--active {
  padding: 40px 20px;
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 80vh;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 40px;
  width: 100%;
}

.dashboard-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.dashboard-subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
  justify-items: center;
  width: 100%;
}

.dashboard-card {
  background: var(--glass-bg, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 24px;
  text-align: center !important;
  cursor: pointer !important;
  position: relative;
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center !important;
  justify-content: flex-start;
  width: 100%;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  background: var(--bg-elevated, rgba(255, 255, 255, 0.05));
  border-color: var(--accent, #58a6ff);
}

.dashboard-card-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  color: var(--text-dim);
  transition: color 0.2s ease;
}

.dashboard-card:hover .dashboard-card-icon {
  color: var(--text-primary);
}

.dashboard-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.3;
  text-align: center !important;
}

.dashboard-card-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  text-align: center !important;
}

/* ============================================================
   RTE (RICH TEXT EDITOR) NOTES PANEL
   ============================================================ */

/* Ana layout: sidebar + main */
.rte-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 60px); /* Üst menü boyutu hariç tam ekran */
  overflow: hidden;
  position: relative;
}

/* ---- SIDEBAR ---- */
.rte-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-surface, #111128);
  border-right: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  transition: width 0.3s;
}

.rte-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary, #a0a0c0);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  text-transform: uppercase;
}

.rte-sidebar__header button {
  background: transparent;
  border: 1px solid rgba(0,243,255,0.3);
  color: var(--accent, #00f3ff);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btn-global-new-note {
    position: relative;
    z-index: 99999;
    pointer-events: auto !important;
}

.rte-sidebar__header button:hover {
  background: rgba(0,243,255,0.12);
}

/* ---- TREE VIEW KILASÖRLER ---- */
.rte-folder-tree {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
  font-size: 0.9rem;
}

.rte-folder-tree details {
  margin: 2px 0;
}

.rte-folder-tree summary {
  padding: 8px 12px 8px 16px;
  cursor: pointer;
  color: var(--text-secondary, #a0a0c0);
  list-style: none; /* Standart üçgeni kaldır */
  display: flex;
  align-items: center;
  user-select: none;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

/* Standart üçgeni gizlemek için webkit spesifik (safari/chrome) */
.rte-folder-tree summary::-webkit-details-marker {
  display: none; 
}

.rte-folder-tree summary::before {
  content: "▶";
  font-size: 0.7em;
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.2s;
  color: rgba(255,255,255,0.3);
}

.rte-folder-tree details[open] > summary::before {
  transform: rotate(90deg);
}

.rte-folder-tree .no-children > summary::before {
  content: "•"; /* Alt klasörü olmayanlar için ikon */
  font-size: 1.2em;
  line-height: 0.5;
  transform: none !important;
}

.rte-folder-tree summary:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary, #e0e0ff);
}

.rte-folder-tree summary.active {
  background: rgba(0,243,255,0.08);
  color: var(--accent, #00f3ff);
  border-left-color: var(--accent, #00f3ff);
  font-weight: 600;
}

.rte-folder-tree .folder-actions {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s;
}

.rte-folder-tree summary:hover .folder-actions {
  opacity: 1;
}

.rte-folder-tree .folder-del-btn, .rte-folder-tree .folder-edit-btn {
  background: none;
  border: none;
  color: #ff6060;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}
.rte-folder-tree .folder-edit-btn {
  color: var(--accent, #00f3ff);
}

/* İç içe klasörlerin soldan boşluğu */
.rte-folder-tree .folder-children {
  padding-left: 15px;
  margin-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.05);
}

.rte-sidebar__search {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--glass-border, rgba(255,255,255,0.06));
}

.rte-sidebar__search input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  background: rgba(255,255,255,0.04);
  color: var(--text-primary, #e0e0ff);
  font-size: 0.85rem;
  font-family: inherit;
  box-sizing: border-box;
}

.rte-sidebar__search input:focus {
  outline: none;
  border-color: var(--accent, #00f3ff);
}

/* ---- SIDEBAR COLLAPSED ---- */
.rte-sidebar.collapsed {
  width: 0;
  border-right: none;
  opacity: 0;
}

/* ---- DASHBOARD VIEW ---- */
.notes-dashboard-view {
  display: flex;
  width: 100%;
  height: 100%;
  flex: 1;
}

.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--bg-body, #0a0a14);
  overflow-y: auto;
  z-index: 5;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  padding-bottom: 10px;
  position: relative;
  z-index: 10;
}

.dashboard-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
}

/* ---- FULL SCREEN EDITOR VIEW ---- */
.notes-editor-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--bg-surface, #111128);
}

.editor-back-btn {
  position: fixed;
  top: 15px;
  left: 60px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 99999;
  backdrop-filter: blur(4px);
  font-weight: bold;
  transition: background 0.2s;
}
.editor-back-btn:hover { background: rgba(0,0,0,0.8); }

/* ---- FLOATING TOOLBAR ---- */
.floating-toolbar {
  position: absolute; /* position: fixed de yapılabilir, absolute kapsayıcıya göre hareket eder */
  top: 60px;
  left: 20px;
  z-index: 9999;
  background: rgba(20, 20, 40, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.15));
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  padding: 10px 15px;
  width: auto;
  max-width: 90vw;
  transition: opacity 0.2s, transform 0.2s;
}

.toolbar-drag-handle {
  width: 100%;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-right: 10px;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.toolbar-drag-handle:active { cursor: grabbing; }

.toolbar-modes {
  display: flex;
  gap: 5px;
  padding-right: 10px;
  border-right: 1px solid rgba(255,255,255,0.1);
}

.toolbar-mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
  transition: all 0.2s;
}

.toolbar-mode-btn.active {
  background: var(--accent, #00f3ff);
  color: #000;
  box-shadow: 0 2px 8px rgba(0,243,255,0.3);
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Dropdown for settings */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #1a1b1e;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.6);
  z-index: 10000;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  flex-direction: column;
  gap: 8px;
}
.dropdown:hover .dropdown-content {
  display: flex;
}

.rte-toolbar__group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.rte-toolbar__sep {
  width: 1px;
  height: 22px;
  background: var(--glass-border, rgba(255,255,255,0.12));
  margin: 0 4px;
}

.rte-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary, #a0a0c0);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.2;
}

.rte-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary, #e0e0ff);
  border-color: var(--glass-border, rgba(255,255,255,0.12));
}

.rte-btn.active {
  background: rgba(0,243,255,0.12);
  color: var(--accent, #00f3ff);
  border-color: rgba(0,243,255,0.3);
}

.rte-btn--accent {
  color: var(--accent, #00f3ff);
  border-color: rgba(0,243,255,0.2);
}

.rte-btn--accent:hover {
    background: #45a049;
}

/* --- LIGHT MODE YENİ YAPI --- */
body.light-mode .note-add-box,
body.light-mode .classic-note-card {
    background: #ffffff !important;
    border-color: #d1d5db !important;
}
body.light-mode .add-title-input,
body.light-mode .add-content-input,
body.light-mode .classic-note-title {
    color: #000000 !important;
}
body.light-mode .classic-note-content {
    color: #333333 !important;
}
body.light-mode .add-cat-select {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #d1d5db !important;
}
body.light-mode .rte-toolbar {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
}
body.light-mode .rte-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #d1d5db !important;
}
body.light-mode .rte-btn:hover {
    background: #e5e7eb !important;
}
body.light-mode .rte-btn.active {
    background: #d1d5db !important;
}

.rte-select {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
  color: var(--text-primary, #e0e0ff);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.rte-select:focus { outline: none; border-color: var(--accent, #00f3ff); }

.rte-number-input {
  width: 48px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
  color: var(--text-primary, #e0e0ff);
  border-radius: 7px;
  padding: 4px 6px;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}

.rte-number-input:focus { outline: none; border-color: var(--accent, #00f3ff); }

.rte-color-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
  border-radius: 7px;
  color: var(--text-secondary, #a0a0c0);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s;
}

.rte-color-label:hover { background: rgba(255,255,255,0.07); }

.rte-color-label input[type="color"] {
  width: 20px;
  height: 18px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
}

/* ---- EDITOR AREA LAYERS ---- */
.editor-layer-container {
  position: relative;
  min-height: 400px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent;
  transition: all 0.3s ease;
  transform-origin: top left; /* Zoom için köşe belirlemesi */
}

/* Sayfa Şablonları (Zemin Desenleri) */
.editor-layer-container.bg-lined {
  background-image: repeating-linear-gradient(transparent, transparent 31px, rgba(150,150,150,0.2) 31px, rgba(150,150,150,0.2) 32px);
}
.editor-layer-container.bg-grid {
  background-size: 20px 20px;
  background-image: repeating-linear-gradient(rgba(150,150,150,0.2) 0 1px, transparent 1px 100%), repeating-linear-gradient(90deg, rgba(150,150,150,0.2) 0 1px, transparent 1px 100%);
}
.editor-layer-container.bg-dotted {
  background-image: radial-gradient(rgba(150,150,150,0.4) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* A4 Modu Stilleri */
.a4-mode .editor-layer-container {
  max-width: 794px; /* A4 genişliği piksel karşılığı 96dpi */
  margin: 0 auto;
  background-color: var(--bg-surface, #15152a) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 0 20px;
}

.rte-editor {
  min-height: 100%;
  padding: 20px 24px;
  color: var(--text-primary, #e0e0ff);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.7;
  outline: none;
  word-break: break-word;
  position: relative;
  z-index: 1; /* Metin editörü altta */
}

.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: rgba(255,255,255,0.18);
  pointer-events: none;
  position: absolute;
}

/* Çizim Katmanı (Overlay) */
.rte-draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10; /* Canvas metnin üstünde (10) */
  pointer-events: none !important; /* Varsayılan olarak tıklamaları alt katmana geçir */
  touch-action: none;
}

.draw-mode-active .rte-draw-canvas {
  pointer-events: auto !important;
}

/* Çizim Modu Açıkken */
.draw-mode-active .rte-editor {
  user-select: none; /* Çizerken metni seçmeyi engelle */
}

.draw-mode-active .rte-draw-canvas {
  pointer-events: auto; /* Çizimi yakala */
  cursor: crosshair;
}

.draw-mode-active.eraser-mode .rte-draw-canvas {
  cursor: cell; /* Silgi imleci */
}

/* Images & PDFs inserted into editor */
.rte-editor img, .rte-editor object, .rte-editor iframe {
  max-width: 100%;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  resize: both;
  overflow: hidden;
  display: inline-block;
  vertical-align: bottom;
}

.rte-editor img:hover, .rte-editor object:hover {
  border-color: rgba(0,243,255,0.4);
}

.rte-editor img.selected, .rte-editor object.selected {
  border-color: var(--accent, #00f3ff);
  outline: 2px solid rgba(0,243,255,0.25);
}

/* ---- FORM FOOTER ---- */
.rte-form-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--glass-border, rgba(255,255,255,0.07));
  flex-wrap: wrap;
  background: rgba(0,0,0,0.1);
}

.rte-save-btn {
  background: rgba(0,243,255,0.15);
  border: 1px solid rgba(0,243,255,0.4);
  color: var(--accent, #00f3ff);
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.rte-save-btn:hover {
  background: rgba(0,243,255,0.25);
  box-shadow: 0 0 12px rgba(0,243,255,0.2);
}

/* ---- NOTES GRID ---- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.note-card {
  background: var(--bg-surface, #111128);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  height: 220px;
}

.note-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: rgba(0,243,255,0.3);
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
}

.note-card-title {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #e0e0ff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 24px; /* sil butonu için */
}

/* Kart içindeki içerik önizlemesi */
.note-card-preview {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-secondary, #a0a0c0);
  line-height: 1.5;
  overflow: hidden;
  position: relative;
  /* Alt kısma doğru fading efekti */
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

/* Karttaki önizlemede resim ve çizimlerin kırpılması */
.note-card-preview img, .note-card-preview canvas, .note-card-preview object {
  max-width: 100%;
  height: auto;
  max-height: 80px;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.8;
}

.note-card-footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.note-tag {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
}

.note-date { color: var(--text-dim, #606090); }

.btn-delete-note {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.15);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  font-size: 1rem;
  padding: 2px 5px;
  border-radius: 4px;
}

.note-card:hover .btn-delete-note { opacity: 1; }
.btn-delete-note:hover { color: #ff5252; background: rgba(255,82,82,0.1); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .rte-layout {
    flex-direction: column;
    height: auto;
  }
  .rte-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
  .rte-folder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
  }
  .rte-folder-item {
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    border-left: 1px solid var(--glass-border);
    padding: 6px 12px;
    font-size: 0.82rem;
  }
  .rte-folder-item.active {
    border-color: var(--accent);
  }
  .notes-grid {
    grid-template-columns: 1fr;
  }
}

/* Eski pinout ve notes-container stilleri artık kullanılmıyor */
.pinout-viewer, .pinout-tabs, .pinout-content,
.notes-container, .notes-manager, .notes-controls { display: none; }

/* ================= YENİ CLASSIC NOT ARAYÜZÜ ================= */
#panel-notes .notes-classic-layout {
    display: block;
    padding: 20px 40px;
    background: #111;
    min-height: 100vh;
    box-sizing: border-box;
}
#panel-notes .notes-main-column {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
/* pinout-sidebar gizle */
#panel-notes .pinout-sidebar {
    display: none;
}
.notes-main-title {
    font-size: 26px;
    font-weight: bold;
    color: #fff;
    margin-top: 10px;
    margin-bottom: 30px;
}
.notes-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}
.notes-search-input {
    background: #1e1e1e;
    border: 1px solid #333;
    padding: 10px 15px;
    border-radius: 8px;
    color: #fff;
    width: 280px;
    outline: none;
    font-size: 14px;
}
.notes-search-input:focus { border-color: #555; }
.notes-category-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.cat-pill {
    background: #2a2a2a;
    border: none;
    color: #aaa;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cat-pill.active {
    background: #8ab4f8;
    color: #000;
    font-weight: 700;
}
.cat-pill:hover:not(.active) {
    background: #3a3a3a;
    color: #fff;
}
.cat-pill .del-cat {
    display: none;
    color: #aaa;
    margin-right: -4px;
}
.cat-pill:hover .del-cat {
    display: inline-block;
}
.cat-pill .del-cat:hover { color: #ff4444; }

.add-pill-btn {
    background: transparent;
    border: 1px dashed #555;
    color: #888;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}
.add-pill-btn:hover {
    border-color: #8ab4f8;
    color: #8ab4f8;
}

/* Inline Category Add */
.inline-category-add {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #1e1e1e;
    border: 1px solid #444;
    padding: 4px 10px;
    border-radius: 20px;
}
#inline-cat-input {
    background: transparent;
    border: none;
    color: #fff;
    width: 120px;
    outline: none;
    font-size: 13px;
}
#inline-cat-save, #inline-cat-cancel {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}
#inline-cat-save:hover { color: #4caf50; }
#inline-cat-cancel:hover { color: #f44336; }

/* Note Add Box - izole */
#panel-notes .note-add-box {
    background: #1e1e1e;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 40px;
    border: 1px solid #333;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}
.add-title-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
    outline: none;
}
.add-content-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #bbb;
    font-size: 15px;
    min-height: 350px;
    resize: vertical;
    outline: none;
    margin-bottom: 20px;
    font-family: inherit;
    overflow-y: auto;
}
.note-add-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
    padding-top: 15px;
}
.add-cat-select {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    display: block;
    width: 150px;
    height: 40px;
    padding: 5px;
    background: #2a2a2a;
    border: 1px solid #444;
    color: white;
    pointer-events: auto !important;
    z-index: 9999;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    cursor: pointer;
}
.add-submit-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.add-submit-btn:hover { background: #eee; }

/* Notes Grid Classic - izole (#panel-notes) */
#panel-notes .notes-grid-classic {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}
#panel-notes .classic-note-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    height: 220px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease;
    box-sizing: border-box;
}
#panel-notes .classic-note-card:hover {
    border-color: #555;
    transform: translateY(-2px);
}
#panel-notes .classic-note-title {
    color: #fff;
    font-weight: bold;
    margin: 0 0 10px 0;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#panel-notes .classic-note-content {
    color: #aaa;
    font-size: 14px;
    flex: 1;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    margin-bottom: 12px;
}
#panel-notes .classic-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #2a2a2a;
}
#panel-notes .classic-note-date {
    color: #777;
    font-size: 12px;
}
#panel-notes .classic-note-pill {
    background: rgba(138, 180, 248, 0.1);
    color: #8ab4f8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

/* Pinout Card */
.pinout-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 24px;
}
.pinout-title {
    color: #fff;
    margin: 0 0 25px 0;
    font-size: 20px;
}
.pinout-pills {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}
.pinout-pill {
    background: #2a2a2a;
    border: none;
    color: #aaa;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.pinout-pill.active {
    background: #8ab4f8;
    color: #000;
    font-weight: 700;
}
.pinout-img-container { margin-bottom: 20px; }
.pinout-desc {
    color: #aaa;
    font-size: 14px;
    margin: 0;
}


body.light-mode .proje-notlari-container,
body.light-mode .form-container,
body.light-mode .note-card,
body.light-mode textarea,
body.light-mode .toolbar {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #dddddd !important;
}
body.light-mode .proje-notlari-container h1, 
body.light-mode .proje-notlari-container h2, 
body.light-mode .proje-notlari-container h3, 
body.light-mode .proje-notlari-container p {
    color: #000000 !important;
}




/* ============================================================
   PROMO BANNER — @teducationTR
   ============================================================ */
.promo-banner {
  text-align: center;
  margin: 10px 0 35px 0;
  font-size: 13px;
  color: #a1a1aa;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
}
.promo-banner a {
  color: #a855f7;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}
.promo-banner a:hover { opacity: 0.8; }
.promo-banner a::after { content: " \1F680"; }

/* ============================================================
   GLOBAL MOBILE OVERFLOW FIX
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
img, video, iframe, svg {
  max-width: 100%;
  height: auto;
}
input, select, textarea, button {
  max-width: 100%;
  box-sizing: border-box;
}

/* ============================================================
   WORKSPACE & PANELS — Responsive
   ============================================================ */
.workspace {
  min-width: 0;
  overflow-x: hidden;
}
.workspace__panel {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

/* ============================================================
   TOOLKIT GRID — Mobile-first
   ============================================================ */
.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 16px;
  box-sizing: border-box;
}
.toolkit-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
}
.panel-card {
  box-sizing: border-box;
  max-width: 100%;
  overflow: visible;
  word-break: break-word;
  position: relative;
  z-index: 20;
}
.panel-input, .panel-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ============================================================
   CIRAK / STUDENT MODULE — Mobile
   ============================================================ */
.cirak-module {
  box-sizing: border-box;
  width: 100%;
  max-width: 600px;
  overflow: visible;
}
.cirak-module .panel-card {
  box-sizing: border-box;
  overflow: visible;
  word-break: break-word;
}

/* ============================================================
   RESPONSIVE — PHONE (max-width: 600px)
   ============================================================ */
@media (max-width: 600px) {
  /* Toolkit grid: tek sütun */
  .toolkit-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Dashboard grid: tek sütun */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Panel başlıkları */
  .panel-title {
    font-size: 1.1rem;
  }

  /* Panel card padding küçült */
  .panel-card {
    padding: 16px !important;
  }

  /* Buton grupları */
  .btn-group,
  .action-buttons,
  div[style*="display:flex"][style*="gap"] {
    flex-wrap: wrap;
  }

  /* Hesap makinesi büyük display */
  .display {
    font-size: 0.9rem;
  }

  /* Notlar: tek sütun */
  #panel-notes .notes-grid-classic {
    grid-template-columns: 1fr;
  }

  /* Slayt/Özet modal içeriği */
  #slayt-modal > div,
  #summary-modal > div {
    width: 98% !important;
    max-height: 95vh;
    padding: 0;
  }

  /* cirak-module butonları sarılsın */
  .cirak-module div[style*="display:flex"] {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Ai PDF asistanı button row */
  #pdf-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  #pdf-actions button {
    flex: 1 1 auto;
    min-width: 120px;
    font-size: 12px;
    padding: 10px 6px;
  }

  /* Soru/Kart sayısı seçiciler yan yana çalışmayabilir */
  div[style*="display:flex"][style*="gap:16px"] {
    flex-direction: column;
  }

  /* Test quiz butonları */
  .quiz-btn {
    font-size: 13px !important;
    padding: 10px 12px !important;
  }

  /* Rate limit toast */
  #ai-rate-toast {
    min-width: 90vw !important;
    max-width: 95vw !important;
    bottom: 16px !important;
    padding: 16px 18px !important;
    font-size: 13px !important;
  }

  /* Promo banner */
  .promo-banner {
    font-size: 12px;
    padding: 6px 8px;
  }

  /* Sidebar adjustments */
  .sidebar {
    width: 88%;
    max-width: 300px;
  }

  /* BOM / Malzeme tablosu */
  .bom-table-wrap {
    overflow-x: auto;
  }

  /* Sabitler/Birimler dönüştürücü */
  .conv-grid,
  .constants-grid {
    grid-template-columns: 1fr;
  }

  /* Genel flex sarma */
  .flex-row-mobile {
    flex-direction: column;
  }
}

/* ============================================================
   RESPONSIVE — SMALL TABLET (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {
  .workspace {
    padding: 10px 8px;
  }

  /* Toolbar butonları küçük ekrana sığsın */
  .topbar-btn {
    font-size: 11px;
    padding: 5px 8px;
  }

  /* Filtreleme butonları sarılsın */
  .toolkit-filters {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Math input */
  math-field {
    font-size: 1rem;
  }

  /* Panel result alanı */
  .panel-result {
    font-size: 13px;
  }

  /* Grafik canvas */
  canvas {
    max-width: 100%;
  }
}
