/* ================================================================
   mainView.css — Green Books App main view
   ================================================================ */

/* ---------- Design tokens ---------- */
:root {
  --green: #125E06;
  --gray:  #999;
  --bg:    #f7f7f7;
}

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

/* ---------- Base ---------- */
body {
  font-family: var(--font-family);
  background: var(--bg);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

input:focus {
  outline: 3px solid #125E06;
  box-shadow: 0 0 10px #125E06;
}

/* ---------- App shell ---------- */
.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.views {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 30px 20px;
  background: var(--bg);
  transition: transform 0.35s cubic-bezier(.25,.8,.25,1);
  will-change: transform;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view h1 {
  margin-bottom: 20px;
  text-align: center;
}

.view p {
  text-align: center;
}

/* Default view positions */
#transactions { transform: translateX(-100%); }
#home         { transform: translateX(0%);    }
#account      { transform: translateX(100%);  }

/* ---------- Bottom nav ---------- */
.navbar {
  height: 70px;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #e5e5e5;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  z-index: 50;
}

.nav-item {
  flex: 1;
  text-align: center;
  cursor: pointer;
  color: var(--gray);
  transition: color 0.2s ease;
  position: relative;
  padding-top: 4px;
}

/* MD3 active pill */
.nav-item::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 32px;
  border-radius: 16px;
  background-color: transparent;
  transition: background-color 0.2s ease;
}

.nav-item.active::before {
  background-color: #d9f3e3;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: fill 0.2s ease;
  position: relative;
}

.nav-item.active {
  color: var(--green);
}

.nav-label {
  font-size: 12px;
  margin-top: 4px;
}

/* ---------- Account view ---------- */
.profile-button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background-color: var(--green);
  color: white;
  border: none;
  cursor: pointer;
}

.profile-button--spaced {
  margin-top: 16px;
}

.account-subtitle {
  margin-bottom: 10%;
}

/* ---------- Home / Schedule view ---------- */
.schedule-div {
  width: 100%;
  padding: 10px;
  height: 80%;
  border-radius: 8px;
  background-color: #B4D1BA;
  border: none;
  cursor: pointer;
}

.listFAB {
  width: 30%;
  min-width: min(160px, 85%);
  padding: 6px 10px;
  margin-left: auto;
  margin-top: 8px;
  border-radius: 8px;
  background-color: var(--green);
  color: white;
  border: none;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .listFAB {
    width: 45%;
    padding: 6px 8px;
  }
}

/* ---------- Schedule items ---------- */
.schedule-item {
  width: 98%;
  margin-left: auto;
  margin-right: auto;
  height: 64px;
  background-color: white;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  text-align: center;
  display: flex;
  margin-top: 16px;
}

.schedule-item--padded {
  width: 100%;
  padding: 8px;
}

.schedule-item-text {
  margin-top: auto;
  margin-bottom: auto;
  margin-left: 16px;
}

.getBookButton,
.findBookBtn {
  height: 32px;
  border-radius: 8px;
  padding: 6px;
  background-color: var(--green);
  color: white;
  border: none;
  cursor: pointer;
  margin-left: auto;
  margin-right: 16px;
  margin-top: auto;
  margin-bottom: auto;
}

.schedule-course-row {
  display: flex;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
}

.course-name {
  width: 70%;
  background-color: white;
  color: #000;
  padding: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
  border-radius: 8px;
}

.course-remove-btn {
  width: 30%;
  color: white;
  text-align: center;
  font-size: 24px;
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 8px;
  cursor: pointer;
}

/* ---------- Availability time tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 9999px;
  background-color: #d9f3e3;
  color: #125E06;
  font-size: 0.85rem;
  cursor: pointer;
}

.tag.selected {
  background-color: #125E06;
  color: #ffffff;
}

/* Compact availability grid */
.avail-row {
  display: grid;
  grid-template-columns: 28px repeat(4, 1fr);
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
}

.avail-row > p {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  background: #B4D1BA;
  border-radius: 50%;
  height: 28px;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #051B0C;
}

.avail-row .tag {
  padding: 0.3rem 0.1rem;
  font-size: 0.72rem;
  border-radius: 6px;
  text-align: center;
  display: block;
}

/* ---------- Transaction items ---------- */
.transactionDiv,
.transaction-item {
  width: 90%;
  margin-left: auto;
  margin-right: auto;
  background-color: #B4D1BA;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.05);
  margin-top: 32px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1),
              0 4px 6px -2px rgba(0,0,0,0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.transaction-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 20px -5px rgba(0,0,0,0.18);
}

.transaction-header {
  display: flex;
  align-items: flex-start;
  padding: 8px;
}

.transaction-status-container {
  width: 30%;
  margin-top: 8px;
  margin-left: auto;
  margin-right: 8px;
  align-self: flex-start;
  flex-shrink: 0;
}

.transaction-meta {
  padding: 8px 8px 0 8px;
}

.transaction-meta--spaced {
  margin-top: 8px;
}

.transaction-meta-title {
  font-weight: bold;
}

.transaction-status-pill {
  background-color: white;
  color: black;
  border-radius: 8px;
  padding: 4px 8px;
  border: 1px solid #B4D1BA;
  margin: 0;
}

.transaction-status-pill.status-listed {
  background-color: #e0f7e9;
  color: #125E06;
  border-color: #9bd8b2;
}

.transaction-status-pill.status-pending {
  background-color: #fff8e1;
  color: #8a6d00;
  border-color: #ffe082;
}

