/* DevOps Toolkit Custom Styles */

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}
.scrollbar-hide::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Smooth transitions for theme changes */
* {
  transition-property: background-color, border-color, color;
  transition-duration: 300ms;
  transition-timing-function: ease-in-out;
}

/* Calculator panel transitions */
.calculator-panel {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Tab active state animations */
.calculator-tab {
  transition: all 0.2s ease-in-out;
}

.calculator-tab.active {
  border-bottom-color: #ff7800;
  color: #ff7800;
}

/* Input field styles */
.calc-input {
  transition: all 0.2s ease-in-out;
}

.calc-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #ff7800;
  border-color: #ff7800;
}

.calc-input.error {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.dark .calc-input.error {
  background-color: #7f1d1d;
}

/* Result card styles */
.result-card {
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Copy button animation */
.copy-btn {
  transition: all 0.2s ease-in-out;
}

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

.copy-btn.copied {
  background-color: #10b981;
  color: white;
}

/* Notification animation */
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in {
  animation: slide-in 0.3s ease-out;
}

#toolkit-notification {
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* Saved calculation item */
.saved-item {
  transition: all 0.2s ease-in-out;
}

.saved-item:hover {
  transform: translateX(4px);
}

/* Dictionary term styles */
.dictionary-term {
  scroll-margin-top: 120px;
}

.dictionary-category {
  border-left: 4px solid #ff7800;
}

/* Scrollbar styling for dark mode */
.dark ::-webkit-scrollbar {
  width: 8px;
}

.dark ::-webkit-scrollbar-track {
  background: #374151;
}

.dark ::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Loading spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: #1f2937;
  color: white;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 0.5rem;
}

.tooltip:hover::after {
  opacity: 1;
}

/* Save Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-container {
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-content {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  min-width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .modal-content {
  background: #1f2937;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3),
    0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

.dark .modal-title {
  color: #f9fafb;
}

.modal-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  color: #111827;
  background: white;
  margin-bottom: 1.25rem;
  transition: all 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: #ff7800;
  box-shadow: 0 0 0 3px rgba(255, 120, 0, 0.1);
}

.dark .modal-input {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .modal-input:focus {
  border-color: #ff7800;
  box-shadow: 0 0 0 3px rgba(255, 120, 0, 0.2);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-btn {
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.modal-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.modal-btn-cancel:hover {
  background: #e5e7eb;
}

.dark .modal-btn-cancel {
  background: #374151;
  color: #d1d5db;
}

.dark .modal-btn-cancel:hover {
  background: #4b5563;
}

.modal-btn-primary {
  background: #16a34a;
  color: white;
}

.modal-btn-primary:hover {
  background: #15803d;
}
/* ==================== RESPONSIVE / MOBILE OPTIMIZATIONS ==================== */

/* Mobile: Stack sidebar below main content and optimize spacing */
@media (max-width: 1023px) {
  /* Reverse order: show main content first, then sidebar */
  .lg\\:col-span-3 {
    order: 2;
  }

  .lg\\:col-span-9 {
    order: 1;
  }

  /* Make sidebar cards more compact on mobile */
  .lg\\:col-span-3 .bg-white,
  .lg\\:col-span-3 .dark\\:bg-gray-800 {
    padding: 1rem;
  }

  /* Reduce saved calculations max height on mobile */
  #saved-calculations-list {
    max-height: 300px !important;
  }

  /* Hide keyboard shortcuts on smaller screens */
  .lg\\:block {
    display: none !important;
  }
}

/* Tablet: Optimize spacing */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Show sidebar in 2-column grid on tablets */
  .container.mx-auto.max-w-7xl > .grid {
    grid-template-columns: 1fr 1fr;
  }

  .lg\\:col-span-3,
  .lg\\:col-span-9 {
    grid-column: span 2;
  }
}

/* Small mobile: Optimize touch targets and reduce padding */
@media (max-width: 640px) {
  /* Larger touch targets for buttons */
  .saved-item {
    padding: 0.875rem;
  }

  .delete-calc {
    opacity: 1 !important; /* Always show on mobile (no hover) */
    padding: 0.5rem;
  }

  /* Hero section: reduce padding */
  section.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  /* Modal: Full width on very small screens */
  .modal-container {
    margin: 1rem;
    width: calc(100% - 2rem);
  }

  /* Notification: adjust position for mobile */
  #toolkit-notification {
    left: 1rem;
    right: 1rem;
    top: 1rem;
    max-width: calc(100vw - 2rem);
  }

  /* Calculator inputs: stack vertically */
  .grid.md\\:grid-cols-2 {
    grid-template-columns: 1fr;
  }

  /* Quick select buttons: smaller text */
  .subnet-quick,
  button[class*="px-3"] {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
}

/* Print styles: hide navigation and sidebar */
@media print {
  aside,
  nav,
  .modal-overlay,
  #toolkit-notification,
  button {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .result-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
.modal-btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
