/* ================================================================================
   SEND BUTTON - Glass Effect Component (Version Améliorée)
   ================================================================================

   Bouton d'envoi avec effet glassmorphique amélioré
   Compatible light/dark mode avec effets de profondeur

   États :
   - Normal : Flèche vers le haut (envoi)
   - Stop mode : Carré dans un cercle (arrêt)
   - Disabled : Opacité réduite
   - Hover : Effet glass intensifié avec animations

   Tailles :
   - Small : 28px x 28px
   - Medium : 36px x 36px (défaut)
   - Large : 44px x 44px

   ================================================================================ */

/* ========================================
   VARIABLES CSS - Angles d'animation
   ======================================== */

@property --send-angle-1 {
  syntax: "<angle>";
  inherits: false;
  initial-value: -75deg;
}

@property --send-angle-2 {
  syntax: "<angle>";
  inherits: false;
  initial-value: -45deg;
}

/* ========================================
   BOUTON PRINCIPAL
   ======================================== */

.send-button {
  --border-width: 1.5px;
  all: unset;
  cursor: pointer;
  position: relative;
  pointer-events: auto;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1);

  /* Taille par défaut (medium) */
  width: 36px;
  height: 36px;
  border-radius: 50%;

  /* Light Mode - Background & Effects */
  background: linear-gradient(
    -75deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.05)
  );
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);

  /* Light Mode - Multi-layer Box Shadow */
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.05),
    inset 0 -2px 2px rgba(255, 255, 255, 0.5),
    0 4px 2px -2px rgba(0, 0, 0, 0.2),
    0 0 1.6px 4px inset rgba(255, 255, 255, 0.2),
    0 0 0 0 rgba(255, 255, 255, 1);
}

.send-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* ========================================
   ICÔNE (Flèche ou Stop)
   ======================================== */

.send-button i {
  position: relative;
  z-index: 2;
  font-size: 16px;
  color: #323232;
  text-shadow: 0 0.05em 0.05em rgba(0, 0, 0, 0.05);
  transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1);
}

/* ========================================
   EFFET DE BRILLANCE INTERNE (::before)
   ======================================== */

.send-button::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: calc(100% - var(--border-width));
  height: calc(100% - var(--border-width));
  top: calc(var(--border-width) / 2);
  left: calc(var(--border-width) / 2);
  box-sizing: border-box;
  border-radius: inherit;
  background: linear-gradient(
    var(--send-angle-2),
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 40% 50%,
    rgba(255, 255, 255, 0) 55%
  );
  background-size: 200% 200%;
  background-position: 0% 50%;
  background-repeat: no-repeat;
  mix-blend-mode: overlay;
  pointer-events: none;
  overflow: clip;
  transition: background-position 500ms cubic-bezier(0.25, 1, 0.5, 1);
}

/* ========================================
   BORDURE AVEC DÉGRADÉ CONIQUE (::after)
   ======================================== */

.send-button::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  width: calc(100% + var(--border-width));
  height: calc(100% + var(--border-width));
  top: calc(0% - var(--border-width) / 2);
  left: calc(0% - var(--border-width) / 2);
  padding: var(--border-width);
  box-sizing: border-box;
  border-radius: inherit;
  background: conic-gradient(
      from var(--send-angle-1) at 50% 50%,
      rgba(80, 80, 80, 0.5),
      rgba(200, 200, 200, 0.1) 5% 40%,
      rgba(80, 80, 80, 0.5) 50%,
      rgba(200, 200, 200, 0.1) 60% 95%,
      rgba(80, 80, 80, 0.5)
    ),
    linear-gradient(180deg, rgba(255, 252, 245, 0.9), rgba(255, 252, 245, 0.7));
  box-shadow: inset 0 0 0 calc(var(--border-width) / 2) rgba(255, 252, 245, 0.9);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1);
}

/* ========================================
   ÉTAT HOVER
   ======================================== */

.send-button:hover {
  transform: scale(0.975);
  background: linear-gradient(
    -75deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.05)
  );
  backdrop-filter: blur(0.16px);
  -webkit-backdrop-filter: blur(0.16px);
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.05),
    inset 0 -2px 2px rgba(255, 255, 255, 0.5),
    0 2.4px 0.8px -1.6px rgba(0, 0, 0, 0.25),
    0 0 0.8px 1.6px inset rgba(255, 255, 255, 0.5),
    0 0 0 0 rgba(255, 255, 255, 1);
}

.send-button:hover::before {
  background-position: 25% 50%;
}

.send-button:hover::after {
  --send-angle-1: -125deg;
}

.send-button:hover i {
  text-shadow: 0.025em 0.025em 0.025em rgba(0, 0, 0, 0.06);
}

/* ========================================
   ÉTAT ACTIVE (Pressé)
   ======================================== */

.send-button:active {
  transform: scale(0.95);
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.05),
    inset 0 -2px 2px rgba(255, 255, 255, 0.5),
    0 2px 2px -2px rgba(0, 0, 0, 0.2),
    0 0 1.6px 4px inset rgba(255, 255, 255, 0.2),
    0 3.6px 0.8px 0 rgba(0, 0, 0, 0.05),
    0 4px 0 0 rgba(255, 255, 255, 0.75),
    inset 0 4px 0.8px 0 rgba(0, 0, 0, 0.15);
}

.send-button:active::before {
  --send-angle-2: -15deg;
  background-position: 50% 15%;
}