.transaction-status-pill.status-completed {
  background-color: #e8f5e9;
  color: #1b5e20;
  border-color: #a5d6a7;
}

.transaction-status-pill.status-cancelled,
.transaction-status-pill.status-removed,
.transaction-status-pill.status-removed_listing,
.transaction-status-pill.status-listing_removed {
  background-color: #f5f5f5;
  color: #616161;
  border-color: #e0e0e0;
}

.transaction-footer-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 16px;
  padding: 0 8px 8px 8px;
  min-width: 0;
  width: 93%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.transaction-footer-row > div {
  min-width: 0;
  overflow: hidden;
}

.transaction-party-label {
  font-weight: bold;
  text-align: left;
  margin-bottom: 2px;
}

.transaction-party-value {
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-meeting {
  margin-left: auto;
  text-align: right;
  min-width: 0;
}

.transaction-meeting p:first-child {
  font-weight: bold;
  margin-bottom: 2px;
}

.transaction-meeting p:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-arrow {
  flex-shrink: 0;
  margin-top: auto;
  margin-bottom: auto;
}

.transaction_cell {
  display: flex;
  margin-top: 16px;
  margin-bottom: 16px;
}

.transaction-button {
  margin-left: auto;
  margin-right: auto;
  width: 40%;
  padding: 8px;
  border-radius: 8px;
  background-color: var(--green);
  color: white;
  border: none;
  cursor: pointer;
}

.transaction-button:hover {
  background-color: #fff;
  color: var(--green);
}

.tx-actions-row {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tx-actions-row--spaced {
  gap: 12px;
  margin-top: 32px;
  margin-bottom: 64px;
}

.tx-actions-row__primary {
  background-color: #125E06;
}

.tx-actions-row__cancel {
  background-color: #8D2B2B;
  color: #fff;
}

.tx-actions-row__cancel:hover {
  background-color: #7A2323;
  color: #fff;
}

.tx-actions-row__remove {
  background-color: #000;
  width: 80%;
  margin: 16px auto;
}

.transaction-image {
  border-radius: 25px;
  padding: 8px;
}

.transaction-id,
.view p.transaction-id {
  text-align: left;
  margin-left: 16px;
}

.transaction-id-value {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.85em;
  word-break: keep-all;
  white-space: nowrap;
}

.transaction-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.transaction-id-row .transaction-id-value {
  margin-left: 0;
}

.transaction-copy-id {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--green);
  background: transparent;
  color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

.transaction-copy-id:hover {
  background: var(--green);
  color: white;
}

.transaction-copy-id:disabled {
  opacity: 0.8;
  cursor: default;
}

.no-tx-message {
  width: 100%;
  text-align: center;
  color: #000;
}

.transactions-intro[hidden] {
  display: none !important;
}

/* ---------- Transaction loading overlay ---------- */
#txLoadingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.28);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

.tx-loading-box {
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  text-align: center;
  min-width: 220px;
}

.tx-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: #005E27;
  animation: tx-spin 0.7s linear infinite;
  margin: 0 auto 8px auto;
}

@keyframes tx-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Modals (shared) ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.modal {
  background: white;
  padding: 0.75rem;
  border-radius: 8px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  margin: auto;
}

.modal h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  text-align: center;
}

.modal label {
  font-size: 0.85rem;
}

.modal input[type="text"],
.modal input[type="email"],
.modal input[type="tel"],
.modal input[type="file"] {
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.modal-buttons button {
  flex: 1;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

/* ---------- Schedule modal ---------- */
.modal--schedule {
  background-color: #B4D1BA;
}

.modal--schedule h2 {
  color: #125E06;
}

.schedule-list {
  margin-top: 24px;
}

.btn-add-course {
  display: block;
  width: 80%;
  margin: 16px auto 0;
  color: #005E27;
  background-color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  cursor: pointer;
}

.modal-buttons--top-spaced {
  margin-top: 32px;
}

.btn-white {
  background-color: white;
  color: black;
}

.btn-dark-green {
  background-color: #005E27;
  color: white;
}

/* ---------- Add Course modal ---------- */
.modal-content--padded {
  padding-bottom: 64px;
}

.label-green {
  color: #39B053;
  display: block;
}

.input-green {
  background-color: #E9FFEE;
  border: 0;
  color: black;
}

.input-teal {
  background-color: #d9f3e3;
  border: 0;
  margin-top: 16px;
}

.modal-action-row {
  float: right;
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.btn-sm-cancel {
  background-color: #fff;
  color: #000;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
}

.btn-sm-add {
  background-color: #39B053;
  color: white;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  border: none;
}

/* Availability label */
.avail-label {
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}

/* ---------- List Book modal ---------- */
.field-row {
  display: flex;
  margin-bottom: 0;
}

.field-half {
  width: 50%;
}

.field-price {
  width: 40%;
  margin-left: auto;
}

.select-green {
  background-color: #E9FFEE;
  height: 36px;
  border: 0;
  padding: 8px;
  border-radius: 8px;
  width: 100%;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.input-number-green {
  height: 36px;
  width: 100%;
  background-color: #E9FFEE;
  border: 0;
  padding: 8px;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 0.95rem;
}

.btn-cancel-list {
  background-color: #fff;
  color: #000;
  border: 1px solid #ccc;
  padding: 8px;
  cursor: pointer;
}

.btn-sell {
  background-color: #125E06;
  color: white;
}

.btn-sell:disabled {
  opacity: 0.6;
  cursor: default;
}
