/* shared/neumorphic.css
 *
 * Companion CSS for utilities Tailwind's arbitrary-value syntax can't
 * express cleanly. Loaded AFTER Tailwind CDN so .neu-* rules cascade.
 *
 * See plan §8.3, §8.5, §8.6.
 */

/* ============================================================ */
/* 1. Focus-visible fallback                                    */
/* For elements that can't carry shadow-neu-accent (raw <a>     */
/* text links, etc.). Component-specific styles override.       */
/* ============================================================ */

:focus-visible {
  outline: 2px solid #4F46E5;
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none; /* components provide their own ring via shadow-neu-accent */
}

/* ============================================================ */
/* 2. Inputs — combined inset + purple accent on focus          */
/* ============================================================ */

.neu-input {
  transition: box-shadow 150ms ease-out;
}

.neu-input:focus {
  outline: none;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40),
    0 0 0 3px rgba(79,70,229,0.20);
}

html.dark .neu-input:focus {
  box-shadow:
    inset -2px -2px 4px rgba(108,99,184,0.15),
    inset  3px  3px 6px rgba(0,0,0,0.50),
    0 0 0 3px rgba(99,102,241,0.35);
}

/* Sharp red override for invalid inputs (form validation). */
.neu-input[aria-invalid="true"] {
  box-shadow: none;
  background-color: #ECEAF3;
  border: 1.5px solid #DC2626;
}

.neu-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,0.20);
  border-color: #DC2626;
}

html.dark .neu-input[aria-invalid="true"] {
  background-color: #221F31;
  border-color: #F87171;
}

html.dark .neu-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(248,113,113,0.30);
  border-color: #F87171;
}

/* ============================================================ */
/* 3. Select — custom dropdown arrow                            */
/* ============================================================ */

.neu-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%237A7591' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 8 10 13 15 8'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}

html.dark .neu-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23B8B3CC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 8 10 13 15 8'/></svg>");
}

/* ============================================================ */
/* 4. Checkbox — custom shape                                   */
/* ============================================================ */

.neu-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background-color: #DFDBE9;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40);
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
  position: relative;
  flex-shrink: 0;
  margin: 0;
}

.neu-checkbox:focus-visible {
  outline: none;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40),
    0 0 0 3px rgba(79,70,229,0.20);
}

.neu-checkbox:checked {
  background-color: #4F46E5;
  box-shadow:
    -2px -2px 4px rgba(255,255,255,0.85),
     3px  3px 6px rgba(79,70,229,0.30);
}

.neu-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #F5F4FB;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.neu-checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

html.dark .neu-checkbox {
  background-color: #14121C;
  box-shadow:
    inset -2px -2px 4px rgba(108,99,184,0.15),
    inset  3px  3px 6px rgba(0,0,0,0.50);
}

html.dark .neu-checkbox:checked {
  background-color: #6366F1;
  box-shadow:
    -2px -2px 4px rgba(108,99,184,0.22),
     3px  3px 6px rgba(0,0,0,0.50);
}

/* ============================================================ */
/* 5. Radio — custom shape                                      */
/* ============================================================ */

.neu-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #DFDBE9;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40);
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
  position: relative;
  flex-shrink: 0;
  margin: 0;
}

.neu-radio:focus-visible {
  outline: none;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40),
    0 0 0 3px rgba(79,70,229,0.20);
}

.neu-radio:checked {
  background-color: #4F46E5;
  box-shadow:
    -2px -2px 4px rgba(255,255,255,0.85),
     3px  3px 6px rgba(79,70,229,0.30);
}

.neu-radio:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #F5F4FB;
}

.neu-radio:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

html.dark .neu-radio {
  background-color: #14121C;
  box-shadow:
    inset -2px -2px 4px rgba(108,99,184,0.15),
    inset  3px  3px 6px rgba(0,0,0,0.50);
}

html.dark .neu-radio:checked {
  background-color: #6366F1;
  box-shadow:
    -2px -2px 4px rgba(108,99,184,0.22),
     3px  3px 6px rgba(0,0,0,0.50);
}

