/**
 * WordPress-specific styles for Habit Tracker Plugin
 *
 * These styles help the tracker integrate better with WordPress themes
 * and prevent theme styles from breaking the app UI.
 */

/* =========================================================
   Main container
   ========================================================= */

.habit-tracker-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  overflow: hidden;

  /* IMPORTANT:
     Do NOT inherit text color from WordPress themes */
  color: #000;

  /* Reset common WP typography interference */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

/* Ensure the tracker doesn't conflict with WordPress admin bar */
.admin-bar .habit-tracker-container {
  margin-top: 0;
}

/* =========================================================
   Defensive text color protection (critical fix)
   ========================================================= */

/* Prevent themes from forcing white/light text */
.habit-tracker-container span {
  color: #000;
}

/* Ensure text elements inherit plugin color, not theme color */
.habit-tracker-container p,
.habit-tracker-container li,
.habit-tracker-container div {
  color: inherit;
}

/* =========================================================
   Responsive adjustments
   ========================================================= */

@media (max-width: 768px) {
  .habit-tracker-container {
    padding: 0 10px;
  }
}

/* =========================================================
   Full-screen mode helper class
   ========================================================= */

.habit-tracker-container.full-screen {
  min-height: 100vh;
  height: 100vh;
}

/* =========================================================
   Error message styling
   ========================================================= */

.habit-tracker-error {
  padding: 20px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  color: #721c24;
  margin: 20px 0;
}

.habit-tracker-error strong {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
}

.habit-tracker-error a {
  color: #004085;
  text-decoration: underline;
  margin-left: 10px;
}

.habit-tracker-error a:hover {
  color: #002752;
}

/* =========================================================
   Loading state
   ========================================================= */

.habit-tracker-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  font-size: 18px;
  color: #666;
}

/* =========================================================
   Z-index fixes for dialogs/modals
   ========================================================= */

.habit-tracker-container [role="dialog"],
.habit-tracker-container [role="alertdialog"] {
  z-index: 999999;
}

/* =========================================================
   Box sizing normalization
   ========================================================= */

.habit-tracker-container *,
.habit-tracker-container *::before,
.habit-tracker-container *::after {
  box-sizing: border-box;
}

/* =========================================================
   Button normalization
   ========================================================= */

.habit-tracker-container button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* =========================================================
   Print styles
   ========================================================= */

@media print {
  .habit-tracker-container {
    display: none;
  }
}
