/* ==========================================================
   AGE.CSS – Stiluri optimizate pentru Age Calculator
   ========================================================== */

/* ---------- Container general ---------- */
#section-age .tool-content-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem;
}

/* ---------- Titlu secțiune ---------- */
#section-age .tool-title {
  margin-bottom: 0;
  text-align: center;
}

/* ---------- Controale input ---------- */
#section-age .timer-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
  width: 100%;
  max-width: 320px;
}

#section-age .age-input {
  width: 100%;
  max-width: 300px;
  margin-bottom: 0.5em;
  padding: 0.8em 1em;
  border-radius: var(--radius);
  border: 2px solid var(--accent2);
  background: var(--bg);
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

#section-age .age-input:focus {
  border-color: var(--accent3);
  box-shadow: 0 0 0 3px rgba(0, 178, 255, 0.2);
  outline: none;
  transform: translateY(-1px);
}

#section-age .age-input:hover {
  border-color: var(--accent1);
}

/* Buton calculate */
#ageCalcBtn {
  width: 100%;
  max-width: 300px;
  padding: 0.8em 1.5em;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent1), var(--accent3));
  border: none;
  color: white;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#ageCalcBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

#ageCalcBtn:active {
  transform: translateY(0);
}

/* ---------- Container rezultate ---------- */
.age-cards-container {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  margin-top: 2em;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Carduri rezultate ---------- */
.age-card {
  background: linear-gradient(135deg, var(--accent1), var(--accent3));
  border-radius: 1.5em;
  padding: 1.5em 1em;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 2px solid rgba(255,255,255,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.age-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.age-card:hover::before { left: 100%; }

.age-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
}

/* Card principal */
.main-age-card {
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  padding: 2em 1.5em;
  position: relative;
}

.main-age-card .age-card-value {
  font-size: 1.8em;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Grid pentru statistici */
.age-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1em;
}

.age-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
}

/* Carduri statistici - culori diferite */
.stats-card { padding: 1.2em 0.8em; }

.stats-card.teal   { background: linear-gradient(135deg, #2ee6d6, #00b2ff); }
.stats-card.blue   { background: linear-gradient(135deg, #00b2ff, #1e3a8a); }
.stats-card.purple { background: linear-gradient(135deg, #a259ff, #7c3aed); }
.stats-card.green  { background: linear-gradient(135deg, #10b981, #059669); }
.stats-card.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }

.zodiac-card { background: linear-gradient(135deg, #4f46e5, #7c3aed); }

/* Text în carduri */
.age-card-value {
  font-size: 1.5em;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.3em;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.age-card-label {
  font-size: 0.9em;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.main-age-card .age-card-label { font-size: 1em; }
.zodiac-card .age-card-value   { font-size: 1.3em; }

/* ---------- Mesaje eroare ---------- */
.age-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  color: #ff4d4d;
  padding: 1.5em;
  background: rgba(255, 77, 77, 0.1);
  border: 2px solid rgba(255, 77, 77, 0.3);
  border-radius: 1em;
  text-align: center;
  font-weight: 600;
  animation: shake 0.5s ease-in-out;
}

.error-icon { font-size: 1.2em; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Loading states ---------- */
.age-card.loading { opacity: 0.7; pointer-events: none; }
.age-card.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- TEMA LIGHT – ajustări ---------- */
body.light-mode #section-age .age-input {
  background: var(--surface-100);
  border-color: #cbd5e0;
  color: var(--text-dark);
}

body.light-mode #section-age .age-input:focus {
  border-color: var(--accent3);
  box-shadow: 0 0 0 3px rgba(0, 178, 255, 0.15);
}

body.light-mode .age-card { box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
body.light-mode .age-card:hover { box-shadow: 0 16px 48px rgba(0,0,0,0.15); }

/* ---------- Animații îmbunătățite ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.age-cards-container.animate-in .age-card { animation: fadeInUp 0.6s ease-out forwards; }
.age-cards-container.animate-in .age-card:nth-child(1) { animation-delay: 0.1s; }
.age-cards-container.animate-in .age-card:nth-child(2) { animation-delay: 0.2s; }
.age-cards-container.animate-in .age-card:nth-child(3) { animation-delay: 0.3s; }
.age-cards-container.animate-in .age-card:nth-child(4) { animation-delay: 0.4s; }

/* ---------- Responsive Design ---------- */

/* Tablet */
@media (max-width: 900px) {
  .age-stats-grid { grid-template-columns: 1fr; gap: 1em; }
  .age-cards-container { max-width: 480px; }
}

/* Telefon */
@media (max-width: 600px) {
  .main-age-card .age-card-value {
    white-space: nowrap;
  }

  #section-age .tool-content-wrapper {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  #section-age .timer-controls {
    max-width: 320px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    align-items: center;
    justify-content: center;
  }

  /* input + wrapper + button: lățime egală și centrat */
  #section-age .age-input,
  #section-age .date-input-wrapper,
  #ageCalcBtn {
    max-width: 300px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }

  /* înălțime buton apropiată de input */
  #ageCalcBtn { padding: 0.7em 1em; }

  .age-stats-row,
  .age-stats-grid { grid-template-columns: 1fr; gap: 0.8em; }

  .age-cards-container { gap: 1em; margin-top: 1.5em; }
  .age-card { padding: 1.2em 0.8em; border-radius: 1.2em; }
  .main-age-card { padding: 1.5em 1em; }
  .age-card-value { font-size: 1.2em; }
  .main-age-card .age-card-value { font-size: 1.4em; }
  .age-card-label { font-size: 0.8em; }
}

/* Telefon mic */
@media (max-width: 400px) {
  .age-card { padding: 1em 0.6em; }
  .age-card-value { font-size: 1.1em; }
  .main-age-card .age-card-value { font-size: 1.3em; }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  .age-card, #section-age .age-input, #ageCalcBtn { transition: none; }
  .age-card:hover { transform: none; }
  .age-cards-container.animate-in .age-card { animation: none; }
}

/* Focus pentru accesibilitate */
.age-card:focus-within {
  outline: 3px solid var(--accent3);
  outline-offset: 2px;
}

/* ====== Dark mode – wrapper și trigger pentru date picker (fără a atinge light mode) ====== */
#section-age .date-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 300px;
}

#section-age .date-input-wrapper .age-input {
  width: 100%;
  padding-right: 44px; /* spațiu pentru buton */
}

/* Implicit, butonul e ascuns: îl afișăm doar în dark mode */
#section-age .date-trigger {
  display: none;
}

body:not(.light-mode) #section-age .date-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 6px;
}

body:not(.light-mode) #section-age .date-trigger:hover {
  outline: 2px solid rgba(255,255,255,0.2);
}

body:not(.light-mode) #section-age .date-trigger svg {
  width: 20px;
  height: 20px;
  fill: #ffffff; /* icon alb */
}

/* În dark mode ascundem doar VIZUAL indicatorul nativ ca să nu apară dublu;
   funcționalitatea e preluată de butonul nostru */
body:not(.light-mode) #section-age .age-input::-webkit-calendar-picker-indicator {
  opacity: 0;
}

/* Păstrăm UI întunecat pentru control/popup în dark */
body:not(.light-mode) #section-age .age-input { color-scheme: dark; }


/* === Desktop + Light mode: match dark mode trigger style but with black icon === */
body.light-mode #section-age .date-input-wrapper .age-input {
  padding-right: 44px; /* loc pentru icon */
}

body.light-mode #section-age .date-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 6px;
}

