/**
 * Tool Wink Calculator Stylesheet
 * This file contains all the styling necessary for the calculator application
 * Compatible with WordPress and the WP Coder plugin
 */

/* ---- Base Styles ---- */
:root {
  /* Core colors */
  --primary-color: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1e40af;
  --secondary-color: #6366f1;
  --accent-color: #8b5cf6;
  
  /* Mode-specific colors */
  --math-color: #2563eb;
  --math-bg: #dbeafe;
  --chem-color: #10b981;
  --chem-bg: #d1fae5;
  --physics-color: #8b5cf6;
  --physics-bg: #f3e8ff;
  --programming-color: #f59e0b;
  --programming-bg: #fef3c7;
  --conversion-color: #f97316;
  --conversion-bg: #ffedd5;
  
  /* Button colors */
  --button-number: #f8fafc;
  --button-number-hover: #e2e8f0;
  --button-operation: #dbeafe;
  --button-operation-hover: #bfdbfe;
  --button-function: #ede9fe;
  --button-function-hover: #ddd6fe;
  --button-special: #e0f2fe;
  --button-special-hover: #bae6fd;
  --button-mode: #f1f5f9;
  --button-mode-hover: #e2e8f0;
  
  /* Font sizes */
  --font-xs: 0.75rem;
  --font-sm: 0.875rem;
  --font-md: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 1.875rem;
  --font-4xl: 2.25rem;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-rounded: 9999px;
}

/* ---- Reset & Typography ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: #1a202c;
  background-color: #f8fafc;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 700;
  line-height: 1.2;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ---- Layout Utilities ---- */
.calculator-container {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(to bottom, #eff6ff, #ffffff);
  padding: 2rem 1rem;
  overflow-x: hidden;
  box-sizing: border-box;
}

.calculator-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-sizing: border-box;
}

