/* =========================================================
   LIFELOG — Dark Premium + Warm Accent Theme
========================================================= */

:root{
  --bg: #0B0F14;
  --bg-elevated: #0E141B;
  --card: #121820;
  --card-hover: #161e28;
  --border: #26313D;
  --border-soft: #1c2530;

  --text: #F3F5F7;
  --text-muted: #9AA6B2;
  --text-faint: #63707D;

  --amber: #F5A524;
  --amber-light: #FFC259;
  --orange: #FF7A45;
  --amber-glow: rgba(245, 165, 36, 0.35);

  --success: #34D399;
  --danger: #F76B6B;
  --info: #5AC8FA;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-soft: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-glow: 0 10px 30px rgba(245, 165, 36, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --sidebar-w: 268px;
}

*{ box-sizing: border-box; }

html, body{
  margin:0; padding:0;
  background: radial-gradient(1200px 800px at 85% -10%, rgba(245,165,36,0.07), transparent 60%),
              radial-gradient(900px 700px at -10% 110%, rgba(255,122,69,0.06), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; }
ul{ list-style:none; margin:0; padding:0; }

::selection{ background: var(--amber-glow); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar{ width: 10px; height:10px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover{ background: var(--amber); }

/* =========================================================
   LAYOUT
========================================================= */
.app-shell{
  display: flex;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar{
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0D1218 0%, #0A0E13 100%);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 4px 8px 28px 8px;
}
.brand-icon{
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--amber), var(--orange));
  display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow-glow);
  flex-shrink:0;
}
.brand-icon svg{ width:22px; height:22px; stroke: #0B0F14; }
.brand-text h1{
  font-size: 19px; font-weight: 800; margin:0; letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff, var(--amber-light));
  -webkit-background-clip: text; background-clip:text; color: transparent;
}
.brand-text p{
  margin:2px 0 0 0; font-size: 11px; color: var(--text-faint); font-weight: 500;
}

.nav-group{ margin-bottom: 8px; }
.nav-link{
  display:flex; align-items:center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 4px;
  transition: all .18s ease;
  border: 1px solid transparent;
}
.nav-link svg{ width: 18px; height: 18px; flex-shrink:0; opacity: .85; }
.nav-link:hover{
  background: var(--card);
  color: var(--text);
  border-color: var(--border-soft);
}
.nav-link.active{
  background: linear-gradient(135deg, rgba(245,165,36,0.15), rgba(255,122,69,0.06));
  color: var(--amber-light);
  border-color: rgba(245,165,36,0.25);
  font-weight: 600;
}
.nav-link.active svg{ opacity: 1; stroke: var(--amber-light); }

.sidebar-footer{
  margin-top: auto;
  padding: 16px 12px 4px 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
  text-align: center;
}

/* mobile topbar */
.mobile-topbar{
  display:none;
  align-items:center;
  justify-content:space-between;
  padding: 14px 18px;
  background: #0D1218;
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top:0; z-index: 200;
}
.mobile-topbar .brand{ padding: 0; }
.mobile-topbar .brand-text h1{ font-size: 17px; }
.hamburger{
  width: 40px; height:40px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  color: var(--text);
  cursor: pointer;
}

/* ---------- MAIN CONTENT ---------- */
.main-content{
  flex: 1;
  min-width: 0;
  padding: 36px 42px 60px 42px;
}

.page-header{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap: 20px; margin-bottom: 30px; flex-wrap: wrap;
}
.page-header h2{
  font-size: 28px; font-weight: 800; margin:0 0 6px 0; letter-spacing: -0.3px;
}
.page-header p{
  margin:0; color: var(--text-muted); font-size: 14.5px;
}

/* =========================================================
   COMPONENTS
========================================================= */

/* Buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn svg{ width:16px; height:16px; }
.btn-primary{
  background: linear-gradient(135deg, var(--amber), var(--orange));
  color: #17110A;
  box-shadow: 0 6px 18px rgba(245,165,36,0.25);
}
.btn-primary:hover{ transform: translateY(-1px); box-shadow: 0 10px 24px rgba(245,165,36,0.35); }
.btn-secondary{
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover{ background: var(--card-hover); border-color: var(--amber); }
.btn-danger{
  background: rgba(247,107,107,0.12);
  color: #FF9B9B;
  border-color: rgba(247,107,107,0.3);
}
.btn-danger:hover{ background: rgba(247,107,107,0.2); }
.btn-ghost{
  background: transparent; color: var(--text-muted); border-color: var(--border-soft);
}
.btn-ghost:hover{ color: var(--text); border-color: var(--border); }
.btn-block{ width: 100%; }
.btn-sm{ padding: 7px 12px; font-size: 12.5px; }

/* Stat Cards */
.stats-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}
.stat-card{
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all .2s ease;
}
.stat-card::before{
  content:'';
  position: absolute; top:0; left:0; right:0; height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  opacity: 0; transition: opacity .2s ease;
}
.stat-card:hover{ transform: translateY(-3px); border-color: var(--border); box-shadow: var(--shadow-soft); }
.stat-card:hover::before{ opacity: 1; }
.stat-card .stat-icon{
  width: 38px; height:38px; border-radius: 10px;
  background: rgba(245,165,36,0.1);
  display:flex; align-items:center; justify-content:center;
  margin-bottom: 14px;
}
.stat-card .stat-icon svg{ width:19px; height:19px; stroke: var(--amber-light); }
.stat-card .stat-value{ font-size: 26px; font-weight: 800; margin:0 0 2px 0; }
.stat-card .stat-label{ font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

/* Today's Thought */
.thought-panel{
  background: linear-gradient(135deg, rgba(245,165,36,0.10), rgba(18,24,32,0.4) 60%), var(--card);
  border: 1px solid rgba(245,165,36,0.2);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.thought-panel::after{
  content: '\201D';
  position: absolute; right: 24px; top: -30px;
  font-size: 180px; font-family: Georgia, serif; color: rgba(245,165,36,0.06);
  line-height: 1;
}
.thought-label{
  display:inline-flex; align-items:center; gap:8px;
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--amber-light); margin-bottom: 16px;
}
.thought-label svg{ width:14px; height:14px; }
.thought-text{
  font-size: 24px; line-height: 1.5; font-weight: 600; color: var(--text);
  margin: 0 0 16px 0; max-width: 780px;
}
.thought-source{ color: var(--text-muted); font-size: 14px; font-weight: 500; }
.thought-source b{ color: var(--amber-light); font-weight: 600;}
.thought-cat{
  display:inline-block; margin-top: 14px;
}

/* Section heading */
.section-heading{
  display:flex; align-items:center; justify-content:space-between;
  margin: 8px 0 18px 0; flex-wrap: wrap; gap: 12px;
}
.section-heading h3{ font-size: 18px; font-weight: 700; margin:0; }
.section-heading .link-more{ font-size: 13.5px; color: var(--amber-light); font-weight: 600; display:flex; align-items:center; gap:4px; }

/* Category badge */
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  background: rgba(245,165,36,0.12);
  color: var(--amber-light);
  border: 1px solid rgba(245,165,36,0.25);
}
/* varied badge colors by hashing category name via nth-of-type-ish classes */
.badge.c-Keuangan{ background: rgba(90,200,250,0.12); color: #7FD4FF; border-color: rgba(90,200,250,0.25); }
.badge.c-Bisnis{ background: rgba(52,211,153,0.12); color: #6EE7B7; border-color: rgba(52,211,153,0.25); }
.badge.c-Pendidikan{ background: rgba(167,139,250,0.14); color: #C4B5FD; border-color: rgba(167,139,250,0.3); }
.badge.c-Karier{ background: rgba(251,146,60,0.14); color: #FDBA74; border-color: rgba(251,146,60,0.3); }
.badge.c-Relasi{ background: rgba(244,114,182,0.14); color: #F9A8D4; border-color: rgba(244,114,182,0.3); }
.badge.c-Motivasi{ background: rgba(245,165,36,0.14); color: var(--amber-light); }
.badge.c-Ide{ background: rgba(96,165,250,0.14); color: #93C5FD; border-color: rgba(96,165,250,0.3); }
.badge.c-Pengalaman{ background: rgba(52,211,153,0.1); color: #86EFAC; border-color: rgba(52,211,153,0.2); }
.badge.c-Lainnya{ background: rgba(154,166,178,0.14); color: #C6CFD8; border-color: rgba(154,166,178,0.25); }

/* Card grid */
.card-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.note-card{
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 22px;
  display:flex; flex-direction: column;
  transition: all .2s ease;
  position: relative;
}
.note-card:hover{
  transform: translateY(-4px);
  border-color: rgba(245,165,36,0.3);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}
.note-card-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.note-fav-btn{
  background: none; border:none; cursor:pointer; color: var(--text-faint);
  display:flex; padding: 2px; transition: all .15s ease;
}
.note-fav-btn svg{ width:18px; height:18px; }
.note-fav-btn.active{ color: var(--amber); }
.note-fav-btn:hover{ color: var(--amber-light); transform: scale(1.1); }

.note-title{
  font-size: 16.5px; font-weight: 700; margin: 0 0 8px 0; line-height: 1.35;
  color: var(--text);
}
.note-excerpt{
  font-size: 13.8px; color: var(--text-muted); line-height: 1.6;
  margin: 0 0 16px 0; flex-grow: 1;
}
.note-meta{
  display:flex; align-items:center; gap:6px;
  font-size: 12px; color: var(--text-faint); margin-bottom: 16px;
}
.note-meta svg{ width:13px; height:13px; }
.note-actions{
  display:flex; align-items:center; justify-content:space-between;
  padding-top: 14px; border-top: 1px solid var(--border-soft);
}
.note-actions-left{ display:flex; gap: 6px; }
.icon-btn{
  width: 32px; height: 32px; border-radius: 8px;
  display:flex; align-items:center; justify-content:center;
  background: transparent; border: 1px solid var(--border-soft);
  color: var(--text-muted); cursor: pointer; transition: all .15s ease;
}
.icon-btn svg{ width: 15px; height:15px; }
.icon-btn:hover{ border-color: var(--amber); color: var(--amber-light); }
.icon-btn.danger:hover{ border-color: var(--danger); color: #FF9B9B; }
.read-more{
  font-size: 13px; font-weight: 700; color: var(--amber-light);
  display:flex; align-items:center; gap:4px;
}
.read-more svg{ width: 14px; height:14px; }

/* Toolbar (search/filter/sort) */
.toolbar{
  display:flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 24px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 14px;
}
.search-box{
  flex: 1 1 260px;
  display:flex; align-items:center; gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.search-box svg{ width:17px; height:17px; color: var(--text-faint); flex-shrink:0; }
.search-box input{
  border:none; background:transparent; outline:none; color: var(--text);
  font-size: 14px; width:100%; font-family: inherit;
}
.search-box input::placeholder{ color: var(--text-faint); }

select.select-field, .select-field{
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
select.select-field:hover{ border-color: var(--amber); }

/* Forms */
.form-card{
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 720px;
}
.form-group{ margin-bottom: 20px; }
.form-group label{
  display:block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; color: var(--text);
}
.form-group .hint{ font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.form-control{
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}
.form-control:focus{ border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245,165,36,0.12); }
textarea.form-control{ resize: vertical; min-height: 140px; line-height: 1.6; }
.form-row{ display:grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions{ display:flex; gap: 12px; margin-top: 26px; }

/* Detail page */
.detail-card{
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 38px;
  max-width: 820px;
}
.detail-title{ font-size: 30px; font-weight: 800; margin: 16px 0; line-height: 1.3; }
.detail-body{ font-size: 16px; line-height: 1.9; color: #DCE2E8; white-space: pre-wrap; margin-bottom: 24px; }
.detail-meta-grid{
  display:grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding: 18px 0; margin: 20px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
}
.detail-meta-item .label{ font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); margin-bottom: 4px; }
.detail-meta-item .value{ font-size: 13.5px; color: var(--text); font-weight: 600; }
.reflection-box{
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-top: 24px;
}
.reflection-box h4{ margin: 0 0 12px 0; font-size: 14.5px; color: var(--amber-light); display:flex; gap:8px; align-items:center; }
.reflection-box h4 svg{ width:17px; height:17px; }
.reflection-text{ color: var(--text-muted); font-size: 14px; line-height: 1.7; white-space: pre-wrap; }

/* Empty state */
.empty-state{
  text-align: center;
  padding: 80px 20px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-state .empty-icon{
  width: 70px; height:70px; border-radius: 20px;
  background: rgba(245,165,36,0.1);
  display:flex; align-items:center; justify-content:center;
  margin: 0 auto 22px auto;
}
.empty-state .empty-icon svg{ width:32px; height:32px; stroke: var(--amber-light); }
.empty-state h3{ font-size: 19px; margin: 0 0 8px 0; }
.empty-state p{ color: var(--text-muted); font-size: 14px; margin: 0 0 22px 0; }

/* Toast */
#toast-container{
  position: fixed; top: 24px; right: 24px; z-index: 9999;
  display:flex; flex-direction: column; gap: 10px;
}
.toast{
  min-width: 280px; max-width: 360px;
  background: #16202B;
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: 12px;
  padding: 14px 16px;
  display:flex; align-items:flex-start; gap: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  animation: slideIn .25s ease;
  font-size: 13.5px;
}
.toast.error{ border-left-color: var(--danger); }
.toast svg{ width:18px; height:18px; flex-shrink:0; margin-top: 1px; }
.toast.success svg{ stroke: var(--success); }
.toast.error svg{ stroke: var(--danger); }
@keyframes slideIn{ from{ transform: translateX(30px); opacity:0; } to{ transform: translateX(0); opacity:1; } }
@keyframes fadeOut{ to{ opacity:0; transform: translateX(20px); } }

/* Modal */
.modal-overlay{
  position: fixed; inset:0; background: rgba(6,9,13,0.7);
  backdrop-filter: blur(4px);
  display:none; align-items:center; justify-content:center; z-index: 1000;
  padding: 20px;
}
.modal-overlay.open{ display:flex; }
.modal-box{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: popIn .2s ease;
}
.modal-box.modal-lg{ max-width: 620px; }
@keyframes popIn{ from{ transform: scale(.95); opacity:0; } to{ transform: scale(1); opacity:1; } }
.modal-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 18px; }
.modal-header h3{ margin:0; font-size: 18px; font-weight: 700; }
.modal-close{ background:none; border:none; color: var(--text-muted); cursor:pointer; padding:4px; }
.modal-close svg{ width:20px; height:20px; }
.modal-body p{ color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.modal-footer{ display:flex; gap: 10px; justify-content:flex-end; margin-top: 24px; }

/* Utility */
.text-muted{ color: var(--text-muted); }
.mt-0{ margin-top:0; }
.mb-0{ margin-bottom:0; }

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 1100px){
  .stats-grid{ grid-template-columns: repeat(2, 1fr); }
  .form-row{ grid-template-columns: 1fr; }
  .detail-meta-grid{ grid-template-columns: 1fr 1fr; }
}

@media (max-width: 880px){
  .sidebar{ display:none; }
  .mobile-topbar{ display:flex; }
  .main-content{ padding: 24px 18px 50px 18px; }
  .stats-grid{ grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-grid{ grid-template-columns: 1fr; }
  .thought-panel{ padding: 24px; }
  .thought-text{ font-size: 19px; }
  .detail-card{ padding: 24px; }
  .detail-title{ font-size: 23px; }
  .detail-meta-grid{ grid-template-columns: 1fr; }
  .form-card{ padding: 22px; }

  /* mobile sidebar drawer */
  .sidebar.mobile-open{
    display:flex;
    position: fixed; top:0; left:0; height:100vh; z-index: 500;
    animation: slideInLeft .2s ease;
  }
  .sidebar-backdrop{
    display:none; position: fixed; inset:0; background: rgba(0,0,0,0.5); z-index: 400;
  }
  .sidebar-backdrop.open{ display:block; }
}
@keyframes slideInLeft{ from{ transform: translateX(-100%); } to{ transform: translateX(0); } }

@media (max-width: 480px){
  .stats-grid{ grid-template-columns: repeat(2, 1fr); }
  .page-header h2{ font-size: 22px; }
  .toolbar{ flex-direction: column; }
  #toast-container{ left: 16px; right: 16px; top: 16px; }
  .toast{ min-width: 0; width: 100%; }
}
