/* =========================================
   VAULT KELUARGA DENASHURYA — STYLES
   Version 1.0.0
   ========================================= */

:root {
  --bg-primary:    #080c17;
  --bg-secondary:  #0d1526;
  --bg-card:       #111827;
  --bg-card2:      #0f1c30;
  --bg-glass:      rgba(255,255,255,0.04);
  --border:        rgba(255,255,255,0.08);
  --border-gold:   rgba(201,169,110,0.3);
  --gold:          #c9a96e;
  --gold-light:    #e8c98a;
  --gold-dark:     #a07840;
  --rose:          #e8788a;
  --rose-light:    #f5a0af;
  --rose-dark:     #c04060;
  --pink:          #d48fa0;
  --teal:          #4ecdc4;
  --blue:          #4a90d9;
  --purple:        #9b59b6;
  --green:         #2ecc71;
  --red:           #e74c3c;
  --text-primary:  #f0f4ff;
  --text-secondary:#9ca8be;
  --text-muted:    #5a6680;
  --radius:        16px;
  --radius-sm:     10px;
  --shadow:        0 8px 32px rgba(0,0,0,0.4);
  --shadow-gold:   0 0 24px rgba(201,169,110,0.15);
  --transition:    all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-height:    72px;
}

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

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
}

/* ============ SCREENS ============ */
.screen { display: none; width: 100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 10; }
.screen.active { display: flex; }

/* ============ LOCK SCREEN ============ */
#lock-screen {
  background: linear-gradient(135deg, #060a14 0%, #0d1a2e 50%, #060a14 100%);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lock-container {
  width: 100%;
  max-width: 400px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.lock-logo { text-align: center; }

.lock-icon-wrapper {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, rgba(201,169,110,0.15), rgba(201,169,110,0.05));
  border: 1px solid var(--border-gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 40px rgba(201,169,110,0.2);
}

.lock-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--gold-light);
  letter-spacing: 0.5px;
}
.lock-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

.lock-form { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.lock-instruction { color: var(--text-secondary); font-size: 14px; }

.pin-dots { display: flex; gap: 12px; }
.pin-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-gold);
  background: transparent;
  transition: var(--transition);
}
.pin-dot.filled { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(201,169,110,0.5); }
.pin-dot.shake { animation: shake 0.3s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 12px;
}

.num-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.num-btn:hover, .num-btn:active {
  background: rgba(201,169,110,0.15);
  border-color: var(--border-gold);
  transform: scale(0.96);
}
.num-clear { color: var(--text-secondary); font-size: 16px; }
.num-ok { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; border: none; }
.num-ok:hover { opacity: 0.9; transform: scale(0.96); }

.pin-error { color: var(--red); font-size: 13px; min-height: 18px; text-align: center; }
.pin-hint { color: var(--text-muted); font-size: 12px; text-align: center; }

/* ============ SETUP SCREEN ============ */
#setup-screen {
  background: var(--bg-primary);
  align-items: center; justify-content: center;
}
.setup-container {
  max-width: 420px; width: 100%;
  padding: 40px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.setup-title { font-family: 'Playfair Display', serif; font-size: 24px; color: var(--gold-light); }
.setup-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.setup-input {
  width: 100%; padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 16px; font-family: inherit;
  outline: none; transition: var(--transition);
}
.setup-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,169,110,0.1); }

/* ============ MAIN APP ============ */
#main-app {
  flex-direction: column;
  background: var(--bg-primary);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(13,21,38,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  transition: var(--transition); padding: 6px 0;
}
.nav-btn.active { color: var(--gold); }
.nav-btn:hover { color: var(--text-primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 500; }

/* Main Content */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  margin-bottom: var(--nav-height);
}

/* Pages */
.page {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 16px 16px 24px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.page.active { display: block; }
.page::-webkit-scrollbar { display: none; }

/* ============ HEADERS ============ */
.page-header {
  display: flex; align-items: center;
  gap: 12px; margin-bottom: 24px;
  padding-top: 8px;
}
.page-title { font-size: 18px; font-weight: 600; flex: 1; }
.back-btn {
  width: 36px; height: 36px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-primary);
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.back-btn:hover { border-color: var(--gold); color: var(--gold); }

.header-greeting { color: var(--text-secondary); font-size: 13px; }
.header-title { font-size: 20px; font-weight: 700; }
.lock-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 16px; cursor: pointer; transition: var(--transition);
}
.lock-btn:hover { border-color: var(--border-gold); }