/* ============================================================ */
/* 6. Switch — pill toggle                                      */
/* Markup: <label class="neu-switch"><input type="checkbox"/><span></span></label> */
/* ============================================================ */

.neu-switch {
  display: inline-block;
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}

.neu-switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background-color: #DFDBE9;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40);
  transition: background-color 200ms ease;
  margin: 0;
  cursor: pointer;
}

.neu-switch input:focus-visible {
  outline: none;
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.80),
    inset  3px  3px 6px rgba(166,160,200,0.40),
    0 0 0 3px rgba(79,70,229,0.20);
}

.neu-switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #ECEAF3;
  box-shadow:
    -2px -2px 4px rgba(255,255,255,0.85),
     2px  2px 4px rgba(166,160,200,0.40);
  transition: left 200ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.neu-switch input:checked { background-color: #4F46E5; }
.neu-switch input:checked + span { left: 22px; }
.neu-switch input:disabled { opacity: 0.5; cursor: not-allowed; }

html.dark .neu-switch input {
  background-color: #14121C;
  box-shadow:
    inset -2px -2px 4px rgba(108,99,184,0.15),
    inset  3px  3px 6px rgba(0,0,0,0.50);
}

html.dark .neu-switch input:checked { background-color: #6366F1; }

html.dark .neu-switch span {
  background-color: #221F31;
  box-shadow:
    -2px -2px 4px rgba(108,99,184,0.20),
     2px  2px 4px rgba(0,0,0,0.50);
}

/* ============================================================ */
/* 7. Sidebar nav — active-item left bar                        */
/* Apply `.neu-nav-active` to the active sidebar item.          */
/* ============================================================ */

.neu-nav-active {
  position: relative;
}

.neu-nav-active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 2px;
  background: linear-gradient(180deg, #6366F1 0%, #4F46E5 100%);
}

html.dark .neu-nav-active::before {
  background: linear-gradient(180deg, #A5A7F7 0%, #6366F1 100%);
}

/* ============================================================ */
/* 8. Skeleton shimmer                                          */
/* Apply `.neu-shimmer` to any sunken element to animate it.    */
/* ============================================================ */

.neu-shimmer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.neu-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.55) 50%,
    rgba(255,255,255,0) 100%
  );
  transform: translateX(-100%);
  animation: neu-shimmer-sweep 1.4s ease-in-out infinite;
}

html.dark .neu-shimmer::after {
  background: linear-gradient(
    90deg,
    rgba(108,99,184,0) 0%,
    rgba(108,99,184,0.20) 50%,
    rgba(108,99,184,0) 100%
  );
}

@keyframes neu-shimmer-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================ */
/* 9. Modal entrance animations                                 */
/* Carried over from Mascot Studio.                             */
/* ============================================================ */

.modal-backdrop { animation: backdrop-in 180ms ease-out; }
.modal-card     { animation: modal-in 220ms cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================ */
/* 10. Toast slide animations                                   */
/* Carried over from Mascot Studio.                             */
/* ============================================================ */

.toast-item               { pointer-events: auto; animation: toast-in 220ms cubic-bezier(0.16, 1, 0.3, 1); }
.toast-item.is-leaving    { animation: toast-out 180ms ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translate(8px, 4px); }
  to   { opacity: 1; transform: translate(0, 0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translate(0, 0); }
  to   { opacity: 0; transform: translate(8px, 4px); }
}

/* ============================================================ */
/* 11. Thin webkit scrollbar — carried over from GEO            */
/* ============================================================ */

.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #C3C5FB; border-radius: 3px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }

html.dark .scrollbar-thin::-webkit-scrollbar-thumb { background: #3730A3; }

/* ============================================================ */
/* 12. Misc resets                                              */
/* ============================================================ */

/* Hide default <details> marker. */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* Reduced motion — disable shimmer + entrance animations. */
@media (prefers-reduced-motion: reduce) {
  .neu-shimmer::after,
  .modal-backdrop,
  .modal-card,
  .toast-item,
  .toast-item.is-leaving {
    animation: none;
  }
}
