/**
 * Utility Seva — Scientific Calculator Styles
 * File: css/scientific-calculator.css
 */

/* ==========================================================================
   1. BREADCRUMB & LAYOUT ARCHITECTURE
   ========================================================================== */
.breadcrumb-nav-compact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.breadcrumb-nav-compact a {
  color: var(--text-secondary, #64748b);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.breadcrumb-nav-compact a:hover {
  color: var(--primary-color, #2563eb);
}

.breadcrumb-nav-compact .breadcrumb-sep {
  color: var(--text-tertiary, #94a3b8);
  font-size: 0.8rem;
  user-select: none;
  opacity: 0.7;
}

.breadcrumb-nav-compact .breadcrumb-current {
  color: var(--text-primary, #0f172a);
  font-weight: 600;
}

[data-theme="dark"] .breadcrumb-nav-compact .breadcrumb-current {
  color: #f8fafc;
}

.sci-page-wrapper {
  padding: 1rem 0 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.sci-header-section {
  text-align: center;
  margin-bottom: 1.25rem;
}

.sci-page-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.sci-page-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto;
}

/* Two-column layout container (Calculator + Multi-Drawer Sidebar) */
.sci-stage-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

/* ==========================================================================
   2. MAIN SCIENTIFIC CALCULATOR CARD
   ========================================================================== */
.sci-calc-card {
  width: 100%;
  max-width: 620px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  transition: max-width 0.25s ease, background 0.2s ease;
  position: relative;
  user-select: none;
}

.sci-calc-card.mode-basic {
  max-width: 420px;
}

[data-theme="dark"] .sci-calc-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* --- Display Section --- */
.sci-display-wrapper {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 0.85rem 1rem 0.75rem;
  margin-bottom: 0.85rem;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Display Top Bar */
.sci-display-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.sci-display-indicators {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sci-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sci-badge-angle {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.sci-badge-angle:hover {
  background: rgba(37, 99, 235, 0.4);
}

.sci-badge-memory {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: none;
}

.sci-badge-memory.active {
  display: inline-block;
  animation: pulseMem 2s infinite ease-in-out;
}

@keyframes pulseMem {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; filter: drop-shadow(0 0 4px #10b981); }
}

.sci-display-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sci-tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.sci-tool-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.sci-tool-btn.active {
  background: #2563eb;
  color: #ffffff;
}

.sci-history-count-pill {
  background: #3b82f6;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
}

/* Expression line */
.sci-expression-line {
  min-height: 1.4rem;
  font-size: 0.95rem;
  color: #94a3b8;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 0.02em;
}

/* Main Display line */
.sci-main-line-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
}

.sci-preview-line {
  font-size: 0.85rem;
  color: #64748b;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.sci-main-number {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  letter-spacing: -0.02em;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #ffffff;
  word-break: break-all;
  transition: font-size 0.15s ease;
  flex: 1;
}

/* ==========================================================================
   3. MEMORY & MODE TOOLBAR
   ========================================================================== */
.sci-control-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.sci-toolbar-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sci-mem-btn {
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--text-secondary, #64748b);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .sci-mem-btn {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

.sci-mem-btn:hover:not(:disabled) {
  background: var(--primary-light, #eff6ff);
  color: var(--primary-color, #2563eb);
  border-color: var(--primary-color, #2563eb);
}

[data-theme="dark"] .sci-mem-btn:hover:not(:disabled) {
  background: #1e3a8a;
  color: #60a5fa;
  border-color: #3b82f6;
}

.sci-mem-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sci-toggle-pill-btn {
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  color: var(--text-secondary, #475569);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .sci-toggle-pill-btn {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

.sci-toggle-pill-btn.active-shift {
  background: #f59e0b;
  color: #ffffff;
  border-color: #d97706;
}

.sci-toggle-pill-btn.active-mode {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.sci-toggle-pill-btn.active-rad {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #7c3aed;
}

/* ==========================================================================
   4. KEYPAD GRID & BUTTONS
   ========================================================================== */
.sci-keypad-wrapper {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
}

.sci-calc-card.mode-basic .sci-keypad-wrapper {
  grid-template-columns: repeat(4, 1fr);
}

.sci-btn {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--card-bg, #ffffff);
  color: var(--text-primary, #1e293b);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sci-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sci-btn:hover {
  background: var(--bg-secondary, #f8fafc);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .sci-btn:hover {
  background: #334155;
}

.sci-btn:active,
.sci-btn.btn-pressed {
  transform: scale(0.95);
  box-shadow: none;
}

/* Scientific Function Keys (sin, cos, tan, log, roots, etc.) */
.sci-btn-fn {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
  font-size: 0.92rem;
  font-weight: 600;
}

[data-theme="dark"] .sci-btn-fn {
  background: #252e3e;
  border-color: #3e4c63;
  color: #cbd5e1;
}

.sci-btn-fn:hover {
  background: #f1f5f9;
  color: #2563eb;
}

[data-theme="dark"] .sci-btn-fn:hover {
  background: #334155;
  color: #60a5fa;
}

/* Math Constants (π, e) */
.sci-btn-const {
  background: #fdf4ff;
  border-color: #f5d0fe;
  color: #9333ea;
  font-style: italic;
  font-size: 1.05rem;
}

[data-theme="dark"] .sci-btn-const {
  background: #3b194f;
  border-color: #701a75;
  color: #e879f9;
}

/* Operator Keys (+, −, ×, ÷, ^) */
.sci-btn-op {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
  font-size: 1.25rem;
}

[data-theme="dark"] .sci-btn-op {
  background: #064e3b;
  border-color: #047857;
  color: #6ee7b7;
}

.sci-btn-op:hover {
  background: #dcfce7;
}

[data-theme="dark"] .sci-btn-op:hover {
  background: #047857;
  color: #ffffff;
}

/* Clear Keys (AC, CE) */
.sci-btn-clear {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
  font-weight: 700;
  font-size: 0.95rem;
}

[data-theme="dark"] .sci-btn-clear {
  background: #451a1a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.sci-btn-clear:hover {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme="dark"] .sci-btn-clear:hover {
  background: #7f1d1d;
  color: #ffffff;
}

/* Equals Button (=) */
.sci-btn-equals {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid #1d4ed8;
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sci-btn-equals:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
}

/* ==========================================================================
   5. MULTI-DRAWER SIDEBAR (HISTORY, CONSTANTS, GRAPHER)
   ========================================================================== */
.sci-sidebar-drawer {
  width: 100%;
  max-width: 360px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  height: 520px;
}

[data-theme="dark"] .sci-sidebar-drawer {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.4);
}

.sci-sidebar-drawer.open {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

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

.sci-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  margin-bottom: 0.75rem;
}

[data-theme="dark"] .sci-drawer-header {
  border-color: #334155;
}

.sci-drawer-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sci-drawer-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.sci-drawer-close-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* History List & Items */
.sci-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.sci-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .history-item {
  background: #0f172a;
  border-color: #334155;
}

.history-item:hover {
  border-color: var(--primary-color, #2563eb);
  background: var(--card-bg, #ffffff);
  transform: translateX(2px);
}

[data-theme="dark"] .history-item:hover {
  background: #1e293b;
  border-color: #3b82f6;
}

.history-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item-expr {
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
  font-family: 'JetBrains Mono', monospace;
}

.history-item-result {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-item-time {
  font-size: 0.7rem;
  color: var(--text-tertiary, #94a3b8);
  margin-right: 2px;
}

.history-item-action-btn,
.history-item-copy,
.history-item-delete {
  background: none;
  border: none;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.history-item-copy:hover {
  color: var(--primary-color, #2563eb);
  background: rgba(37, 99, 235, 0.1);
}

.history-item-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* Constants List */
.constants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.constants-table tr {
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .constants-table tr {
  border-color: #334155;
}

.constants-table td {
  padding: 8px 4px;
  color: var(--text-secondary);
}

.constant-name {
  font-weight: 600;
  color: var(--text-primary);
}

.constant-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #9333ea;
}

[data-theme="dark"] .constant-symbol {
  color: #e879f9;
}

.constant-insert-btn {
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  color: var(--primary-color, #2563eb);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.constant-insert-btn:hover {
  background: var(--primary-color, #2563eb);
  color: #ffffff;
}

/* Grapher Canvas */
.graph-canvas-container {
  background: #0f172a;
  border-radius: 10px;
  border: 1px solid #334155;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.graph-controls-row {
  display: flex;
  gap: 8px;
}

.graph-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.graph-plot-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* Toast */
.sci-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
}

.sci-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   6. EDUCATIONAL GUIDES SECTION
   ========================================================================== */
.sci-guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.sci-guide-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  padding: 1.25rem;
}

[data-theme="dark"] .sci-guide-card {
  background: #1e293b;
  border-color: #334155;
}

.sci-guide-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sci-guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sci-guide-list li {
  line-height: 1.5;
}

.sci-guide-code {
  background: var(--bg-secondary, #f1f5f9);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--primary-color, #2563eb);
}

[data-theme="dark"] .sci-guide-code {
  background: #0f172a;
  color: #60a5fa;
}

/* ==========================================================================
   7. RESPONSIVENESS (1366x768 & Mobile)
   ========================================================================== */
@media (max-width: 900px) {
  .sci-stage-container {
    flex-direction: column;
    align-items: center;
  }

  .sci-sidebar-drawer {
    max-width: 620px;
    height: 380px;
  }
}

@media (max-width: 640px) {
  .sci-keypad-wrapper {
    grid-template-columns: repeat(4, 1fr);
  }

  .sci-calc-card {
    padding: 1rem;
    border-radius: 16px;
  }

  .sci-btn {
    height: 40px;
    font-size: 0.95rem;
  }

  .sci-main-number {
    font-size: 1.95rem;
  }
}

