/* ============================================
   BabyLink Base Styles
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  color: var(--color-text-heading);
  line-height: 1.3;
  font-weight: 600;
}

h1 {
  text-align: center;
  font-size: var(--text-h1);
  margin-bottom: var(--space-lg);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-h2);
}

h3 {
  font-size: var(--text-h3);
}

/* ====== Buttons ====== */
button {
  font-family: var(--font-family);
  padding: 0.75em 1.25em;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;
  line-height: 1.2;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; }
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: var(--color-success-text); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: var(--color-danger-text); }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-text-muted); color: white; }
.btn-secondary:hover { background: var(--color-text-secondary); }

/* ====== Inputs ====== */
input[type="text"], input[type="url"] {
  font-family: var(--font-family);
  padding: 0.75em 1em;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: all var(--transition-base);
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 48px;
}

input[type="text"]:focus, input[type="url"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

input[type="text"]::placeholder, input[type="url"]::placeholder {
  color: var(--color-text-light);
}

/* ====== Keyboard focus indicator ======
   Every interactive element gets a visible focus outline when reached
   via keyboard (or programmatic focus from assistive tech). Pointer
   focus stays unstyled so mouse users don't see a ring on click.
   Anywhere the existing design already paints a `box-shadow` focus
   ring (inputs, the pin field) keeps it — outline-offset prevents the
   ring from doubling up. */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ====== Theme Toggle ====== */
.theme-toggle {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  font-size: 1.2em;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.theme-toggle:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ====== Smooth transitions ====== */
body, .baby-card, .master-controls, .wake-lock-container,
.notification-settings, .section, .role-card, .room-sharing,
.room-item, #status {
  transition: background-color var(--transition-slow),
              color var(--transition-slow),
              border-color var(--transition-slow),
              box-shadow var(--transition-slow);
}

/* ====== Status dot indicator ====== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--active {
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-bg);
  animation: breathe 3s ease-in-out infinite;
}

.status-dot--warning {
  background: var(--color-warning);
  box-shadow: 0 0 0 3px var(--color-warning-bg);
}

.status-dot--error {
  background: var(--color-danger);
  box-shadow: 0 0 0 3px var(--color-danger-bg);
  animation: pulse-alert 1.2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.9); }
}

/* ====== Utility ====== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  h1 { font-size: var(--text-h2); }
  button { font-size: var(--text-sm); }
}
