/*====================================*/
/* Wavelength Measurement Lab - Custom Theme */
/* Virtual Physics Laboratory */
/*====================================*/

/* Base Styles */
:root {
  /* Dark Theme Colors (Default) */
  --color-primary: #ec4899; /* pink-500 */
  --color-secondary: #a855f7; /* purple-500 */
  --color-accent: #6366f1; /* indigo-500 */
  --color-background: #0f172a; /* slate-900 */
  --color-card-bg: #1e293b; /* slate-800 */
  --color-input-bg: #334155; /* slate-700 */
  --color-border: #4f46e5; /* indigo-600 */
  --color-text: #f1f5f9; /* slate-100 */
  --color-text-muted: #94a3b8; /* slate-400 */
  --glow-pink: 0 0 20px rgba(236, 72, 153, 0.6);
  --glow-purple: 0 0 20px rgba(168, 85, 247, 0.6);
  --glow-indigo: 0 0 20px rgba(99, 102, 241, 0.6);
  
  /* For backward compatibility */
  --color-dark: var(--color-background);
  --color-dark-lighter: var(--color-card-bg);
  --color-dark-lightest: var(--color-input-bg);
}

/* Light Theme Colors */
.light {
  --color-primary: #db2777; /* pink-600 */
  --color-secondary: #9333ea; /* purple-600 */
  --color-accent: #4f46e5; /* indigo-600 */
  --color-background: #ffffff; /* white */
  --color-card-bg: #f8fafc; /* slate-50 */
  --color-input-bg: #f1f5f9; /* slate-100 */
  --color-border: #6366f1; /* indigo-500 */
  --color-text: #0f172a; /* slate-900 */
  --color-text-muted: #64748b; /* slate-500 */
  --glow-pink: 0 0 15px rgba(219, 39, 119, 0.4);
  --glow-purple: 0 0 15px rgba(147, 51, 234, 0.4);
  --glow-indigo: 0 0 15px rgba(79, 70, 229, 0.4);
  
  /* For backward compatibility */
  --color-dark: var(--color-background);
  --color-dark-lighter: var(--color-card-bg);
  --color-dark-lightest: var(--color-input-bg);
}

/* Theme Transition */
body, button, input, select, div, h1, h2, h3, p, span, canvas {
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.theme-transition {
  animation: pulse 0.5s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

/* Smooth Scrolling and Font Base */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-background);
}

/* Canvas Styling */
div#canvas {
  position: relative;
  background-color: var(--color-background);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

canvas#cv {
  display: block;
  margin: 0 auto;
  transition: transform 0.3s ease;
}

/* Canvas Animation */
.zoom-in {
  animation: zoom-in 0.3s ease;
}

.zoom-out {
  animation: zoom-out 0.3s ease;
}

@keyframes zoom-in {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes zoom-out {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Theme Toggle Animation */
#theme-toggle {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#theme-toggle:hover {
  transform: rotate(15deg);
}

#theme-toggle svg {
  transition: transform 0.5s ease;
}

#theme-toggle:active svg {
  transform: rotate(360deg);
}

/* Input Controls Styling */
input[type="text"] {
  background-color: var(--color-card-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* Light theme adjustments */
.light input[type="text"] {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.light input[type="text"]:focus {
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* Custom Range Slider Styling */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 0.5rem;
  border-radius: 0.25rem;
  outline: none;
  transition: opacity 0.2s;
}

/* Default slider track */
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 0.25rem;
  background: var(--color-dark-lightest);
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 0.25rem;
  background: var(--color-dark-lightest);
}

/* Wavelength slider with spectrum gradient */
#sl1::-webkit-slider-runnable-track {
  background: linear-gradient(to right, 
    #6a11cb 0%, /* Violet - 380nm */
    #2575fc 16.7%, /* Blue - 450nm */
    #00f2fe 33.3%, /* Cyan - 500nm */
    #38ef7d 50%, /* Green - 550nm */
    #fffb00 66.7%, /* Yellow - 580nm */
    #ff9900 83.3%, /* Orange - 620nm */
    #ff0000 100% /* Red - 750nm */
  );
}

#sl1::-moz-range-track {
  background: linear-gradient(to right, 
    #6a11cb 0%, /* Violet - 380nm */
    #2575fc 16.7%, /* Blue - 450nm */
    #00f2fe 33.3%, /* Cyan - 500nm */
    #38ef7d 50%, /* Green - 550nm */
    #fffb00 66.7%, /* Yellow - 580nm */
    #ff9900 83.3%, /* Orange - 620nm */
    #ff0000 100% /* Red - 750nm */
  );
}

/* Slider thumb styling */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  margin-top: -0.375rem; /* Center thumb on track */
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: var(--glow-cyan);
}

input[type="range"]::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border: none;
}

/* Wavelength slider thumb color based on value */
#sl1::-webkit-slider-thumb {
  background-color: currentColor;
}

#sl1::-moz-range-thumb {
  background-color: currentColor;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: var(--glow-cyan);
}