.send-button:active::after {
  --send-angle-1: -75deg;
}

.send-button:active i {
  text-shadow: 0.025em 0.25em 0.05em rgba(0, 0, 0, 0.12);
}

.send-button:focus {
  outline: none;
}

/* ========================================
   STOP MODE - Carré dans un cercle
   ======================================== */

.send-button.stop-mode i {
  font-size: 10px;
}

.send-button.stop-mode i::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  background: transparent;
  border: 2px solid #323232;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   TAILLES - Small, Medium, Large
   ======================================== */

/* Small - 28px x 28px */
.send-button--small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.send-button--small i {
  font-size: 14px;
}

.send-button--small.stop-mode i {
  font-size: 8px;
}

.send-button--small.stop-mode i::after {
  width: 18px;
  height: 18px;
  border-width: 1.5px;
}

/* Medium - 36px x 36px (défaut) */
.send-button--medium {
  width: 36px;
  height: 36px;
}

.send-button--medium i {
  font-size: 16px;
}

.send-button--medium.stop-mode i {
  font-size: 10px;
}

.send-button--medium.stop-mode i::after {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

/* Large - 44px x 44px */
.send-button--large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.send-button--large i {
  font-size: 20px;
}

.send-button--large.stop-mode i {
  font-size: 12px;
}

.send-button--large.stop-mode i::after {
  width: 26px;
  height: 26px;
  border-width: 2px;
}

/* ========================================
   DARK MODE
   ======================================== */

[data-theme="dark"] .send-button {
  background: linear-gradient(
    -75deg,
    rgba(0, 0, 0, 0.45),
    rgba(0, 0, 0, 0.25),
    rgba(0, 0, 0, 0.45)
  );
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.08),
    inset 0 -2px 2px rgba(0, 0, 0, 0.5),
    0 4px 2px -2px rgba(0, 0, 0, 0.4),
    0 0 1.6px 4px inset rgba(255, 255, 255, 0.1),
    0 0 0 0 rgba(255, 255, 255, 1);
}

[data-theme="dark"] .send-button i {
  color: #ffffff;
  text-shadow: 0 0.05em 0.05em rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .send-button::before {
  opacity: 0.3;
}

[data-theme="dark"] .send-button::after {
  background: conic-gradient(
      from var(--send-angle-1) at 50% 50%,
      rgba(0, 0, 0, 0.5),
      rgba(0, 0, 0, 0) 5% 40%,
      rgba(0, 0, 0, 0.5) 50%,
      rgba(0, 0, 0, 0) 60% 95%,
      rgba(0, 0, 0, 0.5)
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5));
  box-shadow: inset 0 0 0 calc(var(--border-width) / 2) rgba(255, 255, 255, 0.5);
}

/* Dark Mode - Hover */
[data-theme="dark"] .send-button:hover {
  background: linear-gradient(
    -75deg,
    rgba(0, 0, 0, 0.5),
    rgba(0, 0, 0, 0.3),
    rgba(0, 0, 0, 0.5)
  );
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.08),
    inset 0 -2px 2px rgba(0, 0, 0, 0.5),
    0 2.4px 0.8px -1.6px rgba(0, 0, 0, 0.5),
    0 0 0.8px 1.6px inset rgba(255, 255, 255, 0.15),
    0 0 0 0 rgba(255, 255, 255, 1);
}

[data-theme="dark"] .send-button:hover i {
  text-shadow: 0.025em 0.025em 0.025em rgba(0, 0, 0, 0.4);
}

/* Dark Mode - Active */
[data-theme="dark"] .send-button:active {
  box-shadow:
    inset 0 2px 2px rgba(0, 0, 0, 0.4),
    inset 0 -2px 2px rgba(255, 255, 255, 0.1),
    0 2px 2px -2px rgba(0, 0, 0, 0.4),
    0 0 1.6px 4px inset rgba(255, 255, 255, 0.1),
    0 3.6px 0.8px 0 rgba(0, 0, 0, 0.15),
    0 4px 0 0 rgba(255, 255, 255, 0.1),
    inset 0 4px 0.8px 0 rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .send-button:active i {
  text-shadow: 0.025em 0.25em 0.05em rgba(0, 0, 0, 0.6);
}

/* Dark Mode - Stop mode */
[data-theme="dark"] .send-button.stop-mode i::after {
  border-color: #ffffff;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .send-button:not(.send-button--small):not(.send-button--large) {
    width: 32px;
    height: 32px;
  }

  .send-button i {
    font-size: 14px;
  }

  .send-button.stop-mode i {
    font-size: 9px;
  }

  .send-button.stop-mode i::after {
    width: 20px;
    height: 20px;
  }
}

/* ========================================
   APPAREILS TACTILES
   ======================================== */

@media (hover: none) and (pointer: coarse) {
  .send-button::before,
  .send-button:active::before {
    --send-angle-2: -45deg;
  }

  .send-button::after,
  .send-button:hover::after,
  .send-button:active::after {
    --send-angle-1: -75deg;
  }
}

/* ========================================
   ANIMATIONS (Utilitaires)
   ======================================== */

@keyframes sendButtonFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.send-button.fade-in {
  animation: sendButtonFadeIn 0.2s ease-out;
}

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

.send-button.pulse {
  animation: sendButtonPulse 1.5s ease-in-out infinite;
}
