/* =========================================
   HábitoApp — Vanilla CSS
   Responsive: Desktop sidebar + Mobile bottom nav
   ========================================= */

/* --- Reset & Custom Properties --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #faf6f6;
  --white: #ffffff;
  --dark: #2a2a2a;
  --gray: #676767;
  --border: #e3e3e3;
  --orange: #ffb84c;
  --orange-end: #ff9900;
  --lavender: #9999ff;
  --lime: #c3e97b;
  --grad-start: #fdc064;
  --grad-end: #ff9900;
  --radius: 8px;
  --header-h: 64px;
  --sidebar-w: 260px;
  --bottom-nav-h: 64px;
  --font-p: 'Poppins', sans-serif;
  --font-m: 'Montserrat', sans-serif;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-p);
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
}

/* --- Shared card style --- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* =========================================
   HEADER
   ========================================= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.logo {
  display: flex;
  align-items: center;
}

/* =========================================
   LAYOUT
   ========================================= */
.layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* =========================================
   SIDEBAR  (desktop only)
   ========================================= */
.sidebar {
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

/* User card */
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-p);
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  flex-shrink: 0;
}

.user-name {
  font-family: var(--font-p);
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
  line-height: 1.3;
}

.user-level {
  font-family: var(--font-p);
  font-weight: 400;
  font-size: 12px;
  color: var(--gray);
  margin-top: 2px;
}

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--gray);
  font-family: var(--font-m);
  font-weight: 500;
  font-size: 15px;
  transition: background .15s, color .15s;
}

.nav-item:hover {
  background: #f5f5f5;
  color: var(--dark);
}

.nav-item.active {
  color: var(--orange);
  font-weight: 800;
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main {
  flex: 1;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* --- Tabs --- */
.tab-bar {
  display: flex;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  align-self: flex-start;
}

.tab {
  padding: 8px 28px;
  font-family: var(--font-p);
  font-weight: 500;
  font-size: 15px;
  color: var(--gray);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color .15s;
}

.tab.active {
  color: var(--dark);
  font-weight: 600;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--lime);
  border-radius: 3px 3px 0 0;
}

/* --- Calendar card --- */
.calendar-card {
  padding: 16px 20px;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.month-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--dark);
  transition: background .15s;
}

.month-btn:hover { background: #f0f0f0; }

.month-label {
  font-family: var(--font-p);
  font-weight: 600;
  font-size: 16px;
  color: var(--dark);
  min-width: 80px;
  text-align: center;
}

.days-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.day-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.day-cell:hover:not(.active) {
  background: #f9f9f9;
  border-color: #ccc;
}

.day-cell.active {
  background: linear-gradient(to right, var(--grad-start), var(--grad-end));
  border-color: transparent;
}

.day-name {
  font-family: var(--font-m);
  font-weight: 400;
  font-size: 11px;
  color: var(--gray);
  text-align: center;
}

.day-num {
  font-family: var(--font-m);
  font-weight: 400;
  font-size: 15px;
  color: var(--dark);
}

.day-cell.active .day-name,
.day-cell.active .day-num {
  color: var(--white);
  font-weight: 700;
}

/* --- CTA Button --- */
.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 20px;
  background: var(--dark);
  color: #faf6f6;
  border: none;
  border-radius: 6px;
  font-family: var(--font-m);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  letter-spacing: .01em;
}

.cta-btn:hover {
  opacity: .88;
  transform: translateY(-1px);
}

.cta-btn:active {
  transform: translateY(0);
}

/* --- Streak card --- */
.streak-card {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.streak-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.streak-title {
  font-family: var(--font-m);
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
}

.streak-sub {
  font-family: var(--font-m);
  font-weight: 400;
  font-size: 12px;
  color: var(--gray);
}

.streak-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fire-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.benefits-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--dark);
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-p);
  font-weight: 500;
  font-size: 12px;
  color: var(--dark);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.benefits-btn:hover {
  background: var(--dark);
  color: var(--white);
}

/* --- Motivation banner --- */
.motivation-banner {
  background: var(--lavender);
  border-radius: 6px;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.motivation-title {
  font-family: var(--font-m);
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
}

.motivation-text {
  font-family: var(--font-m);
  font-weight: 400;
  font-size: 14px;
  color: var(--white);
}

/* =========================================
   BOTTOM NAV  (mobile only — hidden by default)
   ========================================= */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,.07);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  text-decoration: none;
  color: var(--gray);
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 500;
  padding: 8px 4px;
  transition: color .15s;
}

.bottom-nav-item.active { color: var(--orange); }
.bottom-nav-item:hover:not(.active) { color: var(--dark); }

.bottom-nav-icon {
  width: 22px;
  height: 22px;
}

/* =========================================
   RESPONSIVE
   ========================================= */

/* Tablet — shrink sidebar */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }

  .nav-label { font-size: 13px; }
  .main { padding: 20px 20px; }
}

/* Mobile — hide sidebar, show bottom nav */
@media (max-width: 640px) {
  .sidebar { display: none; }

  .bottom-nav {
    display: flex;
  }

  .layout {
    padding-bottom: var(--bottom-nav-h);
  }

  .main {
    padding: 16px 14px;
    max-width: 100%;
    gap: 12px;
  }

  /* Calendar: allow horizontal scroll on very small screens */
  .days-row {
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .days-row::-webkit-scrollbar { display: none; }

  .day-cell {
    min-width: 58px;
    flex: 0 0 58px;
  }

  .streak-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .streak-action {
    align-self: flex-end;
  }

  .motivation-banner {
    padding: 16px 18px;
  }

  .motivation-title { font-size: 16px; }
  .motivation-text  { font-size: 13px; }

  .cta-btn { font-size: 14px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .tab { padding: 8px 18px; font-size: 13px; }
  .main { padding: 12px 10px; }
}
