/* Tool Container Styles */
.tool-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* String Tool Styles */
.string-tool {
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.97), rgba(248, 238, 222, 0.97));
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(94, 65, 30, 0.12);
  border: 1px solid rgba(145, 103, 48, 0.2);
}

.input-section {
  margin-bottom: 30px;
}

.input-section label {
  display: block;
  color: #5e4329;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#stringInput {
  width: 100%;
  background: #fffaf2;
  border: 2px solid rgba(145, 103, 48, 0.22);
  border-radius: 8px;
  padding: 16px;
  color: #4a351f;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  resize: vertical;
  transition: all 0.3s ease;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
  will-change: scroll-position;
}

#stringInput:focus {
  outline: none;
  border-color: #ab7c34;
  box-shadow: 0 0 0 3px rgba(171, 124, 52, 0.12);
}

#stringInput::placeholder {
  color: #8c7558;
}

.process-done-section {
  margin: 20px 0;
  padding: 0;
}

.process-done-content {
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(248, 240, 228, 0.96));
  border: 2px solid rgba(145, 103, 48, 0.3);
  border-radius: 12px;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 15px rgba(94, 65, 30, 0.15);
}

.process-done-content i {
  color: #b98b3b;
  font-size: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.process-done-content span {
  color: #5e4329;
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}

.process-done-content .btn {
  margin: 0;
  padding: 12px 24px;
  font-size: 1rem;
}

/* Accordion Styles */
.accordion-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 30px;
}

.accordion-item {
  background: rgba(182, 138, 58, 0.06);
  border: 1px solid rgba(145, 103, 48, 0.18);
  border-radius: 8px;
  overflow: hidden;
  transition: none;
}

.accordion-item.active {
  background: rgba(182, 138, 58, 0.1);
  border-color: rgba(145, 103, 48, 0.3);
}

.accordion-header {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: none;
  text-align: left;
}

.accordion-header:hover {
  background: rgba(182, 138, 58, 0.1);
}

.accordion-item.active .accordion-header {
  background: rgba(182, 138, 58, 0.14);
}

.accordion-title {
  color: #5e4329;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.accordion-icon {
  color: #7a572c;
  font-size: 0.9rem;
  transition: none;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: none;
  padding: 0 20px;
}

.accordion-item.active .accordion-content {
  max-height: 2000px;
  padding: 0 20px 20px 20px;
}

.utilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.utility-btn {
  background: transparent;
  border: 2px solid rgba(145, 103, 48, 0.3);
  color: #7a572c;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.utility-btn:hover {
  background: rgba(182, 138, 58, 0.12);
  border-color: #ab7c34;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(94, 65, 30, 0.2);
}

.utility-btn:active {
  transform: translateY(0);
}

/* Result Sections */
.result-section {
  margin-bottom: 25px;
  background: #fff8ef;
  border-radius: 12px;
  border: 1px solid rgba(145, 103, 48, 0.18);
  overflow: hidden;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(182, 138, 58, 0.08);
  border-bottom: 1px solid rgba(145, 103, 48, 0.15);
}

.result-header h3 {
  color: #5e4329;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-header h3 i {
  font-size: 1rem;
}

.copy-btn-small {
  background: transparent;
  border: 1px solid rgba(145, 103, 48, 0.3);
  color: #7a572c;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.copy-btn-small:hover {
  background: rgba(182, 138, 58, 0.12);
  border-color: #ab7c34;
  transform: scale(1.05);
}

.result-content {
  padding: 20px;
}

.stats-output {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.stat-box {
  background: rgba(182, 138, 58, 0.08);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid rgba(145, 103, 48, 0.18);
}

.stat-label {
  color: #5e4329;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  color: #4a351f;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.result-output {
  width: 100%;
  background: #fffaf2;
  border: 2px solid rgba(145, 103, 48, 0.22);
  border-radius: 8px;
  padding: 16px;
  color: #4a351f;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  resize: vertical;
  box-sizing: border-box;
}

.result-output:focus {
  outline: none;
  border-color: #ab7c34;
  box-shadow: 0 0 0 3px rgba(171, 124, 52, 0.12);
}

/* Smooth Scrolling for Mobile */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

body {
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  /* Enhanced smooth scrolling for mobile with keyboard */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  body {
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    position: relative;
  }

  .tool-container {
    padding: 0 15px;
    min-height: 100vh;
    position: relative;
    -webkit-overflow-scrolling: touch;
  }


  .string-tool {
    padding: 25px 20px;
  }

  .accordion-container {
    gap: 6px;
    margin-bottom: 25px;
  }

  .accordion-header {
    padding: 14px 16px;
  }

  .accordion-title {
    font-size: 0.9rem;
  }

  .accordion-content {
    padding: 0 16px;
  }

  .accordion-item.active .accordion-content {
    padding: 0 16px 16px 16px;
  }

  .utilities-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 12px;
  }

  .result-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .copy-btn-small.copied {
    animation: copyPulse 0.6s ease;
    box-shadow: 0 0 15px rgba(171, 124, 52, 0.45);
  }

  .copy-btn-small.copied svg {
    display: inline-block;
    vertical-align: middle;
  }

  @keyframes copyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1.05); }
  }

  .copy-btn-small {
    width: auto;
    flex-shrink: 0;
  }

  .stats-output {
    grid-template-columns: 1fr;
  }


  /* Smooth scrolling for inputs on mobile */
  #stringInput,
  .result-output,
  .modal-input {
    font-size: 16px !important; /* Prevent zoom on iOS */
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
    will-change: scroll-position;
  }

  /* Ensure smooth scrolling for all scrollable elements */
  .string-tool,
  .result-content,
  .accordion-content {
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
  }

  /* Prevent layout shift when keyboard appears */
  .tool-container {
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }
}

@media (max-width: 480px) {

  .accordion-title {
    font-size: 0.85rem;
  }

  .utilities-grid {
    grid-template-columns: 1fr;
  }
}

.action-buttons.btn-contain-x {
  margin-bottom: 25px;
}

/* Custom Input Modal */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(248, 238, 222, 0.96));
  border: 2px solid rgba(145, 103, 48, 0.3);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(94, 65, 30, 0.25);
  z-index: 10001;
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid rgba(145, 103, 48, 0.2);
}

.modal-header h3 {
  color: #5e4329;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-close {
  background: transparent;
  border: 1px solid rgba(145, 103, 48, 0.3);
  color: #7a572c;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(182, 138, 58, 0.12);
  border-color: #ab7c34;
  transform: scale(1.05);
}

.modal-body {
  padding: 25px;
}

.modal-body label {
  display: block;
  color: #5e4329;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-input {
  width: 100%;
  background: #fffaf2;
  border: 2px solid rgba(145, 103, 48, 0.3);
  border-radius: 8px;
  padding: 14px 16px;
  color: #4a351f;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.modal-input:focus {
  outline: none;
  border-color: #ab7c34;
  box-shadow: 0 0 0 3px rgba(171, 124, 52, 0.12);
}

.modal-input::placeholder {
  color: #8c7558;
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px 25px;
  border-top: 1px solid rgba(145, 103, 48, 0.2);
}

.modal-footer .btn {
  margin: 0;
  padding: 12px 24px;
  font-size: 0.95rem;
}

/* Mobile Responsive for Modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-width: none;
  }

  .modal-header {
    padding: 18px 20px;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 18px 20px;
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

