/* ====================================
   KosBali Manager — Global Stylesheet
   ==================================== */

:root {
  --bg-dark: #0d1117;
  --bg-card: #161b27;
  --bg-card2: #1e2535;
  --border: rgba(255,255,255,0.08);
  --text-primary: #f0f4ff;
  --text-secondary: #8b9cb8;
  --accent: #38d9a9;
  --accent2: #ffd43b;
  --accent3: #ff6b6b;
  --accent-glow: rgba(56,217,169,0.15);
  --gradient-hero: linear-gradient(135deg, #0d1117 0%, #1a2744 50%, #0d2435 100%);
  --gradient-card: linear-gradient(145deg, #1e2535, #161b27);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px rgba(56,217,169,0.2);
  --font: 'Plus Jakarta Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== PAGES ===== */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* ===== LANDING ===== */
.landing-bg {
  position: fixed; inset: 0; z-index: 0;
  background: var(--gradient-hero);
  overflow: hidden;
}
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.25;
  animation: blobFloat 8s ease-in-out infinite;
}
.blob-1 { width: 500px; height: 500px; background: #38d9a9; top: -100px; right: -100px; animation-delay: 0s; }
.blob-2 { width: 400px; height: 400px; background: #4dabf7; bottom: -80px; left: -80px; animation-delay: 3s; }
.blob-3 { width: 300px; height: 300px; background: #ffd43b; top: 40%; left: 40%; animation-delay: 5s; }

@keyframes blobFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.landing-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; padding: 2rem;
  text-align: center;
}

.landing-header { margin-bottom: 3rem; }
.logo-icon { font-size: 4rem; margin-bottom: 1rem; filter: drop-shadow(0 0 20px var(--accent)); }
.landing-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700; letter-spacing: -1px;
  color: var(--text-primary);
}
.landing-title .accent { color: var(--accent); }
.landing-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--text-secondary); margin-top: 0.75rem;
}

.role-cards {
  display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center;
}
.role-card {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 2.5rem 3rem;
  cursor: pointer; transition: all 0.3s ease;
  text-align: center; color: var(--text-primary);
  min-width: 180px;
}
.role-card:hover {
  transform: translateY(-6px);
  background: rgba(56,217,169,0.1);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.role-icon { font-size: 3rem; margin-bottom: 1rem; }
.role-label { font-size: 1.1rem; font-weight: 700; }
.role-desc { font-size: 0.825rem; color: var(--text-secondary); margin-top: 0.25rem; }

.landing-footer {
  margin-top: 3rem; color: var(--text-secondary); font-size: 0.8rem;
}

/* ===== AUTH ===== */
.auth-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: var(--gradient-hero); position: relative;
}
.back-btn {
  position: absolute; top: 1.5rem; left: 1.5rem;
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary); padding: 0.5rem 1rem;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font); transition: all 0.2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-icon { font-size: 3rem; margin-bottom: 1rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 1rem; }