/* Select Dropdown Styling */
select {
  background-color: var(--color-dark-lighter);
  color: var(--color-text);
  border: 1px solid var(--color-dark-lightest);
  border-radius: 0.5rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.25rem;
  transition: border-color 0.2s ease;
}

select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* Radio Button Styling */
input[type="radio"] {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-dark-lightest);
  border-radius: 50%;
  outline: none;
  transition: all 0.2s ease;
}

input[type="radio"]:checked {
  border-color: var(--color-primary);
  background-color: var(--color-primary);
  box-shadow: inset 0 0 0 4px var(--color-dark-lighter);
}

/* Button Styling */
button {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}

/* Card Styling */
.card {
  background-color: var(--color-dark-lighter);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Animation Effects */
@keyframes glow {
  0% {
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
  }
  50% {
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.8);
  }
  100% {
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
  }
}

.glow-effect {
  animation: glow 2s infinite;
}

/* Tab Styling */
.tab-btn {
  position: relative;
  transition: all 0.2s ease;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

.tab-btn:hover::after {
  width: 100%;
}

.tab-btn.active::after {
  width: 100%;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 768px) {
  .grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Zoom Animation */
.zoom-in {
  animation: zoom-in 0.3s ease forwards;
}

@keyframes zoom-in {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.2);
  }
}

.zoom-out {
  animation: zoom-out 0.3s ease forwards;
}

@keyframes zoom-out {
  from {
    transform: scale(1.2);
  }
  to {
    transform: scale(1);
  }
}

/* Themed container: ensure text, inputs, ranges and internal panels use CSS variables */

.themed {
  color: var(--color-text);
}

.themed p, .themed label, .themed span, .themed h1, .themed h2, .themed h3, .themed li {
  color: var(--color-text);
}

/* Inputs and selects inside the themed container */
.themed input[type="text"],
.themed select,
.themed textarea {
  background-color: var(--color-input-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.themed input[type="text"]::placeholder,
.themed textarea::placeholder {
  color: var(--color-text-muted);
}

/* Range inputs: color the track and thumb using variables */
.themed input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, rgba(0,0,0,0.08), rgba(0,0,0,0.04));
  background-color: var(--color-card-bg);
}

.themed input[type="range"]::-moz-range-track {
  background-color: var(--color-card-bg);
}

.themed input[type="range"]::-webkit-slider-thumb {
  background: var(--color-primary);
  box-shadow: 0 0 6px rgba(0,0,0,0.2);
}

.themed input[type="range"]::-moz-range-thumb {
  background: var(--color-primary);
  box-shadow: 0 0 6px rgba(0,0,0,0.15);
}

/* Internal panels / cards */

.themed .bg-gray-800,
.themed .bg-gray-700,
.themed .bg-gray-900 {
  background-color: var(--color-card-bg) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

.themed .text-gray-300,
.themed .text-gray-400,
.themed .text-gray-500,
.themed .text-gray-200 {
  color: var(--color-text-muted) !important;
}


/* Intensity Glow Effect */
.intensity-high {
  text-shadow: 0 0 10px var(--color-primary);
}

  
/* Inline-Element (span) innerhalb einer Schaltfläche */
  
div#panel span, div#panel1 span, div#panel2 span {
  position: absolute;
  white-space: nowrap;
  font: bold 12px sans-serif;
  }
  
/* Textbereich */

textarea {
  position: absolute;
  padding: 3px;
  left: 10px;
  border-radius: 0px;
  font: bold 12px sans-serif;
  line-height: 1.25;
  }
  


/* Add the following styles at the end of your existing CSS */

/* Live Observation Table Styles */
#observation-table {
  border-collapse: collapse;
}

#observation-table th,
#observation-table td {
  transition: background-color 0.3s ease, color 0.3s ease;
}

#observation-table tbody tr {
  cursor: default;
}

#observation-table tbody tr:hover td {
  background-color: rgba(16, 185, 129, 0.15);
}

/* Table value animation on update */
@keyframes valueUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); color: #fbbf24; }
  100% { transform: scale(1); }
}

.value-updated {
  animation: valueUpdate 0.3s ease;
}

/* Guided text pulse animation */
@keyframes guidedPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.animate-pulse {
  animation: guidedPulse 2s ease-in-out infinite;
}

/* Enhanced table styling for light theme */
.light #observation-table th {
  background: linear-gradient(to right, rgba(16, 185, 129, 0.2), rgba(20, 184, 166, 0.2));
  color: #065f46;
}

.light #observation-table td {
  color: #1f2937;
  border-color: rgba(16, 185, 129, 0.2);
}

.light #observation-table #table-angle,
.light #observation-table #table-wavelength {
  font-weight: 700;
}

/* Table container glow effect */
#observation-table:hover {
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

/* Smooth transition for wavelength color changes */
#table-wavelength {
  transition: color 0.3s ease, text-shadow 0.3s ease;
  text-shadow: 0 0 8px currentColor;
}

/* Angle color indication */
#table-angle {
  transition: color 0.3s ease;
}

/* Procedure section enhancement */
.procedure-step {
  position: relative;
  padding-left: 2rem;
}

.procedure-step::before {
  content: attr(data-step);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
}
