/* =========================================
   BASE.CSS - Stili base comuni a tutte le pagine
   ========================================= */

/* =========================================
   1. CSS RESET MODERNO
   ========================================= */

/* Box sizing border-box per tutti gli elementi */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reset margin e padding */
* {
  margin: 0;
  padding: 0;
}

/* Reset liste */
ul,
ol {
  list-style: none;
}

/* Immagini e video responsive per default */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Rimuovi stili default da input e button */
input,
button,
textarea,
select {
  font: inherit;
}

/* Previeni overflow del testo */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* =========================================
   2. BODY BASE STYLES
   ========================================= */

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-system);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* =========================================
   3. CONTAINER CLASS
   ========================================= */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Container varianti */
.container-fluid {
  width: 100%;
  padding: 0 20px;
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================
   4. TYPOGRAPHY BASE
   ========================================= */

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
}

h3 {
  font-size: 1.75rem;
  font-weight: 700;
}

h4 {
  font-size: 1.5rem;
  font-weight: 600;
}

h5 {
  font-size: 1.25rem;
  font-weight: 600;
}

h6 {
  font-size: 1rem;
  font-weight: 600;
}

/* Paragrafi */
p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

/* Links */
a {
  color: var(--primary-red);
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover:not(.btn):not(.btn-primary):not(.btn-secondary):not(.btn-ghost):not(.btn-outline):not([class*="btn-"]):not([class*="cta-"]) {
  color: var(--primary-red-dark);
  text-decoration: underline;
}

/* Reset per tutti i pulsanti link */
a.btn,
a.btn-primary,
a.btn-secondary,
a.btn-ghost,
a.btn-outline,
a[class*="btn-"],
a[class*="cta-"] {
  text-decoration: none !important;
}

a.btn:hover,
a.btn-primary:hover,
a.btn-secondary:hover,
a.btn-ghost:hover,
a.btn-outline:hover,
a[class*="btn-"]:hover,
a[class*="cta-"]:hover {
  text-decoration: none !important;
}

a:focus-visible {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Strong e emphasis */
strong,
b {
  font-weight: 700;
}

em,
i {
  font-style: italic;
}

/* Small text */
small {
  font-size: 0.875rem;
}

/* =========================================
   5. BUTTON BASE
   ========================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  user-select: none;
  background: transparent;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
}

/* Button sizes */
.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.125rem;
}

/* =========================================
   6. BUTTON VARIANTS
   ========================================= */

/* Primary button - Rosso ATTAL */
.btn-primary {
  background: var(--primary-red);
  color: var(--text-white);
  border-color: var(--primary-red);
}

.btn-primary:hover {
  background: var(--primary-red-dark);
  border-color: var(--primary-red-dark);
  color: var(--text-white);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

/* Secondary button - Outline */
.btn-secondary {
  background: transparent;
  color: var(--primary-red);
  border-color: var(--primary-red);
}

.btn-secondary:hover {
  background: var(--primary-red);
  color: var(--text-white);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Ghost button - Trasparente */
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--primary-red);
  text-decoration: none;
}

.btn-ghost:active {
  background: var(--bg-tertiary);
}

/* =========================================
   7. FORM ELEMENTS BASE
   ========================================= */

/*
 * NOTA: Gli stili specifici degli input sono definiti
 * nei CSS delle singole pagine per evitare conflitti.
 * Qui manteniamo solo stili minimali.
 */

/* Checkbox e radio */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: 0.5rem;
  cursor: pointer;
}

/* =========================================
   8. UTILITY CLASSES
   ========================================= */

/* Visually hidden - accessibilità */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Text alignment */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Text colors */
.text-primary {
  color: var(--primary-red);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-tertiary);
}

.text-white {
  color: var(--text-white);
}

/* Display utilities */
.d-block {
  display: block;
}

.d-inline-block {
  display: inline-block;
}

.d-flex {
  display: flex;
}

.d-inline-flex {
  display: inline-flex;
}

.d-none {
  display: none;
}

/* Flex utilities */
.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.align-items-center {
  align-items: center;
}

.justify-content-center {
  justify-content: center;
}

.justify-content-between {
  justify-content: space-between;
}

/* Spacing utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.pt-1 { padding-top: 0.5rem; }
.pt-2 { padding-top: 1rem; }
.pt-3 { padding-top: 1.5rem; }
.pt-4 { padding-top: 2rem; }

.pb-1 { padding-bottom: 0.5rem; }
.pb-2 { padding-bottom: 1rem; }
.pb-3 { padding-bottom: 1.5rem; }
.pb-4 { padding-bottom: 2rem; }

/* Gap utilities */
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* =========================================
   9. HEADER PLACEHOLDER STICKY FIX
   ========================================= */

#header-placeholder {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

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

/* Tablet - 768px */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  h4 {
    font-size: 1.25rem;
  }

  .container {
    padding: 0 16px;
  }
}

/* Mobile - 480px */
@media (max-width: 480px) {
  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9375rem;
  }

  .btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .container {
    padding: 0 12px;
  }
}
