/* ============================================================
   RentalsHandled — Tenant Portal Styles
   Sprint 1-2 | Mobile-first, dark + #00C2A8 (teal) scheme
   ============================================================ */

/* ---- RESET & BASE ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --teal:       #00C2A8;
  --teal-dark:  #00a890;
  --teal-light: rgba(0, 194, 168, 0.12);
  --red:        #dc2626;
  --amber:      #f59e0b;
  --green:      #16a34a;
  --bg:         #0F172A;
  --card:       #1E293B;
  --border:     #334155;
  --text:       #F8FAFC;
  --muted:      #94A3B8;
  --white:      #ffffff;
  --shadow:     0 1px 3px rgba(0,0,0,0.10), 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);
  --radius:     10px;
  --radius-sm:  6px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- LAYOUT ---- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---- TOP NAV ---- */
.nav {
  background: var(--card);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.rh-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
}
.rh-logo-icon { font-size: 20px; }
.rh-logo-wordmark { font-size: 17px; font-weight: 700; }

.nav-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: var(--white);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-logout:hover { background: rgba(255,255,255,0.15); }

/* ---- MAIN CONTENT ---- */
.main {
  flex: 1;
  overflow-y: auto;
}

/* ---- PAGES ---- */
.page {
  display: none;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- BOTTOM TAB BAR ---- */
.tab-bar {
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  position: sticky;
  bottom: 0;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  background: none;
  border: none;
  cursor: pointer;
  gap: 2px;
  transition: color 0.15s;
  color: var(--muted);
  font-size: 11px;
}

.tab-btn.active { color: var(--teal); }
.tab-btn:hover  { color: var(--teal); }

.tab-icon {
  font-size: 22px;
  line-height: 1;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  font-size: 40px;
  margin-bottom: 8px;
}

.login-card h1 {
  color: var(--teal);
  font-size: 22px;
  margin-bottom: 4px;
}

.login-card .tagline {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

/* ---- RENT DUE HERO ---- */
.rent-hero {
  background: var(--teal);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 14px;
  text-align: center;
}

.rent-hero.overdue { background: var(--red); }
.rent-hero.pending { background: var(--amber); }
.rent-hero.paid    { background: var(--green); }

.rent-hero .label {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.rent-hero .amount {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.rent-hero .due-info {
  font-size: 14px;
  opacity: 0.85;
}

/* ---- LEASE INFO ---- */
.lease-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-item label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-item span {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background: var(--teal);
  color: #0F172A;
}
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-danger  { background: var(--red); color: var(--white); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--teal);
  color: var(--teal);
}
.btn-outline:hover { background: var(--teal-light); }

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  width: auto;
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.12);
}

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239ca3af' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

textarea.form-control { resize: vertical; min-height: 90px; }

/* ---- PAYMENT METHOD TABS ---- */
.payment-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.payment-tab {
  flex: 1;
  padding: 10px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s;
}

.payment-tab.active {
  background: var(--teal);
  color: #0F172A;
  font-weight: 600;
}

/* ---- STRIPE ELEMENTS CONTAINER ---- */
#stripe-element {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--bg);
  margin-bottom: 16px;
  min-height: 44px;
}

#stripe-element.StripeElement--focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 194, 168, 0.12);
}

/* ---- STATUS BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-paid     { background: rgba(34,197,94,.15); color: #22c55e; }
.badge-pending  { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-overdue  { background: rgba(239,68,68,.15); color: #ef4444; }
.badge-open     { background: rgba(99,102,241,.15); color: #818cf8; }
.badge-scheduled { background: rgba(99,102,241,.15); color: #818cf8; }
.badge-completed { background: rgba(34,197,94,.15); color: #22c55e; }
.badge-cancelled { background: rgba(148,163,184,.1); color: var(--muted); }

/* ---- MAINTENANCE LIST ---- */
.ticket-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ticket-item:last-child { border-bottom: none; }

.ticket-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ticket-content { flex: 1; min-width: 0; }

.ticket-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-meta {
  font-size: 12px;
  color: var(--muted);
}

/* ---- DOCUMENT LIST ---- */
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover .doc-title { color: var(--teal); }

.doc-icon { font-size: 28px; flex-shrink: 0; }

.doc-content { flex: 1; min-width: 0; }

.doc-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
  transition: color 0.1s;
}

.doc-meta { font-size: 12px; color: var(--muted); }

/* ---- PAYMENT HISTORY ---- */
.payment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.payment-item:last-child { border-bottom: none; }

.payment-item-left { flex: 1; }
.payment-item-period {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}
.payment-item-method { font-size: 12px; color: var(--muted); }

.payment-item-right { text-align: right; }
.payment-item-amount {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 3px;
}

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.alert-error   { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.alert-info    { background: rgba(99,102,241,.15); color: #93c5fd; border: 1px solid rgba(99,102,241,.3); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ---- LOADING SPINNER ---- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-teal {
  border-color: rgba(0, 194, 168, 0.3);
  border-top-color: var(--teal);
}

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

/* ---- PAGE HEADER ---- */
.page-header {
  margin-bottom: 18px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.page-header p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---- DIVIDER ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ---- SENT CONFIRMATION ---- */
.magic-sent {
  background: var(--teal-light);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--teal-dark);
}
.magic-sent .sent-icon { font-size: 40px; margin-bottom: 8px; }
.magic-sent h3 { font-size: 18px; margin-bottom: 6px; }
.magic-sent p  { font-size: 14px; opacity: 0.85; }

/* ---- RESPONSIVE: wider screens ---- */
@media (min-width: 540px) {
  .app {
    box-shadow: var(--shadow-md);
    border-left:  1px solid var(--border);
    border-right: 1px solid var(--border);
    margin-top: 20px;
    margin-bottom: 20px;
    min-height: calc(100vh - 40px);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .login-page { background: var(--bg); }
}