/*========================================
  04-COMPONENTS.CSS
  Componenti riusabili: Bottoni, Badge, Pills, Alert
==========================================*/

/*========================================
  BOTTONI
==========================================*/

/* Base */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 45px !important;
  text-decoration: none;
  text-align: center;
  color: var(--white) !important;
}

a.btn,
a.btn:hover,
a.btn:focus {
  text-decoration: none !important;
}

/* Varianti colore */
.btn-primary {
  background: var(--primary-500);
  color: var(--white);
}
.btn-primary:link,
.btn-primary:visited {
  color: var(--white) !important;
}
.btn-primary:hover {
  background: var(--primary-700) !important;
}

.btn-secondary {
  background: var(--secondary-500);
}
.btn-secondary:hover {
  background: var(--secondary-700);
}

.btn-danger {
  background: var(--danger-500);
}
.btn-danger:hover {
  background: var(--danger-700);
}

.btn-success {
  background: var(--success-500);
}
.btn-success:hover {
  background: var(--success-700);
}

.btn-warning {
  background: var(--warning-500);
  color: var(--black);
}
.btn-warning:hover {
  background: var(--warning-700);
}

.btn-legacy {
  background: var(--purple-500);
}
.btn-legacy:hover {
  background: var(--purple-700);
}

.btn-admin {
  background: var(--black);
}
.btn-admin:hover {
  background: var(--secondary-700);
}

/* Stato disabled */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(20%);
}

/* Varianti dimensione */
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  line-height: 12px;
  min-width: 42px;
  text-align: center;
}

.btn-lg {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  font-size: 1.1rem;
  line-height: 1.2;
}

/* Varianti speciali */
.btn-back {
  background: var(--brown-500);
  color: var(--text);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius);
  font-weight: bold;
  text-decoration: none;
  border: 1px solid var(--brown-900);
}
.btn-back:hover {
  background: var(--brown-300);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--black);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  font-size: 8px;
  line-height: 1;
}

.btn-download-icon {
  background-color: var(--ready64-blue-light);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  min-width: auto;
  gap: 0;
  font-size: 1.2em !important;
  line-height: 8px;
}