/* ===== NAVBAR ===== */
.navbar {
  background: rgba(13,17,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; height: 64px;
  flex-wrap: wrap; gap: 0.5rem;
}
.nav-logo { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.nav-logo .accent { color: var(--accent); }
.nav-actions { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-btn {
  background: none; border: none; color: var(--text-secondary);
  padding: 0.4rem 0.8rem; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font); font-size: 0.875rem;
  transition: all 0.2s; white-space: nowrap;
}
.nav-btn:hover, .nav-btn.active { background: var(--accent-glow); color: var(--accent); }
.nav-btn.logout { color: var(--accent3); }
.nav-btn.logout:hover { background: rgba(255,107,107,0.1); }

/* ===== CONTAINER & LAYOUT ===== */
.container { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.tab-content { display: none; min-height: calc(100vh - 64px); }
.tab-content.active { display: block; }

.page-header { margin-bottom: 2rem; }
.page-header h2 { font-size: 1.75rem; font-weight: 800; }
.page-header p { color: var(--text-secondary); margin-top: 0.25rem; }

.section-title {
  font-size: 1.1rem; font-weight: 700; color: var(--accent);
  margin: 1.5rem 0 1rem; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; text-align: center;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.urgent { border-color: rgba(255,107,107,0.3); background: linear-gradient(145deg, #2a1a1a, #1e1414); }
.stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--accent); }
.stat-card.urgent .stat-value { color: var(--accent3); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* ===== BILLS LIST ===== */
.bills-list { display: flex; flex-direction: column; gap: 1rem; }
.bill-card {
  background: var(--gradient-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center;
  transition: all 0.2s;
}
.bill-card:hover { border-color: rgba(56,217,169,0.3); }
.bill-card.paid { border-color: rgba(56,217,169,0.2); opacity: 0.8; }
.bill-card.unpaid { border-left: 3px solid var(--accent3); }
.bill-card.pending { border-left: 3px solid var(--accent2); }

.bill-info .bill-room { font-weight: 700; font-size: 1rem; }
.bill-info .bill-tenant { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.2rem; }
.bill-info .bill-details { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.4rem; }
.bill-amount { font-size: 1.25rem; font-weight: 800; color: var(--accent2); text-align: right; }
.bill-status { font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.75rem; border-radius: 20px; margin-top: 0.35rem; display: inline-block; }
.status-paid { background: rgba(56,217,169,0.15); color: var(--accent); }
.status-unpaid { background: rgba(255,107,107,0.15); color: var(--accent3); }
.status-pending { background: rgba(255,212,59,0.15); color: var(--accent2); }
.status-no-data { background: rgba(139,156,184,0.15); color: var(--text-secondary); }

.bill-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.btn-small { padding: 0.3rem 0.75rem; font-size: 0.8rem; border-radius: var(--radius-sm); border: none; cursor: pointer; font-family: var(--font); font-weight: 600; transition: all 0.2s; }
.btn-approve { background: var(--accent); color: #0d1117; }
.btn-approve:hover { filter: brightness(1.1); }
.btn-faktur { background: var(--accent2); color: #0d1117; }
.btn-faktur:hover { filter: brightness(1.1); }
.btn-paid { background: rgba(56,217,169,0.2); color: var(--accent); border: 1px solid var(--accent); }
.btn-paid:hover { background: var(--accent); color: #0d1117; }

/* ===== ROOMS GRID ===== */
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.room-card {
  background: var(--gradient-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; text-align: center; transition: all 0.2s;
}
.room-card:hover { border-color: var(--accent); }
.room-card .room-num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.room-card .room-name { font-weight: 700; margin-top: 0.25rem; }
.room-card .room-tenant { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; }
.room-card .room-price { color: var(--accent2); font-size: 0.9rem; font-weight: 600; margin-top: 0.35rem; }

/* ===== SETTINGS CARD ===== */
.settings-card {
  background: var(--gradient-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
}
.settings-card h3 {
  font-size: 1rem; font-weight: 700; color: var(--accent);
  margin: 1.5rem 0 1rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.settings-card h3:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.settings-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.75rem; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-secondary); }
.form-input {
  width: 100%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); padding: 0.75rem 1rem;
  font-family: var(--font); font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--accent); background: rgba(56,217,169,0.05); }
.form-input.large { font-size: 1.5rem; font-weight: 700; text-align: center; padding: 1rem; }
.form-input.small { width: auto; padding: 0.4rem 0.75rem; font-size: 0.875rem; }
select.form-input option { background: var(--bg-card2); }
textarea.form-input { resize: vertical; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #20c997);
  color: #0d1117; border: none; padding: 0.875rem 2rem;
  border-radius: var(--radius-sm); font-family: var(--font);
  font-weight: 700; font-size: 0.95rem; cursor: pointer;
  transition: all 0.25s; width: 100%; margin-top: 0.5rem;
  letter-spacing: 0.5px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(56,217,169,0.35); }
.btn-primary.small { width: auto; padding: 0.5rem 1.25rem; font-size: 0.875rem; margin-top: 0; }
.btn-primary.full { width: 100%; }
.btn-secondary {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); padding: 0.875rem 2rem;
  border-radius: var(--radius-sm); font-family: var(--font);
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* ===== MESSAGES ===== */
.error-msg { color: var(--accent3); background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.2); border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.875rem; margin-top: 0.75rem; }
.success-msg { color: var(--accent); background: rgba(56,217,169,0.1); border: 1px solid rgba(56,217,169,0.2); border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.875rem; margin-top: 0.75rem; }
.info-banner { background: rgba(56,217,169,0.1); border: 1px solid rgba(56,217,169,0.25); border-radius: var(--radius); padding: 1rem 1.5rem; color: var(--accent); font-weight: 600; margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 2.5rem; text-align: center; cursor: pointer;
  transition: all 0.25s; background: rgba(255,255,255,0.02);
  overflow: hidden; position: relative;
}
.upload-area:hover { border-color: var(--accent); background: var(--accent-glow); }
.upload-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.upload-area p { font-weight: 600; }
.upload-area span { font-size: 0.85rem; color: var(--text-secondary); }
.photo-preview { width: 100%; max-height: 280px; object-fit: cover; border-radius: var(--radius-sm); }

.reading-inputs { display: flex; flex-direction: column; gap: 0.5rem; }
.reading-prev {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(255,255,255,0.03); border-radius: var(--radius-sm);
  padding: 0.75rem 1rem; font-size: 0.9rem;
}
.prev-label { color: var(--text-secondary); }
.prev-value { font-weight: 700; color: var(--accent2); }

/* ===== FILTER ROW ===== */
.filter-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
  width: 100%; max-width: 640px; max-height: 90vh;
  overflow-y: auto; position: relative;
  box-shadow: var(--shadow);
}
.modal-content.small-modal { max-width: 400px; }
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(255,255,255,0.08); border: none;
  color: var(--text-secondary); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 0.9rem;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(255,107,107,0.2); color: var(--accent3); }
.modal-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.25rem; }
.modal-sub { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* ===== ROOMS SETUP MODAL ===== */
.rooms-setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.room-setup-card {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.25rem;
}
.room-setup-card h4 { font-size: 0.9rem; font-weight: 700; color: var(--accent); margin-bottom: 0.75rem; }
.room-setup-card .form-group { margin-bottom: 0.75rem; }
.room-setup-card .form-group label { font-size: 0.75rem; }
.room-setup-card .form-input { padding: 0.5rem 0.75rem; font-size: 0.875rem; }

/* ===== FAKTUR ===== */
.faktur-modal { max-width: 700px; background: #fff; color: #000; }
.faktur-container { padding: 0.5rem; font-family: Arial, sans-serif; }
.faktur-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #ddd;
}
.faktur-kos-name { font-weight: 700; font-size: 1rem; }
.faktur-kos-address { font-size: 0.8rem; color: #555; margin-top: 0.25rem; line-height: 1.5; }
.faktur-title-block { text-align: right; }
.faktur-big-title { font-size: 2.5rem; font-weight: 700; letter-spacing: 2px; }
.faktur-saldo { margin-top: 0.5rem; font-size: 0.9rem; }
.faktur-saldo strong { display: block; font-size: 1.2rem; }

.faktur-meta { margin-bottom: 1.5rem; }
.faktur-meta-row {
  display: grid; grid-template-columns: 160px 20px 1fr;
  font-size: 0.875rem; margin-bottom: 0.3rem;
}

.faktur-tenant-block { margin-bottom: 1.5rem; }
.faktur-ditagih { font-size: 0.875rem; color: #555; }
.faktur-tenant-name { font-weight: 700; font-size: 1rem; }

.faktur-table {
  width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-bottom: 1.5rem;
}
.faktur-table th {
  background: #111; color: #fff; padding: 0.6rem 0.75rem; text-align: left;
}
.faktur-table th:nth-child(3), .faktur-table th:nth-child(4), .faktur-table th:nth-child(5) { text-align: right; }
.faktur-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #eee; vertical-align: middle; }
.faktur-table td:nth-child(3), .faktur-table td:nth-child(4), .faktur-table td:nth-child(5) { text-align: right; }
.faktur-subtotal td { padding-top: 0.75rem; font-size: 0.875rem; border-bottom: none; }
.faktur-total td { font-weight: 700; border-bottom: none; font-size: 0.9rem; }
.faktur-due-row td { background: #eee; font-weight: 700; }

.faktur-footer { font-size: 0.8rem; color: #444; line-height: 1.8; border-top: 1px solid #ddd; padding-top: 1.5rem; }
.faktur-actions { display: flex; gap: 1rem; margin-top: 1.5rem; justify-content: flex-end; }
.faktur-actions .btn-primary { width: auto; margin-top: 0; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .navbar { height: auto; padding: 0.75rem 1rem; }
  .nav-actions { width: 100%; padding-bottom: 0.5rem; }
  .nav-btn { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
  .bill-card { grid-template-columns: 1fr; }
  .bill-amount { text-align: left; }
  .faktur-header { flex-direction: column; gap: 1rem; }
  .faktur-title-block { text-align: left; }
  .rooms-setup-grid { grid-template-columns: 1fr; }
  .role-cards { flex-direction: column; align-items: center; }
  .role-card { width: 100%; max-width: 300px; }
}

/* ===== PRINT ===== */
@media print {
  .no-print { display: none !important; }
  .modal-overlay { position: static; background: none; padding: 0; }
  .modal-content { border: none; box-shadow: none; max-height: none; overflow: visible; }
  body { background: #fff; }
}
