/* Custom styles for Text Utilities */

/* Prevent horizontal overflow without breaking sticky */
body {
  overflow-x: hidden;
}

.tool {
  scroll-margin-top: 100px;
}

.card {
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
}

.card:hover {
  transform: translateY(-2px);
}

.btn-group .btn {
  flex: 1;
  min-width: 0; /* Prevent buttons from overflowing */
}

/* Ensure no horizontal overflow on mobile */
@media (max-width: 576px) {
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .btn-group {
    flex-wrap: wrap;
  }
  
  .btn-group .btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px; /* Ensure minimum touch target size */
    min-width: 44px;
  }
  
  /* Larger touch targets for primary action buttons */
  .btn-primary, .btn-success, .btn-warning, .btn-info, .btn-secondary {
    min-height: 48px;
    padding: 0.75rem 1rem;
  }
}

/* Smooth scrolling for navigation */
html {
  scroll-behavior: smooth;
}

/* Custom textarea styling */
textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

textarea.form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Stats cards styling */
.bg-primary.bg-opacity-10,
.bg-success.bg-opacity-10,
.bg-info.bg-opacity-10 {
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.bg-primary.bg-opacity-10:hover {
  border-color: var(--bs-primary);
}

.bg-success.bg-opacity-10:hover {
  border-color: var(--bs-success);
}

.bg-info.bg-opacity-10:hover {
  border-color: var(--bs-info);
}

/* Copy button animation */
.btn.copied {
  background-color: var(--bs-success) !important;
  border-color: var(--bs-success) !important;
}

/* Navigation smooth hover effects */
nav a.btn {
  transition: all 0.3s ease;
}

nav a.btn:hover {
  transform: translateY(-1px);
}

/* Footer styling */
footer {
  background: linear-gradient(135deg, var(--bs-dark) 0%, rgba(0, 0, 0, 0.8) 100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    margin-bottom: 0.5rem;
    min-height: 48px; /* Optimal touch target */
  }
  
  .btn-group .btn:last-child {
    margin-bottom: 0;
  }
  
  nav .btn {
    margin-bottom: 0.5rem;
    width: 100%;
    min-height: 44px;
  }
  
  /* Larger textareas on mobile for better usability */
  textarea.form-control {
    min-height: 150px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Loading animation for buttons */
.btn.loading {
  position: relative;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile Menu Styles */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 380px;
  height: 100vh;
  background: var(--bs-dark);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.mobile-menu.active .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-header h5 {
  margin: 0;
  color: var(--bs-light);
}

.mobile-menu-nav {
  padding: 1rem 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.5rem;
  color: var(--bs-light);
  text-decoration: none;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  font-size: 0.95rem;
}

.mobile-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--bs-primary);
}

.mobile-menu-item:last-child {
  border-bottom: none;
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

/* Sticky Header for Ad Visibility */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bs-body-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Drag and Drop Styles */
textarea {
  transition: all 0.3s ease;
  position: relative;
}

textarea.drag-over {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important;
  background-color: rgba(var(--bs-primary-rgb), 0.05) !important;
}

/* Drop zone indicator */
textarea::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--bs-primary-rgb), 0.1);
  border: 2px dashed var(--bs-primary);
  border-radius: var(--bs-border-radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1;
}

textarea.drag-over::before {
  opacity: 1;
}

.sticky-ad-space {
  position: sticky;
  top: 70px; /* Adjust based on header height */
  z-index: 999;
  background: var(--bs-body-bg);
  padding: 0.5rem 0;
}
