/**
 * Reusable Components: Buttons, Inputs, Badges, Switches, Cards & Empty States
 * Styled for AJBranch SaaS (Zero-Radius Architectural Cut & Gold Accents)
 */

/* Section Guide Box */
.section-guide-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.section-guide-icon {
  color: var(--accent-gold);
  flex-shrink: 0;
}

/* Card Panel */
.card-panel {
  background-color: var(--bg-card);
  border: var(--border-hairline);
  border-radius: var(--radius-xs);
  padding: 20px;
  box-shadow: var(--elevation-1);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.form-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.form-tag-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  line-height: 1.2;
}

.form-tag-req {
  background: rgba(6, 182, 212, 0.12);
  color: var(--status-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.form-tag-opt {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input, .form-select, .form-textarea {
  height: 40px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-fast);
  width: 100%;
}

.form-input.is-invalid,
.form-input.input-has-error {
  border-color: var(--status-crimson) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
  background-color: var(--bg-card) !important;
}

.form-input.is-valid,
.form-input.input-has-success {
  border-color: var(--status-emerald) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22), 0 0 8px rgba(16, 185, 129, 0.15) !important;
  background-color: var(--bg-card) !important;
}

.form-feedback-error {
  font-size: 11px;
  color: var(--status-crimson);
  font-weight: 600;
  margin-top: 2px;
  display: none;
}

.form-feedback-error.active {
  display: block;
}

.form-field-feedback,
.auth-field-feedback {
  font-size: 11px;
  margin-top: 4px;
  min-height: 15px;
  line-height: 1.35;
  display: none;
}

.form-field-feedback.feedback-error,
.auth-field-feedback.feedback-error {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--status-crimson);
  font-weight: 600;
}

.form-field-feedback.feedback-success,
.auth-field-feedback.feedback-success {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--status-emerald);
  font-weight: 600;
}

.form-textarea {
  height: auto;
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: var(--glow-gold-subtle);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  height: 40px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn-primary {
  background-color: var(--primary-navy);
  color: var(--primary-cream);
  border: 1px solid var(--primary-navy);
}

.btn-primary:hover {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #0b0b0b;
  box-shadow: var(--glow-gold);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-gold {
  background-color: var(--accent-gold);
  color: #0b0b0b;
  border: 1px solid var(--accent-gold);
  font-weight: 700;
}

.btn-gold:hover {
  background-color: var(--accent-gold-hover);
  border-color: var(--accent-gold-hover);
  box-shadow: var(--glow-gold);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-gold);
  color: var(--text-primary);
  box-shadow: var(--glow-gold-subtle);
}

.btn-danger {
  background-color: var(--badge-crimson-bg);
  color: var(--status-crimson);
  border: 1px solid var(--status-crimson);
}

.btn-danger:hover {
  background-color: var(--status-crimson);
  border-color: var(--status-crimson);
  color: #ffffff;
}

.btn-sm {
  padding: 4px 10px;
  height: 32px;
  font-size: 11.5px;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Square Icon Tool Button (32x32px) */
.btn-icon-tool {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-icon-tool:hover {
  background: var(--bg-card);
  color: var(--accent-gold);
  border-color: var(--border-subtle);
  transform: translateY(-1px);
}

.btn-icon-tool.btn-icon-danger:hover {
  background: rgba(244, 63, 94, 0.12);
  color: var(--status-crimson);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-icon-tool svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-cyan {
  background-color: var(--badge-cyan-bg);
  color: var(--status-cyan);
  border: 1px solid var(--status-cyan);
}

.badge-emerald {
  background-color: var(--badge-emerald-bg);
  color: var(--status-emerald);
  border: 1px solid var(--status-emerald);
}

.badge-amber {
  background-color: var(--badge-amber-bg);
  color: var(--status-amber);
  border: 1px solid var(--status-amber);
}

.badge-danger,
.badge-rose {
  background-color: var(--badge-crimson-bg);
  color: var(--status-crimson);
  border: 1px solid var(--status-crimson);
}

.badge-gray {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-gold {
  background-color: var(--accent-gold-light);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
}

/* Toggle Switch Component (Crisp Architectural) */
.switch-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-surface);
  transition: var(--transition-fast);
  border: 1px solid var(--border-subtle);
}

.switch-container:hover .slider {
  border-color: var(--accent-gold);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: var(--transition-fast);
}

input:checked + .slider {
  background-color: var(--bg-sidebar-active);
  border-color: var(--accent-gold);
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: var(--accent-gold);
  box-shadow: 0 0 6px var(--accent-gold);
}

.switch-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.switch-label.active {
  color: var(--accent-gold);
}

/* Empty State Component */
.empty-state-box {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--accent-gold);
  margin-bottom: 12px;
  opacity: 0.85;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.empty-state-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 0 16px 0;
  line-height: 1.45;
}

/* ═══════════════════════════════════════════════════════════════
   NETWORK STATUS BANNER (Zero-Radius Oxford Architectural Standard)
   ═══════════════════════════════════════════════════════════════ */
.network-status-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 38px;
  padding: 6px 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1080;
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 0px !important;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.network-status-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.network-status-banner.is-offline {
  background-color: #1c1917;
  border-bottom: 2px solid var(--status-amber);
  color: var(--status-amber);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.network-status-banner.is-offline .icon-offline {
  display: inline-block;
  color: var(--status-amber);
}

.network-status-banner.is-reconnecting {
  background-color: #1c1917;
  border-bottom: 2px solid var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.network-status-banner.is-reconnecting .icon-reconnecting {
  display: inline-block;
  color: var(--accent-gold);
  animation: network-spin 1s linear infinite;
}

.network-status-banner.is-online {
  background-color: #0f2317;
  border-bottom: 2px solid var(--status-emerald);
  color: var(--status-emerald);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.network-status-banner.is-online .icon-online {
  display: inline-block;
  color: var(--status-emerald);
}

.network-status-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.network-status-icon {
  display: none;
  flex-shrink: 0;
}

.network-status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-network-retry {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px solid var(--status-amber);
  color: var(--status-amber);
  border-radius: 0px !important;
  padding: 4px 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  height: 26px;
  box-sizing: border-box;
}

.btn-network-retry:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: #fef08a;
  color: #fef08a;
}

@keyframes network-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   RADICADO QUICK COPY & VISUAL FEEDBACK FLASH
   ═══════════════════════════════════════════════════════════════ */
.rad-number-display,
.radicado-code,
.log-hit-rad {
  cursor: pointer;
  user-select: all;
  transition: background-color 0.18s ease, color 0.18s ease, outline 0.18s ease;
}

.rad-number-display:hover,
.radicado-code:hover {
  text-decoration: underline dotted var(--accent-gold);
}

.radicado-copied-flash {
  background-color: rgba(74, 222, 128, 0.25) !important;
  color: var(--status-emerald) !important;
  outline: 1px solid var(--status-emerald);
}

/* ═══════════════════════════════════════════════════════════════
   PWA INSTALL BUTTON (Sidebar & Mobile Header)
   ═══════════════════════════════════════════════════════════════ */
.sidebar-install-pwa-btn {
  margin-bottom: 8px;
  border-color: rgba(201, 162, 39, 0.45) !important;
  color: var(--accent-gold) !important;
  background: rgba(201, 162, 39, 0.08) !important;
}

.sidebar-install-pwa-btn:hover {
  background: rgba(201, 162, 39, 0.2) !important;
  border-color: var(--accent-gold) !important;
  color: #ffffff !important;
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.3);
}

