/* ============================================
   Satellite Home Watch — Global Base Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Sans:wght@300;400;500;600;700;800&display=swap');

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: var(--color-primary-hover); }

img, video { max-width: 100%; display: block; }

ul, ol { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button { cursor: pointer; border: none; background: none; }

/* ── Utility Classes ── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.container-narrow {
  max-width: var(--container-narrow);
}

.container-wide {
  max-width: var(--container-wide);
}

.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

.section-sm {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.6875rem var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-lg {
  padding: 0.875rem var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-sm {
  padding: 0.4375rem var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-primary {
  background: var(--navy-700);
  color: #ffffff;
  box-shadow: var(--shadow-sm), 0 0 0 0 rgba(22, 45, 86, 0);
}

.btn-primary:hover {
  background: var(--navy-800);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--blue-gray-100);
  color: var(--navy-700);
  border: 1px solid var(--blue-gray-200);
}

.btn-secondary:hover {
  background: var(--blue-gray-200);
  border-color: var(--blue-gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--navy-700);
  border: 1.5px solid var(--navy-300);
}

.btn-outline:hover {
  background: var(--navy-50);
  border-color: var(--navy-400);
  transform: translateY(-1px);
}

.btn-white {
  background: #ffffff;
  color: var(--navy-700);
  box-shadow: var(--shadow-md);
}

.btn-white:hover {
  background: var(--cream-50);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--blue-gray-50);
  color: var(--color-text-primary);
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  border: var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body {
  padding: var(--space-6);
}

.card-navy {
  background: var(--navy-800);
  border: var(--border-navy);
  color: var(--color-text-inverse);
}

.card-hover {
  transition: all var(--transition-base);
  cursor: pointer;
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: rgba(10, 22, 40, 0.14);
}

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-scheduled {
  background: var(--status-scheduled-bg);
  color: var(--status-scheduled-text);
  border-color: var(--status-scheduled-border);
}
.badge-scheduled .badge-dot { background: var(--status-scheduled-text); }

.badge-inprogress {
  background: var(--status-inprogress-bg);
  color: var(--status-inprogress-text);
  border-color: var(--status-inprogress-border);
}
.badge-inprogress .badge-dot { background: var(--status-inprogress-text); }

.badge-completed {
  background: var(--status-completed-bg);
  color: var(--status-completed-text);
  border-color: var(--status-completed-border);
}
.badge-completed .badge-dot { background: var(--status-completed-text); }

.badge-cancelled {
  background: var(--status-cancelled-bg);
  color: var(--status-cancelled-text);
  border-color: var(--status-cancelled-border);
}
.badge-cancelled .badge-dot { background: var(--status-cancelled-text); }

.badge-open {
  background: var(--status-open-bg);
  color: var(--status-open-text);
  border-color: var(--status-open-border);
}
.badge-open .badge-dot { background: var(--status-open-text); }

.badge-resolved {
  background: var(--status-resolved-bg);
  color: var(--status-resolved-text);
  border-color: var(--status-resolved-border);
}
.badge-resolved .badge-dot { background: var(--status-resolved-text); }

.badge-neutral {
  background: var(--status-neutral-bg);
  color: var(--status-neutral-text);
  border-color: var(--status-neutral-border);
}
.badge-neutral .badge-dot { background: var(--status-neutral-text); }

.badge-priority-low { background: var(--priority-low-bg); color: var(--priority-low-text); }
.badge-priority-medium { background: var(--priority-medium-bg); color: var(--priority-medium-text); }
.badge-priority-high { background: var(--priority-high-bg); color: var(--priority-high-text); }
.badge-priority-urgent { background: var(--priority-urgent-bg); color: var(--priority-urgent-text); }

/* ── Form Elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
}

.form-input {
  padding: 0.6875rem var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1.5px solid var(--blue-gray-200);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  outline: none;
  width: 100%;
}

.form-input::placeholder {
  color: var(--color-text-light);
}

.form-input:hover {
  border-color: var(--blue-gray-400);
}

.form-input:focus {
  border-color: var(--navy-400);
  box-shadow: var(--shadow-glow);
  background: #ffffff;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25em;
  padding-right: 2.5rem;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(10, 22, 40, 0.1), transparent);
  border: none;
  margin: var(--space-6) 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--blue-gray-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--blue-gray-400); }

/* ── Loading Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--cream-300) 25%, var(--cream-200) 50%, var(--cream-300) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.7; }
}

.fade-in { animation: fadeIn 0.4s ease forwards; }
.slide-in-left { animation: slideInLeft 0.3s ease forwards; }

/* ── Responsive Helpers ── */
@media (max-width: 1024px) {
  .hide-tablet { display: none !important; }
}

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
  .container { padding-left: var(--space-4); padding-right: var(--space-4); }
  .section { padding-top: var(--space-16); padding-bottom: var(--space-16); }
}

@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}

/* ── Tooltip ── */
.tooltip-wrapper { position: relative; display: inline-flex; }
.tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-900);
  color: white;
  font-size: var(--text-xs);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 100;
}
.tooltip-wrapper:hover .tooltip { opacity: 1; }

/* ── Focus Styles ── */
*:focus-visible {
  outline: 2px solid var(--navy-400);
  outline-offset: 2px;
}

/* ── Page Transitions ── */
.page { animation: fadeIn 0.3s ease; }
