/* =============================
   Base Layout & Global Styles
============================= */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Segoe UI', sans-serif;
    background: url("/companion/bg.png") no-repeat center center fixed;
  background-size: cover;
}



.page-wrapper {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  position: relative; /* ensures .exit-button stays within bounds */
}

/* =============================
   Header (Clean Left-Aligned)
============================= */
header {
  background-color: #1f2937;
  color: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* left-align */
  gap: 12px;
}

header img {
  width: 64px;
  height: 64px;
}

header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: normal;
}


/* =============================
   Tab Navigation
============================= */
.tab-container {
  width: 100%;
  overflow: hidden;
  background-color: #f8f8f8;
}

.tab-links {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  border-bottom: 2px solid #ccc;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  flex-shrink: 0;
  padding: 20px 16px;
  border: none;
  background-color: #f1f1f1;
  cursor: pointer;
  transition: background-color 0.3s ease;
  border-left: 1px solid #ddd;
}

.tab-button:first-child {
  border-left: none;
}

.tab-button.active {
  background-color: #e0e0e0;
  border-bottom: 2px solid #73862F;
  font-weight: 600;
}

/* =============================
   Tab Content Container
============================= */
.tab-content-container {
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  padding: 15px;
  margin: 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.scrollable-tab-content {
  height: calc(99vh - 160px);
  background: #fff !important;   /* Force background white */
  overflow-y: auto;
  padding-bottom: 40px;
}

/* =============================
   Dashboard Tab
============================= */
.dashboard-wrapper {
  background-color: #fff;
  margin: 16px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.dash-heading {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}

.clean-summary p {
  margin: 6px 0;
  font-size: 15px;
  color: #444;
}

.breakdown-text {
  font-size: 14px;
  color: #777;
  margin: 10px 0;
}

/* =============================
   Badge Display
============================= */
.badge-label {
  font-size: 14px;
  font-weight: 500;
  margin-top: 20px;
  margin-bottom: 8px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background-color: #999;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.badge[data-days="30"] { background-color: #f39c12; }
.badge[data-days="60"] { background-color: #3498db; }
.badge[data-days="90"] { background-color: #27ae60; }
.badge[data-days="365"] { background-color: #e74c3c; }
.badge[data-days="1825"] { background-color: #8e44ad; }
.badge[data-days="3650"] { background-color: #34495e; }
.badge[data-days="7300"] { background-color: #b7950b; }

.badge[title] {
  cursor: help;
}

/* =============================
   Events Tab
============================= */
.events-wrapper {
  background-color: #fff;
  margin: 16px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.events-wrapper h2 {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

.event-card {
  background-color: #f9f9f9;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #73862F;
}

.event-card h3,
.event-card p,
.event-card .event-meta,
.event-card .event-description {
  font-size: 14px;
  margin: 4px 0;
  color: #444;
}

.event-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #1f2937;
}

/* =============================
   Preferences Tab
============================= */
.preferences-wrapper {
  background-color: #fff;
  margin: 16px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.preferences-wrapper h2 {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

.preferences-wrapper label {
  display: block;
  margin: 12px 0 4px;
  font-size: 14px;
  color: #444;
  font-weight: 500;
}

.preferences-wrapper input,
.preferences-wrapper select {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  background-color: #fafafa;
}

.preferences-wrapper select[multiple] {
  height: auto;
  min-height: 100px;
}

.preferences-wrapper input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  vertical-align: middle;
}

.pin-settings {
  margin-top: 16px;
  background-color: #f9f9f9;
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed #ccc;
}

.preferences-wrapper button {
  margin-top: 20px;
  padding: 10px 16px;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background-color: #73862F;
  color: #fff;
  transition: background-color 0.3s ease;
}

.preferences-wrapper button:hover {
  background-color: #0056b3;
}

.pref-button {
  background-color: #2563eb;
  color: white;
  padding: 10px 18px;
  font-size: 16px;
  border-radius: 8px;
  margin-top: 10px;
  cursor: pointer;
}

.pref-button:hover {
  background-color: #1d4ed8;
}

#erasePrefs {
  background-color: #e74c3c;
  margin-left: 10px;
}

#erasePrefs:hover {
  background-color: #c0392b;
}

.empty-preferences {
  text-align: center;
  margin: 30px auto;
  padding: 20px;
}

/* NFC Permissions Block */
.nfc-permission-block {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  color: #333;
  max-width: 600px;
  margin: 20px auto;
  text-align: left;
}

.nfc-permission-block h3 {
  font-size: 22px;
  margin-bottom: 12px;
  color: #222;
}

.nfc-permission-block p,
.nfc-permission-block li {
  font-size: 15px;
  margin: 10px 0;
  line-height: 1.5;
}

.nfc-permission-block h4 {
  font-size: 16px;
  margin: 20px 0 10px;
  color: #73862F;
}

.nfc-permission-block ol {
  padding-left: 20px;
  margin-bottom: 20px;
}

.nfc-permission-block button {
  padding: 10px 20px;
  font-size: 15px;
  background-color: #73862F;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.nfc-permission-block button:hover {
  background-color: #0056b3;
}

.theme-button {
  padding: 10px 16px;
  font-size: 14px;
  background-color: #73862F;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.theme-button:hover {
  background-color: #374151;
}

/* =============================
   Meetings Tab
============================= */
.meetings-wrapper {
  background-color: #fff;
  margin: 16px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.meetings-wrapper h2 {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

.meeting-card {
  background-color: #f9f9f9;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #73862F;
}

.meeting-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #1f2937;
}

.meeting-card p {
  font-size: 14px;
  color: #444;
  margin: 4px 0;
}

.meeting-card .drive-button {
  display: block;
  margin-top: 18px;
  padding: 12px 16px;
  background-color: #28a745;
  color: white;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  text-decoration: none;
  width: 100px;
  
}


.meeting-card .drive-button:hover {
  background-color: #1e7e34;
}

/* =============================
   Phone List Tab
============================= */
.phone-card {
  background-color: #f0f8ff;
  border-left: 4px solid #28a745;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.phone-card p {
  font-size: 14px;
  color: #333;
}

.phone-card a {
  color: #73862F;
  text-decoration: none;
}

.phone-card a:hover {
  text-decoration: underline;
}

.phone-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.phone-actions button {
  padding: 10px 16px;
  font-size: 14px;
  background-color: #73862F;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.phone-actions button:hover {
  background-color: #0056b3;
}

#clearPhoneList {
  background-color: #e74c3c;
}

#clearPhoneList:hover {
  background-color: #c0392b;
}

/* =============================
   About Tab
============================= */
.about-wrapper {
  padding: 20px;
  line-height: 1.6;
  color: #333;
}

.about-wrapper h2,
.about-wrapper h3 {
  color: #1f2937;
  margin-top: 0;
}

.about-wrapper p {
  margin-bottom: 1em;
}

.about-wrapper blockquote {
  border-left: 4px solid #1f2937;
  padding-left: 15px;
  font-style: italic;
  color: #555;
  margin: 1em 0;
}

.about-wrapper a {
  color: #1f2937;
  text-decoration: underline;
}

.about-wrapper a:hover {
  text-decoration: none;
}

/* =============================
   Exit Button (PWA Only)
============================= */
.exit-button {
  position: fixed;
  top: 16px;
  right: 16px;
  background-color: #f3f4f6; /* soft gray */
  color: #1f2937;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  z-index: 999;
  transition: background-color 0.3s ease;
}

.exit-button:hover {
  background-color: #e5e7eb;
}


.exit-button:hover {
  background-color: #1d4ed8;
}


.exit-button:hover {
  background-color: #d1d5db;
}



.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #1f2937;
  color: white;
  padding: 15px 20px;
}

.app-header img {
  width: 64px;
  height: 64px;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: normal;
}


.header-left,
.header-center,
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* On small screens, allow wrapping */
@media (max-width: 480px) {
  .app-header {
    flex-direction: column;
    gap: 10px;
  }

  .header-left, .header-center, .header-right {
    justify-content: center;
    width: 100%;
  }

  .exit-button {
    margin-top: 5px;
  }
}


html, body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; /* No page scroll! */
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: url("/table/bg.png") no-repeat center center fixed;
  background-size: cover;
}

/* Make .tab-container fill space under header */
.tab-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden; /* Crucial: hide overflow, push scrolling down */
}



/* Content container always fills the rest */
.tab-content-container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* This prevents jumps */
  padding: 0;
  margin: 0;
}

/* The ONLY scrollable area! */
#tab-content-area, .scrollable-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* Don't set hard height! Let flex handle it */
  padding: 0;
}