/* ============ SUMMARY CARDS ============ */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: var(--transition);
  position: relative; overflow: hidden;
}
.summary-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.card-barra::before { background: linear-gradient(90deg, var(--gold), var(--gold-dark)); }
.card-riska::before { background: linear-gradient(90deg, var(--rose), var(--rose-dark)); }
.card-fertility::before { background: linear-gradient(90deg, var(--pink), #b06070); }
.card-reminder::before { background: linear-gradient(90deg, var(--teal), #2a9d94); }
.summary-card:hover { border-color: var(--border-gold); transform: translateY(-1px); }
.card-icon-wrap { font-size: 24px; }
.card-info { flex: 1; min-width: 0; }
.card-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-arrow { color: var(--text-muted); font-size: 18px; }

/* ============ SECTION TITLES ============ */
.section-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
  margin: 24px 0 12px;
}

/* ============ QUICK ACTIONS ============ */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: var(--transition);
  color: var(--text-primary); font-size: 13px; font-weight: 500;
}
.qa-btn span:first-child { font-size: 24px; }
.qa-btn:hover { border-color: var(--border-gold); background: rgba(201,169,110,0.05); }

/* ============ REMINDERS ============ */
.reminder-list { display: flex; flex-direction: column; gap: 10px; }
.reminder-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
}
.reminder-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.reminder-text { font-size: 14px; font-weight: 500; }
.reminder-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============ BARRA PAGE ============ */
.barra-status-card {
  background: linear-gradient(135deg, rgba(201,169,110,0.1), rgba(201,169,110,0.03));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.bscard-label { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.riska-hero {
  background: linear-gradient(135deg, rgba(232,120,138,0.12), rgba(232,120,138,0.03));
  border: 1px solid rgba(232,120,138,0.3);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 4px;
}
.riska-hero-label { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

.mood-selector { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
.mood-btn {
  width: 52px; height: 52px;
  border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: 24px; cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.mood-btn:hover, .mood-btn.selected {
  transform: scale(1.15);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201,169,110,0.3);
}
.selected-mood { font-size: 14px; color: var(--gold); font-weight: 500; min-height: 20px; }

.hug-alert {
  display: none;
  background: rgba(232,120,138,0.15);
  border: 1px solid rgba(232,120,138,0.4);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 16px;
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
}
.hug-alert.visible { display: block; }

/* ============ FORMS ============ */
.med-log-form, .lab-form, .moment-form, .fertility-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 8px;
}
.form-input, .form-textarea, select.form-input {
  width: 100%; padding: 13px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  outline: none; transition: var(--transition);
  -webkit-appearance: none;
}
.form-input:focus, .form-textarea:focus, select.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-textarea.big { min-height: 120px; }
.form-row { display: flex; gap: 10px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.half { flex: 1; }
.form-input.half { flex: 1; }
.form-label { font-size: 12px; color: var(--text-secondary); }
select.form-input option { background: var(--bg-card); }

/* Lab Grid */
.lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lab-item { display: flex; flex-direction: column; gap: 4px; }
.lab-label { font-size: 11px; color: var(--text-muted); }

/* ============ BUTTONS ============ */
.btn-primary {
  width: 100%; padding: 15px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  letter-spacing: 0.3px;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-gold { background: linear-gradient(135deg, #d4af70, #a07840); }
.btn-rose { background: linear-gradient(135deg, var(--rose), var(--rose-dark)); }
.btn-pink { background: linear-gradient(135deg, var(--pink), #9a5060); }

/* ============ LOG LISTS ============ */
.log-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.log-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
}
.log-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.log-item-title { font-size: 14px; font-weight: 600; }
.log-item-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.log-item-body { font-size: 13px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }
.log-item-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 6px;
}
.badge-normal { background: rgba(46,204,113,0.15); color: var(--green); }
.badge-low { background: rgba(231,76,60,0.15); color: var(--red); }
.badge-watch { background: rgba(241,196,15,0.15); color: #f1c40f; }
.log-delete {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none;
  color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 4px;
  opacity: 0; transition: var(--transition);
}
.log-item:hover .log-delete { opacity: 1; }
.log-delete:hover { color: var(--red); }

.empty-state { color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px 0; }

/* ============ FERTILITY ============ */
.fertility-info-card {
  background: rgba(212,143,160,0.1);
  border: 1px solid rgba(212,143,160,0.3);
  border-radius: var(--radius-sm); padding: 12px 16px;
  margin-bottom: 8px;
}
.fertility-info-text { font-size: 13px; color: var(--pink); }
.fertility-prediction {
  background: linear-gradient(135deg, rgba(212,143,160,0.12), rgba(212,143,160,0.03));
  border: 1px solid rgba(212,143,160,0.3);
  border-radius: var(--radius); padding: 20px;
  margin: 12px 0;
}
.fp-title { font-size: 14px; font-weight: 700; color: var(--pink); margin-bottom: 8px; }
.fp-content { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }

/* ============ TIMER ============ */
.timer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.timer-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
.timer-display {
  font-size: 64px; font-weight: 700;
  color: var(--gold-light);
  font-family: 'Playfair Display', serif;
  margin-bottom: 24px;
  letter-spacing: 2px;
}
.timer-controls { display: flex; gap: 12px; justify-content: center; }
.btn-timer {
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-timer-reset {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-timer:hover { opacity: 0.9; }

/* ============ MOMENTS ============ */
.moments-intro { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.moments-grid { display: flex; flex-direction: column; gap: 12px; }
.moment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
}
.moment-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.moment-type-badge {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--gold);
}
.moment-date { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.moment-card-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.moment-card-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ============ SETTINGS ============ */
.settings-list { display: flex; flex-direction: column; gap: 1px; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); }
.settings-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  cursor: pointer; transition: var(--transition);
}
.settings-item:hover { background: rgba(201,169,110,0.06); }
.settings-item.danger:hover { background: rgba(231,76,60,0.08); }
.settings-icon { font-size: 22px; }
.settings-info { flex: 1; }
.settings-label { font-size: 14px; font-weight: 500; }
.settings-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.settings-item.danger .settings-label { color: var(--red); }
.settings-arrow { color: var(--text-muted); font-size: 18px; }
.app-info { text-align: center; margin-top: 32px; padding: 24px; color: var(--text-muted); font-size: 12px; line-height: 2; }

/* ============ MODAL ============ */
.modal-overlay {
  display: none; position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-overlay.visible { display: flex; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--gold-light); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-modal-cancel {
  flex: 1; padding: 13px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: 14px; cursor: pointer; transition: var(--transition);
}
.btn-modal-cancel:hover { border-color: var(--border-gold); color: var(--text-primary); }
.modal-actions .btn-primary { flex: 1; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: calc(var(--nav-height) + 16px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(201,169,110,0.95);
  color: #1a0f00; font-size: 13px; font-weight: 600;
  padding: 12px 24px; border-radius: 100px;
  white-space: nowrap; z-index: 300;
  opacity: 0; transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.toast.error { background: rgba(231,76,60,0.95); color: #fff; }

/* ============ LOGIN FORM ============ */
.login-field { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; letter-spacing: 0.3px; }
.login-input {
  width: 100%; padding: 15px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 15px; font-family: inherit;
  outline: none; transition: var(--transition);
}
.login-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,169,110,0.12); }
.pw-wrap { position: relative; width: 100%; }
.pw-wrap .setup-input, .pw-wrap .login-input { padding-right: 48px; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 16px;
  cursor: pointer; color: var(--text-muted); padding: 4px;
  transition: var(--transition);
}
.pw-toggle:hover { color: var(--gold); }
.setup-section-label {
  font-size: 13px; font-weight: 600;
  color: var(--gold); margin-top: 4px;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============ RESPONSIVE ============ */
@media (min-width: 480px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .numpad { grid-template-columns: repeat(3, 80px); gap: 14px; }
  .num-btn { width: 80px; height: 80px; }
}
@media (min-width: 768px) {
  .main-content { max-width: 600px; margin: 0 auto var(--nav-height); }
  .bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); border-radius: var(--radius) var(--radius) 0 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .toast { bottom: calc(var(--nav-height) + 24px); }
}
