/**
 * Global Styles
 * Base styles, CSS variables, and common utilities
 */

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --text: #e6edf3;
  --muted: #8b9cb3;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.15);
  --success: #3fb950;
  --warning: #d29922;
  --error: #f85149;
  --border: #30363d;
  --radius: 12px;
  --radius-lg: 20px;
  --font: 'DM Sans', system-ui, sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
}

* {
  box-sizing: border-box;
}

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

/* Centered main content: single column with border, max-width, centered on page */
.wrap {
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

/* Center all text in landing: headers, subheaders, paragraphs */
.wrap .hero,
.wrap > section {
  text-align: center;
}

.wrap .hero h1,
.wrap .hero .tagline,
.wrap .hero .hero-oneline,
.wrap .hero .cta,
.wrap > section h2,
.wrap > section .section-sub,
.wrap > section h3,
.wrap > section p {
  text-align: center;
}

.wrap > section .section-sub {
  margin-left: auto;
  margin-right: auto;
}

.wrap .feature-item,
.wrap .feature-item h3,
.wrap .feature-item p,
.wrap .service-card h3,
.wrap .service-card p {
  text-align: center;
}

/* Auth bar: full width inside wrap */
.wrap .auth-bar-inner {
  max-width: 100%;
}

/* Dashboard app (tables, forms) stays left-aligned */
.wrap .dashboard-app-content {
  text-align: left;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1rem;
  font-weight: 600;
  line-height: 1.2;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  border-color: var(--error);
}

.field-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

button {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--accent);
}

button.danger {
  background: var(--error);
  color: white;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.card-body {
  margin-bottom: 1rem;
}

.card-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-badge.status-active,
.status-badge.status-completed,
.status-badge.status-paid,
.status-badge.status-confirmed {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.status-badge.status-pending,
.status-badge.status-draft {
  background: rgba(210, 153, 34, 0.2);
  color: var(--warning);
}

.status-badge.status-cancelled,
.status-badge.status-error,
.status-badge.status-overdue {
  background: rgba(248, 81, 73, 0.2);
  color: var(--error);
}

.status-badge.status-sent,
.status-badge.status-in_progress {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent);
}

/* Utilities */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--muted);
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-warning {
  color: var(--warning);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Responsive */
@media (max-width: 768px) {
  .wrap {
    padding: 1rem;
  }
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  font-size: 0.9rem;
}
