/* ============================================================
   CISCO Website — Custom Form Controls & Interaction Polish
   Phase 1: Creative alternatives to native browser defaults
   ============================================================ */

/* ============================================================
   1. CUSTOM <select> DROPDOWN
   Replaces the native arrow with a branded SVG chevron.
   The open listbox is styled where the browser permits.
   ============================================================ */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  /* Custom chevron (SVG data URI) — replaces native arrow */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a6fb5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 16px;

  /* Room for the chevron so text never overlaps it */
  padding-right: 2.6rem !important;
}

/* Dropdown listbox (works in Firefox / some Chromium builds) */
select option {
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  padding: 0.5rem 0.75rem;
}

select option:checked {
  background: var(--cisco-blue-light);
  color: var(--cisco-blue-dark);
}

select option:hover {
  background: var(--cisco-blue-soft);
}

/* ============================================================
   2. TEXT INPUTS & TEXTAREA
   Inline focus glow, autofill override, placeholder polish.
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition),
              background var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

/* Focus: soft glow ring instead of default outline */
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--cisco-blue);
  box-shadow: 0 0 0 4px var(--cisco-blue-light), 0 0 0 1px var(--cisco-blue);
}

/* Autofill: override the harsh yellow/blue native fill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--text-primary);
  transition: background-color 9999s ease-in-out 0s;
}

/* Textarea: subtle resize handle + taller default */
textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

/* ============================================================
   3. BUTTONS — focus ring + press feedback
   ============================================================ */
button {
  font-family: var(--font-body);
}

/* Accessible keyboard focus ring (never removed, only enhanced) */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--cisco-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Press feedback: subtle scale-down for tactile feel */
.btn:active,
.filter-btn:active,
.modal__close:active,
.logout-btn:active {
  transform: scale(0.97);
}

/* ============================================================
   4. CUSTOM CHECKBOX & RADIO
   Branded controls ready for future admin forms.
   ============================================================ */
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background var(--transition), border-color var(--transition);
  vertical-align: middle;
}

input[type="checkbox"] {
  border-radius: 6px;
}

input[type="radio"] {
  border-radius: 50%;
}

/* Checkmark / dot via pseudo-element */
input[type="checkbox"]::before,
input[type="radio"]::before {
  content: "";
  width: 12px;
  height: 12px;
  transform: scale(0);
  transition: transform 0.15s ease;
}

input[type="checkbox"]::before {
  background: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

input[type="radio"]::before {
  border-radius: 50%;
  background: #ffffff;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--cisco-blue);
  border-color: var(--cisco-blue);
}

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--cisco-blue);
}

/* ============================================================
   5. GLOBAL SCROLLBAR — branded, subtle
   ============================================================ */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--surface-alt);
}

::-webkit-scrollbar-thumb {
  background: var(--cisco-blue-soft);
  border-radius: 8px;
  border: 3px solid var(--surface-alt);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--cisco-blue);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--cisco-blue-soft) var(--surface-alt);
}

/* ============================================================
   6. TEXT SELECTION — branded highlight
   ============================================================ */
::selection {
  background: var(--cisco-blue);
  color: #ffffff;
}

/* ============================================================
   7. LINKS — underline reveal on hover (soft, no jarring)
   ============================================================ */
.breadcrumb a,
.back-link,
.learn-more,
.footer-links a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--transition), color var(--transition);
}

.breadcrumb a:hover,
.back-link:hover,
.learn-more:hover,
.footer-links a:hover {
  background-size: 100% 2px;
}

/* ============================================================
   8. DETAILS / SUMMARY — collapsible "Learn More"
   ============================================================ */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

details[open] {
  box-shadow: var(--shadow-card);
}

details summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.2rem;
  font-weight: 600;
  color: var(--cisco-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  user-select: none;
}

/* Remove the native disclosure triangle in all browsers */
details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1;
  color: var(--cisco-blue);
  transition: transform var(--transition);
}

details[open] summary::after {
  content: "−";
}

details .details-body {
  padding: 0 1.2rem 1.2rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}
