/* ===========================================
   Kirklees Frontline App - Shared Styles
   ===========================================

   This file contains all theme variables and
   shared styles. Include this in all app pages.

   Usage:
   1. Link this CSS file in <head>
   2. Use CSS variables throughout your styles
=========================================== */

/* ----- Theme Variables ----- */
:root {
  /* Brand colors - don't change with theme */
  --brand-primary: #006174;
  --brand-primary-dark: #004d5c;
  --brand-accent: #b80000;

  /* Aliases for backward compatibility */
  --primary: var(--brand-primary);
  --primary-dark: var(--brand-primary-dark);
  --accent: var(--brand-accent);

  /* Light theme (default) */
  --bg: #f5f5f5;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #666666;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --overlay: rgba(0, 0, 0, 0.5);

  /* Semantic colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Spacing */
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 20px;
}


/* ----- Base Reset ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- Typography ----- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 600;
}

p {
  color: var(--text-secondary);
}

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

/* ----- Common Components ----- */

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-primary-dark);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
}

/* Form inputs */
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-primary);
}

/* ----- Modal/Overlay Base ----- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  /* Modals use light surface by default */
  background: white;
  color: #1a1a1a;
  border-radius: var(--radius);
}

.modal-content h3 {
  color: #1a1a1a;
}

.modal-content p {
  color: #666666;
}

/* ----- Page Header Template ----- */
/* Use this for all sub-pages with a header. Set --header-bg for custom color */
.page-header {
  background: var(--header-bg, #20283d);
  color: white;
  padding: 20px 20px 80px;
  padding-top: calc(20px + env(safe-area-inset-top));
  text-align: center;
  position: relative;
}

.page-header .back-btn {
  position: absolute;
  left: 16px;
  top: calc(16px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
}

.page-header .back-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.page-header .logo {
  max-width: 160px;
  height: auto;
  margin: 20px auto 16px;
  display: block;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: white;
}

.page-header p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.95);
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Page content container - pulls up into header */
.page-content {
  max-width: 500px;
  margin: -50px auto 0;
  padding: 0 16px 40px;
  position: relative;
}

/* ----- Safe Area Support ----- */
.safe-area-top {
  padding-top: env(safe-area-inset-top, 0px);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ----- Utility Classes ----- */
.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
