/* css/main.css */
/* Base styles, reset, layout, and global UI components */

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  background-color: var(--color-bg-base);
  color: var(--color-text-main);
  font-size: 15px;
  line-height: 1.5;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

#app-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* 100vh on iOS-selaimissa suuri viewport eli korkeus ilman työkalupalkkeja:
     palkin ollessa näkyvissä alalaita jäi ruudun ulkopuolelle ja kelluvat
     painikkeet katkesivat. 100dvh seuraa todellista näkyvää korkeutta;
     100vh jää varalle vanhoille selaimille. */
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background-color: var(--color-bg-base);
}

/* General Typography */
h1, h2, h3, h4, h5 {
  font-family: var(--font-family-head, inherit);
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.25;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  /* <button> ei peri fonttia selaimelta, <a> perii. Ilman tätä vierekkäiset
     painikkeet piirtyivät eri kirjasimella. */
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  /* Kaksiriviseksi katkeava teksti keskittyy vain jos text-align sanoo niin:
     <button> on oletuksena keskitetty, <a> ei. */
  line-height: 1.25;
  text-align: center;
  border-radius: var(--radius-md, 12px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse, #FFFFFF);
}
.btn-primary:hover {
  background-color: var(--color-primary-light, var(--color-primary));
  filter: brightness(1.1);
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-main);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background-color: var(--color-border-light);
}

.btn-danger {
  background-color: #DC2626;
  color: #FFFFFF;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-main);
}
.btn-outline:hover {
  background: var(--color-border-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon-round {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full, 9999px);
  padding: 0;
  background: var(--color-surface);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-round:hover {
  border-color: var(--color-primary);
  transform: scale(1.05);
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 20px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: var(--backdrop-blur, blur(16px));
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full, 9999px);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  text-align: center;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success { background: #065F46; }
.toast-warning { background: #92400E; }
.toast-error   { background: #991B1B; }

/* Offline Badge */
#offline-badge {
  display: none;
  position: fixed;
  bottom: calc(var(--safe-area-bottom, 16px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #B91C1C;
  color: #FFFFFF;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full, 9999px);
  z-index: 10000;
  box-shadow: var(--shadow-md);
}
