/* Comment Send Button - Below Textarea Style */

/* Hide default send button on mobile for main comments only */
@media (max-width: 767px) {
  /* Hide main comment send button only */
  .js_comment-form .x-form-tools-post.js_post-comment {
    display: none !important;
  }
}

/* Send button container */
.comment-send-button-container {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  margin-top: 0;
}

/* Show when textarea is focused */
.comment-send-button-container.active {
  max-height: 40px;
  margin-top: 8px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* The send button */
.comment-send-button {
  width: 100%;
  background: #5e72e4;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(94,114,228,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.comment-send-button:hover {
  background: #4c63d2;
  box-shadow: 0 4px 16px rgba(94,114,228,0.4);
}

.comment-send-button:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(94,114,228,0.3);
}

.comment-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #9ca3af;
  box-shadow: none;
}

/* Icon */
.comment-send-button i {
  margin-right: 8px;
  font-size: 14px;
}

/* Dark mode */
body.night-mode .comment-send-button {
  background: #5e72e4;
  color: white;
}

body.night-mode .comment-send-button:hover {
  background: #4c63d2;
}

body.night-mode .comment-send-button:disabled {
  background: #4a5568;
  opacity: 0.5;
}

/* Show on mobile only */
@media (max-width: 767px) {
  /* Remove any spacing when button is hidden */
  .comment-send-button-container:not(.active) {
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    min-height: 0 !important;
    line-height: 0 !important;
    visibility: hidden;
  }
}

/* iOS specific gap fix */
@supports (-webkit-touch-callout: none) {
  .comment-send-button-container {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  
  .comment-send-button-container:not(.active) {
    display: none !important;
  }
  
  .comment-send-button-container.hiding {
    display: none !important;
  }
}

/* Animation when appearing */
@keyframes slideIn {
  from {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    max-height: 40px;
    margin-top: 8px;
    opacity: 1;
    transform: translateY(0);
  }
}

.comment-send-button-container.active {
  animation: slideIn 0.3s ease-out forwards;
}

/* Animation when disappearing */
@keyframes slideOut {
  from {
    max-height: 40px;
    margin-top: 8px;
    opacity: 1;
    transform: translateY(0);
  }
  to {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
    transform: translateY(-10px);
  }
}

.comment-send-button-container.hiding {
  animation: slideOut 0.2s ease-out forwards;
  max-height: 0;
  margin-top: 0;
}

/* Ensure button is aligned with textarea */
.comment-data {
  position: relative;
}

/* On desktop, keep the original behavior */
@media (min-width: 768px) {
  .comment-send-button-container {
    display: none !important;
  }
}