/* ============================================
   ESG Field Briefs — Mobile-first stylesheet
   ============================================ */

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

:root {
  --navy: #1a2744;
  --navy-light: #243258;
  --navy-dark: #111b30;
  --gold: #f5a623;
  --gold-light: #ffc04d;
  --gold-dark: #d4861a;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-400: #adb5bd;
  --gray-600: #6c757d;
  --gray-800: #343a40;
  --text-primary: #1a2744;
  --text-secondary: #495057;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ============ HEADER ============ */

.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--white);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.back-btn:hover { background: rgba(255,255,255,0.2); }
.back-btn:active { background: rgba(255,255,255,0.08); }

.header-title {
  flex: 1;
}

.header-title h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.header-title .subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 1px;
}

.header-logo {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ============ HOME VIEW ============ */

.home-view {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.search-wrap {
  position: relative;
  margin-bottom: 24px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 16px;
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

#search-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,39,68,0.08);
}

#search-input::placeholder {
  color: var(--gray-400);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 12px;
}

#cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brief-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 18px 20px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 16px;
  -webkit-user-select: none;
  user-select: none;
}

.brief-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-lg);
}

.brief-card:active {
  transform: scale(0.98);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-desc {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.card-arrow {
  color: var(--gray-400);
  font-size: 18px;
  flex-shrink: 0;
}

.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
  font-size: 15px;
}

.no-results .no-results-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

/* ============ BRIEF DETAIL VIEW ============ */

.brief-view {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.brief-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 20px;
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.brief-header-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.brief-header h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}

.brief-header .brief-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
}

.brief-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
  flex: 1;
  justify-content: center;
}
.btn-primary:hover { background: var(--navy-light); }
.btn-primary:active { background: var(--navy-dark); }

.btn-gold {
  background: var(--gold);
  color: var(--navy-dark);
  flex: 1;
  justify-content: center;
}
.btn-gold:hover { background: var(--gold-light); }
.btn-gold:active { background: var(--gold-dark); }

.section-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 16px;
}

.copy-btn {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--navy); color: var(--navy); }
.copy-btn.copied {
  background: #d4edda;
  border-color: #28a745;
  color: #28a745;
}

.section-content {
  padding: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.section-content ul {
  padding-left: 20px;
}

.section-content li {
  margin-bottom: 12px;
}

.section-content li:last-child {
  margin-bottom: 0;
}

.section-content strong {
  color: var(--text-primary);
}

/* ============ PRINT STYLES ============ */

@media print {
  body { background: white; }
  .app-header { position: static; box-shadow: none; }
  .back-btn { display: none; }
  .brief-actions { display: none; }
  .copy-btn { display: none; }
  .home-view { display: none; }
  .brief-view { padding: 0; max-width: 100%; }

  .brief-header {
    background: var(--navy) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border-radius: 0;
    margin-bottom: 12px;
    color: white !important;
  }

  .section-card {
    break-inside: avoid;
    margin-bottom: 10px;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .section-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    margin: 1.5cm 1.5cm;
    size: letter portrait;
  }
}

/* ============ RESPONSIVE ============ */

@media (min-width: 480px) {
  .home-view, .brief-view {
    padding-left: 24px;
    padding-right: 24px;
  }

  .card-title { font-size: 17px; }
  .card-desc { font-size: 14px; }
  .brief-header h2 { font-size: 24px; }
  .section-content { font-size: 15px; }
}

/* Hidden class */
.hidden { display: none !important; }