.btn-download-text {
  background-color: var(--ready64-blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-left: 1px solid var(--black);
  font-weight: 500;
  font-family: "Commodore64", "Consolas", "Monaco", "Liberation Mono",
    "Courier New", monospace;
}

.btn-download:hover .btn-download-icon {
  background-color: #9c8df0;
}
.btn-download:hover .btn-download-text {
  background-color: #5a49c8;
}
.btn-download:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.r64-refresh-btn {
  background: var(--brown-500);
  color: var(--tan);
  border: 1px solid var(--black);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.r64-refresh-btn:hover {
  background: var(--brown-300);
  color: var(--white);
}
.r64-refresh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/*========================================
  BADGE
==========================================*/

/* Base */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px !important;
  border-radius: 4px;
  font-weight: bold;
  color: var(--white);
  text-decoration: none;
  min-width: 60px !important;
  margin-bottom: 2px;
  gap: 3px;
  line-height: 1.5em;
  font-size: 0.8em;
  height: auto;
}

/* Varianti colore */
.badge--primary {
  background: var(--primary-700);
}

.badge--secondary {
  background: var(--secondary-700);
}

.badge--success {
  background: var(--success-700);
}

.badge--danger {
  background: var(--danger-500);
}

.badge--warning {
  background: var(--warning-500);
  color: var(--black);
}

.badge--legacy {
  background: var(--purple-500);
}

.badge--dark {
  background: var(--brown-300);
}

.badge--info {
  background: var(--info-500);
}

/* Varianti speciali */
.badge--bug {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 40px;
  padding: 0;
  font-size: 16px;
  background: var(--brown-900);
  color: var(--bug-icon-color, #fbbc04);
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  text-decoration: none;
  line-height: 1;
}

.badge--bug .fa,
.badge--bug i {
  color: var(--brown-700);
  display: inline-block;
  font-size: 2em;
  line-height: 1;
  width: auto;
  height: auto;
  transition: color 140ms ease, transform 140ms ease;
}

.badge--bug .fa::before,
.badge--bug i::before {
  color: inherit !important;
}

.badge--bug:hover,
.badge--bug:focus {
  background: var(--brown-700);
  color: var(--bug-icon-hover-color, #fbbc04);
  text-decoration: none;
}

.badge--bug:hover .fa,
.badge--bug:focus .fa,
.badge--bug:hover i,
.badge--bug:focus i,
.badge--bug:hover .fa::before,
.badge--bug:focus .fa::before {
  color: var(--bug-icon-hover-color, #fbbc04) !important;
  transform: none;
}

.badge--admin {
  background: var(--brown-900);
  border: 1px solid var(--brown-300);
  box-shadow: 2px 2px var(--black);
  padding: 1px 2px;
}

.badge--glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px) saturate(140%);
  padding: 4px 10px !important;
  word-spacing: 2px;
  margin: 0 5px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.15),
    inset 0 0 4px rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

/*========================================
  PILLS
==========================================*/

/* Container */
.pills-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Base */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.5625rem;
  color: var(--text);
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  user-select: none;
  overflow: visible;
}

.pill a {
  text-decoration: none;
  color: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.pill:hover,
.pill:focus-within {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.pill:active {
  transform: translateY(-1px) scale(0.995);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Variante small */
.pill--sm {
  width: 14px;
  height: 14px;
  padding: 2px;
  border-radius: 50%;
  font-size: 11px;
  min-width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Varianti colore */
.pill--neutral {
  background: var(--tan);
  color: var(--brown-900);
}

.pill--info {
  background: var(--primary-500) !important;
  color: var(--white);
}

.pill--danger {
  background: var(--danger-500);
}

.pill--success {
  background: var(--success-500);
}

.pill--warning {
  background: var(--warning-500);
}

.pill--admin {
  background: var(--black) !important;
  color: var(--white);
}

.pill--sm.pill--admin {
  background: var(--admin-bg, #2d2d2d);
  color: var(--admin-fg, #fff);
}

/*========================================
  ALERT
==========================================*/

/* Base */
.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  color: var(--white);
}

.alert a {
  text-decoration: none !important;
  opacity: 0.7;
}

/* Varianti colore */
.alert-primary {
  background: var(--primary-500);
  border: 1px solid var(--primary-700);
}

.alert-secondary {
  background: var(--brown-700);
  border: 1px solid var(--brown-500);
}

.alert-success {
  background: var(--success-500);
  border: 1px solid var(--success-700);
  color: var(--white);
}

.alert-warning {
  background: var(--warning-500);
  border: 1px solid var(--warning-700);
  color: var(--black);
}

.alert-danger {
  background: var(--danger-500);
  border: 1px solid var(--danger-700);
}

.alert-info {
  background: var(--info-500);
  border: 1px solid var(--info-700);
}

.alert-admin {
  background-color: var(--secondary-700);
  color: var(--white);
  border: 1px solid var(--warning-500);
}

/* Link negli alert */
.alert a {
  color: var(--white) !important;
  text-decoration: underline;
  font-weight: 500;
}

.alert a:hover {
  text-decoration: none;
  opacity: 0.85;
}
/*========================================
Ready64 CSS v4.0 - Components (AGGIUNTE)
Questi componenti vanno AGGIUNTI a 04-components.css esistente
==========================================*/

/* ================================================= */
/* CALLOUT                                           */
/* ================================================= */
.callout {
  display: block;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 4px;
  background-color: var(--brown-500);
  border: 1px solid var(--tan);
  color: var(--tan);
  font-size: 0.9em;
  line-height: 1.5;
  margin: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ================================================= */
/* R64-ACCORDION                                     */
/* ================================================= */
.r64-accordion {
  display: block;
  list-style: none; 
}

.r64-accordion summary {
  cursor: pointer;
  color: var(--tan);
  text-decoration: none;
  list-style: none; 
  display: block;
}

.r64-accordion summary:hover {
  color: inherit;
}

.r64-accordion summary::-webkit-details-marker {
  display: none;
}

.r64-accordion-content {
  margin: 10px 0 10px 0;
  background: var(--brown-700);
  padding: 10px;
  color: var(--white);
  border: 1px solid var(--brown-300);
}

/* ================================================= */
/* TOOLTIP                                           */
/* ================================================= */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: black;
  color: var(--white);
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 100%;
  left: 50%;
  margin-left: -60px;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}

/* ================================================= */
/* STATUS DOT                                        */
/* ================================================= */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.status-dot.red {
  background: var(--danger-300);
  border: 1px solid var(--danger-700);
}

.status-dot.yellow {
  background: var(--warning-300);
  border: 1px solid var(--warning-700);
}

.status-dot.green {
  background: var(--success-300);
  border: 1px solid var(--success-700);
}

.status-dot.white {
  background: var(--white);
  border: 1px solid var(--gray-200);
}

/* ================================================= */
/* HIGHLIGHT RESULT                                  */
/* ================================================= */
.highlight-result {
  background-color: gold;
  color: var(--danger);
  border-radius: 4px;
  padding: 2px;
}

/* ================================================= */
/* BANDIERA LINGUA                                   */
/* ================================================= */
.bandiera-lingua {
  border: 1px solid var(--gray-200);
  width: 14px;
  height: 12px;
  margin: 0 2px 5px 0;
}

/* ================================================= */
/* R64-AVATAR                                        */
/* ================================================= */
.r64-avatar img {
  object-fit: cover;
  border-radius: 50%;
  aspect-ratio: 1 / 1; 
  width: 64px !important;
  height: 64px !important; 
  border: 3px solid #b2a293;
  box-shadow: 3px 3px 3px #000000;
  flex-shrink: 0;
}

/* ================================================= */
/* TAG SYSTEM                                        */
/* ================================================= */
a.tag {
  display: inline-flex;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  margin: 0 0 2px 0;
  line-height: 12px;
}

a.tag:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  opacity: 0.8;
}

.tag-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  border: 0 !important;
}

.tag-text {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  font-size:11px;
}

/* Tag Extras */
.tag-extras {
  border: 1px solid var(--black);
}

.tag-extras .tag-icon {
  background-color: var(--ready64-blue-light);
  color: white;
}

.tag-extras .tag-text {
  background-color: var(--ready64-blue);
  color: white;
  border-left: 1px solid #000;
}

/* Tag Giochi */
.tag-giochi {
  border: 1px solid var(--brown-900);
}

.tag-giochi .tag-icon {
  background-color: var(--brown-900);
  color: white;
}

.tag-giochi .tag-text {
  background-color: var(--tan);
  color: var(--brown-900);
  border-left: 1px solid var(--brown-900);
}

/* ================================================= */
/* LOADER                                            */
/* ================================================= */
.loader {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border: 4px solid rgba(178, 162, 147, 0.2);
  border-top: 4px solid var(--tan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-wrapper {
  text-align: center;
  padding: 40px;
}

.loader-wrapper p {
  margin: 0;
  color: var(--tan);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
