/* Enhanced Tool Styles with Modern Animations and Effects */

/* Universal Tool Container Enhancements */
.calculator-container {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.calculator-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.calculator-container:hover::before {
  opacity: 1;
}

.calculator-container: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),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Enhanced Input Fields */
.tool-input {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 500;
  color: #1f2937;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
}

.tool-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.1),
    0 4px 8px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.tool-input:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

/* Enhanced Buttons */
.tool-button {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 6px rgba(99, 102, 241, 0.2),
    0 2px 4px rgba(99, 102, 241, 0.1);
  position: relative;
  overflow: hidden;
}

.tool-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.tool-button:hover::before {
  left: 100%;
}

.tool-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 12px rgba(99, 102, 241, 0.3),
    0 4px 8px rgba(99, 102, 241, 0.2);
}

.tool-button:active {
  transform: translateY(0);
  box-shadow:
    0 2px 4px rgba(99, 102, 241, 0.2),
    0 1px 2px rgba(99, 102, 241, 0.1);
}

.tool-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading Button State */
.tool-button.loading {
  position: relative;
  color: transparent;
}

.tool-button.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result Box Animations */
.result-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #0ea5e9;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px rgba(14, 165, 233, 0.1);
  position: relative;
  overflow: hidden;
}

.result-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0ea5e9, #06b6d4, #8b5cf6);
}

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

/* Enhanced Unit Toggle Buttons */
.unit-toggle {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
}

.unit-toggle:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.unit-toggle.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-color: #6366f1;
  box-shadow:
    0 4px 6px rgba(99, 102, 241, 0.2),
    0 2px 4px rgba(99, 102, 241, 0.1);
}

/* Form Group Animations */
.form-group {
  animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Enhanced Labels */
.form-label {
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  display: block;
  transition: color 0.3s ease;
}

.tool-input:focus + .form-label,
.form-label:focus-within {
  color: #6366f1;
}

/* Progress Bars and Gauges */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Success/Error States */
.success-message {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 1px solid #16a34a;
  color: #166534;
  border-radius: 12px;
  padding: 16px;
  animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.error-message {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #dc2626;
  color: #991b1b;
  border-radius: 12px;
  padding: 16px;
  animation: shake 0.5s ease-in-out;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Dark Mode Support */
[data-theme="dark"] .calculator-container {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
}

[data-theme="dark"] .tool-input {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .tool-input:focus {
  border-color: #6366f1;
}

[data-theme="dark"] .result-box {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .unit-toggle {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .unit-toggle.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

/* Responsive Enhancements */
@media (max-width: 640px) {
  .calculator-container {
    border-radius: 12px;
    padding: 16px;
  }

  .tool-input {
    padding: 10px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .tool-button {
    padding: 12px 20px;
    font-size: 15px;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Enhanced Tailwind Button Styles */
button[class*="bg-indigo-600"],
button[class*="bg-blue-600"],
button[class*="bg-purple-600"],
button[class*="bg-green-600"],
button[class*="bg-red-600"],
button[class*="bg-yellow-600"],
button[class*="bg-pink-600"] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
  position: relative;
  overflow: hidden;
}

button[class*="bg-indigo-600"]:hover,
button[class*="bg-blue-600"]:hover,
button[class*="bg-purple-600"]:hover,
button[class*="bg-green-600"]:hover,
button[class*="bg-red-600"]:hover,
button[class*="bg-yellow-600"]:hover,
button[class*="bg-pink-600"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(99, 102, 241, 0.3);
}

button[class*="bg-indigo-600"]:active,
button[class*="bg-blue-600"]:active,
button[class*="bg-purple-600"]:active,
button[class*="bg-green-600"]:active,
button[class*="bg-red-600"]:active,
button[class*="bg-yellow-600"]:active,
button[class*="bg-pink-600"]:active {
  transform: translateY(0);
}

/* Enhanced Tailwind Input Styles */
input[class*="border-gray-300"],
select[class*="border-gray-300"],
textarea[class*="border-gray-300"] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input[class*="border-gray-300"]:focus,
select[class*="border-gray-300"]:focus,
textarea[class*="border-gray-300"]:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

input[class*="border-gray-300"]:hover,
select[class*="border-gray-300"]:hover,
textarea[class*="border-gray-300"]:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Enhanced Tailwind Container Styles */
.bg-white.rounded-lg,
.bg-white.rounded-xl,
.bg-white.rounded-2xl {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .bg-white.rounded-lg,
[data-theme="dark"] .bg-white.rounded-xl,
[data-theme="dark"] .bg-white.rounded-2xl {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .bg-white.rounded-lg:hover,
[data-theme="dark"] .bg-white.rounded-xl:hover,
[data-theme="dark"] .bg-white.rounded-2xl:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

.bg-white.rounded-lg:hover,
.bg-white.rounded-xl:hover,
.bg-white.rounded-2xl:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Focus Visible for Better Accessibility */
.tool-input:focus-visible,
.tool-button:focus-visible,
.unit-toggle:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}