.calculator-main {
  max-width: 450px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.calculator-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.calculator-title {
  font-size: var(--font-4xl);
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.calculator-subtitle {
  color: #4b5563;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.mode-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mode-badge {
  padding: 0.25rem 0.5rem;
  font-size: var(--font-xs);
  border-radius: var(--radius-rounded);
  font-weight: 500;
}

.mathematics-badge {
  background-color: var(--math-bg);
  color: var(--math-color);
}

.chemistry-badge {
  background-color: var(--chem-bg);
  color: var(--chem-color);
}

.physics-badge {
  background-color: var(--physics-bg);
  color: var(--physics-color);
}

.programming-badge {
  background-color: var(--programming-bg);
  color: var(--programming-color);
}

.conversion-badge {
  background-color: var(--conversion-bg);
  color: var(--conversion-color);
}

/* ---- Text & Typography Styles ---- */
.text-4xl {
  font-size: var(--font-4xl);
}

.font-bold {
  font-weight: 700;
}

.text-gradient-blue-purple {
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}

.text-gray-600 {
  color: #4b5563;
}

.text-xs {
  font-size: var(--font-xs);
}

.text-blue-700 {
  color: #1d4ed8;
}

.text-green-700 {
  color: #047857;
}

.text-purple-700 {
  color: #7e22ce;
}

.text-yellow-700 {
  color: #b45309;
}

.text-orange-700 {
  color: #c2410c;
}

.bg-blue-100 {
  background-color: #dbeafe;
}

.bg-green-100 {
  background-color: #d1fae5;
}

.bg-purple-100 {
  background-color: #f3e8ff;
}

.bg-yellow-100 {
  background-color: #fef3c7;
}

.bg-orange-100 {
  background-color: #ffedd5;
}

.rounded-full {
  border-radius: var(--radius-rounded);
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

/* ---- Calculator Card ---- */
.calculator-card {
  padding: 1.5rem;
  background: linear-gradient(135deg, #1a365d, #2d4e81);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-xl);
  border: 2px solid #93c5fd;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}

/* ---- Calculator Branding ---- */
.calculator-branding {
  position: absolute;
  top: -1.5rem;
  left: 1rem;
  color: white;
}

.calculator-brand {
  font-size: var(--font-lg);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.calculator-label {
  font-size: var(--font-sm);
  font-weight: 600;
}

/* ---- TI84 Display ---- */
.ti84-display-container {
  position: relative;
  width: 100%;
}

.ti84-display {
  width: 100%;
  background: linear-gradient(to bottom, #e0eaf5, #d0dcec);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 4px solid #1e40af;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-xs);
  color: #64748b;
  margin-bottom: 0.5rem;
  background-color: #eef3f9;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
}

.mode-indicators {
  display: flex;
  gap: 0.5rem;
}

.second-mode-indicator,
.alpha-mode-indicator,
.current-mode-indicator {
  font-weight: 700;
  padding: 0 0.25rem;
  border-radius: var(--radius-sm);
  display: none;
}

.second-mode-indicator {
  background-color: #dbeafe;
  color: #1e40af;
}

.alpha-mode-indicator {
  background-color: #d1fae5;
  color: #065f46;
}

.current-mode-indicator {
  background-color: #f3e8ff;
  color: #7e22ce;
  display: block;
}

.angle-mode {
  background-color: #dbeafe;
  padding: 0 0.25rem;
  border-radius: var(--radius-sm);
  color: #1e40af;
}

.expression-display {
  font-family: monospace;
  font-size: var(--font-xl);
  margin-bottom: 0.5rem;
  min-height: 1.5em;
  color: #1e293b;
  overflow-x: auto;
  white-space: nowrap;
  background-color: #f8fafd;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.result-display {
  font-family: monospace;
  font-size: var(--font-2xl);
  text-align: right;
  color: #1e293b;
  min-height: 1.5em;
  overflow-x: auto;
  white-space: nowrap;
  background-color: #f0f5fa;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ---- AI Explanation Area ---- */
.ai-explanation-container {
  margin-top: 1rem;
  display: none;
}

.ai-explanation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.ai-title {
  font-size: var(--font-xs);
  font-weight: 700;
  color: #1e40af;
  background-color: #dbeafe;
  padding: 0.25rem 0.5rem;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
}

.ai-title span {
  margin-right: 0.25rem;
}

.ai-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-loading-indicator {
  display: none;
}

.loading-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background-color: #1e40af;
  border-radius: 50%;
  margin-right: 0.2rem;
  animation: pulse 1.5s infinite ease-in-out;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.clear-ai-button {
  font-size: var(--font-xs);
  background-color: #fee2e2;
  color: #dc2626;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  transition: background-color 0.2s;
  display: none;
}

.clear-ai-button:hover {
  background-color: #fecaca;
}

.ai-content-area {
  height: 12rem;
  background: linear-gradient(to bottom, #ffffff, #dbeafe);
  border: 2px solid #93c5fd;
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  padding: 0.75rem;
  overflow-y: auto;
}

.ai-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  animation: fadeIn 0.5s ease-in;
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ai-loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #dbeafe;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ai-loading-message {
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 0.25rem;
}

.ai-loading-submessage {
  color: #3b82f6;
  font-size: var(--font-sm);
}

.ai-explanation-text {
  font-size: var(--font-sm);
  color: #334155;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ---- Graph Area ---- */
.graph-container {
  margin-top: 1rem;
  display: none;
}

.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.graph-title {
  font-size: var(--font-xs);
  font-weight: 700;
  color: #334155;
  background-color: #dbeafe;
  padding: 0.25rem 0.5rem;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
}

.graph-title span {
  margin-right: 0.25rem;
}

.graph-area {
  height: 12rem;
  background-color: #f1f5f9;
  border: 2px solid #93c5fd;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

#graphCanvas {
  width: 100%;
  height: 100%;
  display: none;
}

.graph-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: #f8fafc;
  text-align: center;
  padding: 1rem;
}

.graph-prompt {
  color: #1e40af;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.graph-instruction {
  color: #64748b;
  margin-bottom: 0.25rem;
}

.graph-example {
  color: #94a3b8;
  font-size: var(--font-xs);
}

/* ---- TI84 Keypad ---- */
.ti84-keypad {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ai-assistant-button {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: var(--font-md);
  font-weight: 600;
  color: white;
  background: linear-gradient(120deg, #1e40af, #3b82f6);
  border: none;
  border-radius: var(--radius-lg);
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ai-assistant-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.ai-assistant-button:active {
  transform: translateY(1px);
}

.ai-button-icon {
  font-size: var(--font-xl);
}

.ai-loading-spinner-button {
  display: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

.keypad-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.calc-button {
  height: 3rem;
  font-size: var(--font-sm);
  font-weight: 600;
  transition: all 0.2s;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.25rem;
}

.calc-button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.function-button {
  background-color: var(--button-function);
  color: #4c1d95;
}

.function-button:hover {
  background-color: var(--button-function-hover);
}

.number-button {
  background-color: var(--button-number);
  color: #1e293b;
  font-weight: 700;
}

.number-button:hover {
  background-color: var(--button-number-hover);
}

.operation-button {
  background-color: var(--button-operation);
  color: #1e40af;
  font-weight: 700;
}

.operation-button:hover {
  background-color: var(--button-operation-hover);
}

.special-button {
  background-color: var(--button-special);
  color: #0369a1;
}

.special-button:hover {
  background-color: var(--button-special-hover);
}

.mode-button {
  background-color: var(--button-mode);
  color: #475569;
}

.mode-button:hover {
  background-color: var(--button-mode-hover);
}

.mode-button.active-second {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fbbf24;
}

.mode-button.active-alpha {
  background-color: #d1fae5;
  color: #047857;
  border: 1px solid #10b981;
}

/* ---- Keypad Sections ---- */
.keypad-section {
  display: none;
}

.keypad-section.active {
  display: block;
}

.math-keypad {
  display: block; /* Default active keypad */
}

/* ---- Arrow Keys ---- */
.arrow-keys {
  margin-top: 1rem;
}

.arrow-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.arrow-spacer {
  width: 100%;
}

.center-button {
  background-color: #334155;
  color: white;
}

.center-button:hover {
  background-color: #1e293b;
}

/* ---- Additional Buttons ---- */
.additional-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.clear-ai-btn {
  background-color: #fee2e2;
  color: #dc2626;
  display: none;
}

.clear-ai-btn:hover {
  background-color: #fecaca;
}

/* ---- Features Section ---- */
.features-section {
  color: #1e293b;
  position: relative;
  background-color: #f0f9ff;
  background-image: 
    radial-gradient(circle at 20% 25%, rgba(219, 234, 254, 0.4) 0%, rgba(219, 234, 254, 0) 15%),
    radial-gradient(circle at 80% 75%, rgba(239, 246, 255, 0.6) 0%, rgba(239, 246, 255, 0) 20%);
  padding: 4rem 0;
  margin: 3.5rem 0;
  border-radius: 16px;
  box-shadow: 
    0 15px 30px -8px rgba(0, 0, 0, 0.08),
    0 5px 15px -3px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
  border: 1px solid rgba(219, 234, 254, 0.7);
}

.features-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.5) 0%, rgba(255, 255, 255, 0) 60%);
  z-index: 0;
}

.features-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40%;
  height: 40%;
  background: linear-gradient(225deg, rgba(191, 219, 254, 0.4) 0%, rgba(255, 255, 255, 0) 75%);
  z-index: 0;
}

.features-section > * {
  position: relative;
  z-index: 1;
}

.section-title {
  font-size: var(--font-3xl);
  font-weight: 800;
  margin-bottom: 2.5rem;
  text-align: center;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  padding-bottom: 1.25rem;
  letter-spacing: -0.02em;
  text-shadow: 
    0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 0 rgba(255, 255, 255, 0.3);
}

.section-title::before {
  content: '';
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background-color: white;
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.12), 0 8px 12px -4px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  border-top: 5px solid transparent;
  position: relative;
  overflow: hidden;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
  z-index: 1;
}

.feature-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40%;
  height: 40%;
  background: linear-gradient(315deg, rgba(238, 242, 255, 0.3) 0%, rgba(255, 255, 255, 0) 65%);
  z-index: 1;
}

.feature-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 25px 30px -10px rgba(0, 0, 0, 0.15), 0 15px 15px -7px rgba(0, 0, 0, 0.07);
}

.blue-feature {
  border-top-color: var(--primary-color);
}

.green-feature {
  border-top-color: var(--chem-color);
}

.purple-feature {
  border-top-color: var(--accent-color);
}

.yellow-feature {
  border-top-color: var(--programming-color);
}

.feature-icon {
  font-size: var(--font-4xl);
  margin-bottom: 1.25rem;
  background-color: rgba(219, 234, 254, 0.6);
  width: 4.25rem;
  height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  box-shadow: 0 5px 15px -3px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.blue-feature .feature-icon {
  color: var(--primary-color);
  background-color: rgba(219, 234, 254, 0.7);
}

.green-feature .feature-icon {
  color: var(--chem-color);
  background-color: rgba(209, 250, 229, 0.7);
}

.purple-feature .feature-icon {
  color: var(--accent-color);
  background-color: rgba(237, 233, 254, 0.7);
}

.yellow-feature .feature-icon {
  color: var(--programming-color);
  background-color: rgba(254, 240, 138, 0.7);
}

.feature-title {
  font-size: var(--font-xl);
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
  letter-spacing: -0.01em;
}

.feature-desc {
  color: #4b5563;
  line-height: 1.7;
  position: relative;
  z-index: 2;
  font-size: var(--font-md);
  letter-spacing: 0.01em;
}

/* ---- Features Wrapper ---- */
.features-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 0 1rem;
}

/* ---- How to Use Section ---- */
.how-to-use-section {
  margin-top: 4rem;
  margin-bottom: 3rem;
  color: #1e293b;
  position: relative;
}

.how-to-use-section::before {
  content: '';
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, #dbeafe, #ede9fe);
  border-radius: 2px;
}

.how-to-use-content {
  background-color: white;
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.1), 0 5px 15px -5px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
  position: relative;
  overflow: hidden;
}

.how-to-use-content::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle at top right, rgba(219, 234, 254, 0.25), rgba(255, 255, 255, 0) 70%);
  z-index: 0;
}

.how-to-use-content > * {
  position: relative;
  z-index: 1;
}

.instructions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .instructions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.instruction-title {
  font-size: var(--font-xl);
  font-weight: 800;
  display: flex;
  align-items: center;
  color: #1e40af;
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.instruction-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, #bfdbfe, #93c5fd);
  border-radius: 2px;
}

.instruction-number {
  background-color: #dbeafe;
  padding: 0.5rem;
  border-radius: 50%;
  margin-right: 0.75rem;
  color: #1e40af;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.instruction-ai .instruction-number {
  background-color: #f3e8ff;
  color: #7e22ce;
  border: 1px solid rgba(126, 34, 206, 0.2);
  box-shadow: 0 4px 6px -1px rgba(126, 34, 206, 0.1);
}

.instruction-ai .instruction-title::after {
  background: linear-gradient(90deg, #e9d5ff, #d8b4fe);
}

.instruction-details {
  margin-left: 3rem;
  background-color: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
}

.mode-instruction {
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  border-radius: 6px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-left: 3px solid #dbeafe;
  transition: all 0.2s ease;
}

.mode-instruction:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.mode-name {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.mode-name::before {
  content: '•';
  margin-right: 0.5rem;
  font-size: 1.25rem;
  color: #3b82f6;
}

.mode-chemistry {
  color: var(--chem-color);
  border-left-color: var(--chem-bg);
}

.mode-chemistry .mode-name::before {
  color: var(--chem-color);
}

.mode-physics {
  color: var(--physics-color);
  border-left-color: var(--physics-bg);
}

.mode-physics .mode-name::before {
  color: var(--physics-color);
}

.mode-programming {
  color: var(--programming-color);
  border-left-color: var(--programming-bg);
}

.mode-programming .mode-name::before {
  color: var(--programming-color);
}

.mode-desc {
  font-size: var(--font-sm);
  color: #4b5563;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.mode-example {
  font-size: var(--font-xs);
  font-style: italic;
  color: #1e40af;
  margin-top: 0.25rem;
}

.mode-chemistry-example {
  color: var(--chem-color);
}

.mode-physics-example {
  color: var(--physics-color);
}

.mode-programming-example {
  color: var(--programming-color);
}

.ai-instruction-intro {
  color: #334155;
  margin-bottom: 0.75rem;
}

.ai-steps {
  list-style-type: decimal;
  margin-left: 1.25rem;
  margin-bottom: 0;
  color: #4b5563;
}

.ai-steps li {
  margin-bottom: 0.5rem;
}

.step-highlight {
  font-weight: 600;
  color: #1e40af;
}

.keyboard-shortcuts {
  margin-top: 1.5rem;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  font-size: var(--font-sm);
  color: #4b5563;
}

.shortcut-key {
  font-weight: 600;
  color: #1e293b;
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  max-width: 24rem;
  width: 100%;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  position: relative;
  margin-bottom: 0.75rem;
  overflow: hidden;
  padding: 0.75rem 1rem;
  background-color: white;
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  animation: slideIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: var(--primary-color);
  animation: shrink 5s linear forwards;
}

@keyframes shrink {
  from { width: 100%; }
  to { width: 0%; }
}

.toast-title {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.toast-description {
  font-size: var(--font-sm);
  color: #4b5563;
}

.toast-error {
  border-left-color: #dc2626;
}

.toast-error .toast-progress {
  background-color: #dc2626;
}

/* ---- Footer ---- */
.calculator-footer {
  margin-top: 2.5rem;
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: var(--font-sm);
}

.footer-tagline {
  margin-top: 0.25rem;
}

/* ---- Responsive Adjustments ---- */
/* WordPress Widget/Sidebar Specific Styles */
.widget .calculator-container,
.wp-block-widget .calculator-container,
.sidebar .calculator-container,
.widget-area .calculator-container {
  min-height: auto;
  padding: 0.5rem 0.25rem;
}

.widget .calculator-main,
.wp-block-widget .calculator-main,
.sidebar .calculator-main,
.widget-area .calculator-main {
  max-width: 100%;
}

.widget .calculator-card,
.wp-block-widget .calculator-card,
.sidebar .calculator-card,
.widget-area .calculator-card {
  padding: 0.5rem;
  border-width: 1px;
}

.widget .ti84-display,
.wp-block-widget .ti84-display,
.sidebar .ti84-display,
.widget-area .ti84-display {
  padding: 0.375rem;
  border-width: 2px;
  margin-bottom: 0.5rem;
}

.widget .expression-display,
.wp-block-widget .expression-display,
.sidebar .expression-display,
.widget-area .expression-display {
  font-size: 0.7rem;
  min-height: 1.2em;
  padding: 0.25rem;
  margin-bottom: 0.25rem;
}

.widget .result-display,
.wp-block-widget .result-display,
.sidebar .result-display,
.widget-area .result-display {
  font-size: 0.8rem;
  min-height: 1.2em;
  padding: 0.25rem;
}

.widget .status-bar,
.wp-block-widget .status-bar,
.sidebar .status-bar,
.widget-area .status-bar {
  font-size: 0.6rem;
  padding: 0.125rem 0.25rem;
  margin-bottom: 0.25rem;
}

.widget .calc-button,
.wp-block-widget .calc-button,
.sidebar .calc-button,
.widget-area .calc-button {
  height: 1.75rem;
  font-size: 0.6rem;
  border-radius: 3px;
  padding: 0;
  min-width: auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
  margin: 0;
}

.widget .keypad-row,
.wp-block-widget .keypad-row,
.sidebar .keypad-row,
.widget-area .keypad-row {
  gap: 0.125rem;
  margin-bottom: 0.125rem;
}

.widget .ti84-keypad,
.wp-block-widget .ti84-keypad,
.sidebar .ti84-keypad,
.widget-area .ti84-keypad {
  gap: 0.125rem;
}

.widget .keypad-section,
.wp-block-widget .keypad-section,
.sidebar .keypad-section,
.widget-area .keypad-section {
  padding: 0;
  margin: 0;
}

.widget .arrow-keys,
.wp-block-widget .arrow-keys,
.sidebar .arrow-keys,
.widget-area .arrow-keys {
  margin-top: 0.25rem;
}

.widget .arrow-row,
.wp-block-widget .arrow-row,
.sidebar .arrow-row,
.widget-area .arrow-row {
  gap: 0.125rem;
  margin-bottom: 0.125rem;
}

.widget .additional-buttons,
.wp-block-widget .additional-buttons,
.sidebar .additional-buttons,
.widget-area .additional-buttons {
  gap: 0.125rem;
  margin-top: 0.25rem;
}

.widget .ai-assistant-button,
.wp-block-widget .ai-assistant-button,
.sidebar .ai-assistant-button,
.widget-area .ai-assistant-button {
  font-size: 0.75rem;
  padding: 0.375rem;
  margin-bottom: 0.5rem;
}

.widget .mode-badge,
.wp-block-widget .mode-badge,
.sidebar .mode-badge,
.widget-area .mode-badge {
  font-size: 0.6rem;
  padding: 0.125rem 0.25rem;
}

.widget .second-mode-indicator,
.wp-block-widget .second-mode-indicator,
.sidebar .second-mode-indicator,
.widget-area .second-mode-indicator,
.widget .alpha-mode-indicator,
.wp-block-widget .alpha-mode-indicator,
.sidebar .alpha-mode-indicator,
.widget-area .alpha-mode-indicator,
.widget .current-mode-indicator,
.wp-block-widget .current-mode-indicator,
.sidebar .current-mode-indicator,
.widget-area .current-mode-indicator {
  font-size: 0.5rem;
  padding: 0 0.125rem;
}

.widget .second-function-indicator,
.wp-block-widget .second-function-indicator,
.sidebar .second-function-indicator,
.widget-area .second-function-indicator,
.widget .alpha-character-indicator,
.wp-block-widget .alpha-character-indicator,
.sidebar .alpha-character-indicator,
.widget-area .alpha-character-indicator {
  font-size: 0.4rem;
  top: 0.125rem;
}

.widget .calculator-title,
.wp-block-widget .calculator-title,
.sidebar .calculator-title,
.widget-area .calculator-title {
  font-size: var(--font-xl);
}

.widget .calculator-subtitle,
.wp-block-widget .calculator-subtitle,
.sidebar .calculator-subtitle,
.widget-area .calculator-subtitle {
  font-size: var(--font-xs);
}

/* WordPress-specific feature and how-to-use styles */
.widget .features-section,
.wp-block-widget .features-section,
.sidebar .features-section,
.widget-area .features-section,
.widget .how-to-use-section,
.wp-block-widget .how-to-use-section,
.sidebar .how-to-use-section,
.widget-area .how-to-use-section {
  padding: 1.5rem 0.5rem;
  margin: 1.5rem 0;
  background-color: #f0f9ff;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.widget .how-to-use-content,
.wp-block-widget .how-to-use-content,
.sidebar .how-to-use-content,
.widget-area .how-to-use-content {
  padding: 1rem;
  box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.1);
}

.widget .instruction-title,
.wp-block-widget .instruction-title,
.sidebar .instruction-title,
.widget-area .instruction-title {
  font-size: var(--font-lg);
  margin-bottom: 1rem;
}

.widget .instruction-details,
.wp-block-widget .instruction-details,
.sidebar .instruction-details,
.widget-area .instruction-details {
  margin-left: 2.5rem;
  padding: 0.75rem;
}

.widget .mode-instruction,
.wp-block-widget .mode-instruction,
.sidebar .mode-instruction,
.widget-area .mode-instruction {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
}

.widget .features-section::before,
.wp-block-widget .features-section::before,
.sidebar .features-section::before,
.widget-area .features-section::before {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.5) 0%, rgba(255, 255, 255, 0) 60%);
}

.widget .section-title,
.wp-block-widget .section-title,
.sidebar .section-title,
.widget-area .section-title {
  font-size: var(--font-2xl);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.widget .section-title::after,
.wp-block-widget .section-title::after,
.sidebar .section-title::after,
.widget-area .section-title::after {
  width: 60px;
  height: 3px;
}

.widget .features-grid,
.wp-block-widget .features-grid,
.sidebar .features-grid,
.widget-area .features-grid {
  gap: 1rem;
}

.widget .feature-card,
.wp-block-widget .feature-card,
.sidebar .feature-card,
.widget-area .feature-card {
  padding: 1.25rem;
  box-shadow: 0 7px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 8px -2px rgba(0, 0, 0, 0.1);
  border-width: 4px 1px 1px 1px;
  transform: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  margin-bottom: 1rem;
}

.widget .feature-card:hover,
.wp-block-widget .feature-card:hover,
.sidebar .feature-card:hover,
.widget-area .feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.15), 0 6px 10px -2px rgba(0, 0, 0, 0.1);
}

.widget .feature-card::after,
.wp-block-widget .feature-card::after,
.sidebar .feature-card::after,
.widget-area .feature-card::after {
  width: 50%;
  height: 50%;
}

.widget .feature-icon,
.wp-block-widget .feature-icon,
.sidebar .feature-icon,
.widget-area .feature-icon {
  font-size: var(--font-3xl);
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1rem;
  background-color: rgba(219, 234, 254, 0.8);
  box-shadow: 0 6px 12px -4px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.widget .feature-title,
.wp-block-widget .feature-title,
.sidebar .feature-title,
.widget-area .feature-title {
  font-size: var(--font-xl);
  margin-bottom: 0.75rem;
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: -0.01em;
}

.widget .feature-desc,
.wp-block-widget .feature-desc,
.sidebar .feature-desc,
.widget-area .feature-desc {
  font-size: var(--font-md);
  line-height: 1.6;
  color: #374151;
}

@media (max-width: 992px) {
  .features-wrapper {
    padding: 0 0.5rem;
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .calculator-main {
    max-width: 100%;
  }
  
  .calculator-title {
    font-size: var(--font-3xl);
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .calculator-container {
    padding: 1rem 0.5rem;
  }
  
  .calculator-card {
    padding: 1rem;
  }
  
  .ti84-display {
    padding: 0.75rem;
  }
  
  .calc-button {
    height: 2.5rem;
    font-size: var(--font-xs);
  }
  
  .expression-display,
  .result-display {
    padding: 0.25rem;
    font-size: var(--font-md);
  }
  
  .features-grid {
    gap: 1rem;
  }
  
  .how-to-use-content {
    padding: 1rem;
  }
  
  .instruction-title {
    font-size: var(--font-lg);
  }
  
  .instruction-number {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0.25rem;
  }
  
  .instruction-details {
    margin-left: 2rem;
  }
  
  .keypad-row {
    gap: 0.25rem;
  }
  
  .ai-content-area,
  .graph-area {
    height: 10rem;
  }
  
  .mode-badges {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .calculator-title {
    font-size: var(--font-2xl);
  }
  
  .calculator-subtitle {
    font-size: var(--font-sm);
  }
  
  .calculator-card {
    padding: 0.75rem;
    border-width: 1px;
  }
  
  .calc-button {
    height: 2.25rem;
    font-size: 0.65rem;
    padding: 0;
  }
  
  .ti84-display {
    padding: 0.5rem;
    border-width: 2px;
  }
  
  .expression-display,
  .result-display {
    font-size: var(--font-sm);
  }
  
  .keypad-row {
    gap: 0.125rem;
  }
  
  .ai-assistant-button {
    font-size: var(--font-sm);
    padding: 0.5rem;
  }
  
  .ai-button-icon {
    font-size: var(--font-lg);
  }
}

/* ---- Active State Classes ---- */
.active-mode {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.active-second-mode .second-mode-indicator {
  display: block;
}

.active-alpha-mode .alpha-mode-indicator {
  display: block;
}

.active-graph .graph-container {
  display: block;
}

.active-graph #graphCanvas {
  display: block;
}

.active-graph .graph-placeholder {
  display: none;
}

.active-ai .ai-explanation-container {
  display: block;
}

.loading-ai .ai-loading-state {
  display: flex;
}

.loading-ai .ai-explanation-text {
  display: none;
}

.loading-ai .ai-loading-indicator {
  display: block;
}

.loading-ai .clear-ai-button {
  display: none;
}

.loading-ai .ai-button-text {
  display: none;
}

.loading-ai .ai-loading-spinner-button {
  display: block;
}

.has-ai-data .clear-ai-button {
  display: block;
}

.has-ai-data .ai-loading-state {
  display: none;
}

.has-ai-data .ai-explanation-text {
  display: block;
}

/* Mode-specific styling for UI elements */
.calc-mode-Mathematics .current-mode-indicator {
  background-color: var(--math-bg);
  color: var(--math-color);
}

.calc-mode-Chemistry .current-mode-indicator {
  background-color: var(--chem-bg);
  color: var(--chem-color);
}

.calc-mode-Physics .current-mode-indicator {
  background-color: var(--physics-bg);
  color: var(--physics-color);
}

.calc-mode-Programming .current-mode-indicator {
  background-color: var(--programming-bg);
  color: var(--programming-color);
}

.calc-mode-Unit.Conversion .current-mode-indicator {
  background-color: var(--conversion-bg);
  color: var(--conversion-color);
}

/* Second function indicator on buttons */
.second-function-indicator {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  font-size: 0.5rem;
  color: #1e40af;
}

/* Alpha character indicator on buttons */
.alpha-character-indicator {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  font-size: 0.5rem;
  color: #047857;
}