body.light-mode #section-age .date-trigger svg {
  width: 20px;
  height: 20px;
  fill: #000; /* icon negru pe light */
}

/* ascundem indicatorul nativ ca să nu apară două iconuri */
body.light-mode #section-age .age-input::-webkit-calendar-picker-indicator {
  opacity: 0;
}


/* === Phone + Light mode: mirror dark-mode trigger positioning/sizing (icon negru) === */
@media (max-width: 600px) {
  .main-age-card .age-card-value {
    white-space: nowrap;
  }

  body.light-mode #section-age .date-input-wrapper .age-input {
    padding-right: 44px; /* loc pentru icon */
  }
  body.light-mode #section-age .date-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
  }
  body.light-mode #section-age .date-trigger svg {
    width: 20px;
    height: 20px;
    fill: #000; /* icon negru pe light */
  }
  /* ascundem indicatorul nativ pe telefon în light mode ca să nu apară două iconuri */
  body.light-mode #section-age .age-input::-webkit-calendar-picker-indicator { opacity: 0; }
}

/* How to use section styling */
.howto-section {
  display: none;
  max-width: 980px;
  margin: 2rem auto;
  padding: 1.5rem;
  background-color: var(--bg-dark);
  border-radius: 12px;
  color: var(--text-light);
}

.howto-content {
  max-width: 100%;
}

.howto-section h3 {
  margin-bottom: 1rem;
  color: var(--accent1);
  font-size: 1.4rem;
}

.howto-section ol {
  padding-left: 1.5rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.howto-section li {
  margin-bottom: 0.5rem;
}

.howto-section p {
  margin-top: 0.5rem;
}

.howto-section a {
  color: var(--accent2);
  text-decoration: none;
}

.howto-section a:hover {
  text-decoration: underline;
}

/* Show only for age section when active */
#section-age.active ~ #howto-age {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .howto-section {
    margin: 1.5rem;
    padding: 1.25rem;
  }
}

@media (max-width: 600px) {
  .howto-section {
    margin: 1rem;
    padding: 1rem;
  }
  
  .howto-section h3 {
    font-size: 1.2rem;
  }
  
  .howto-section ol {
    padding-left: 1.25rem;
  }
}
