/* Habits APP - Refined Typography (+1 Size Up) */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang TC", "Noto Sans TC", sans-serif;
  --bg-primary: #0b0f17;
  
  /* 274ch Official Brand Color Palette */
  --brand-yellow: #fff13e;
  --brand-yellow-dark: #e6b800;
  --brand-blue: #00a9e6;
  --brand-blue-light: #7dccf3;
  --brand-red: #ff4545;
  --brand-green: #52c41a;
  --brand-dark: #1e293b;

  --surface-glass: rgba(14, 20, 36, 0.38);
  --surface-card: rgba(18, 26, 46, 0.32);
  --surface-modal: rgba(14, 20, 34, 0.90);
  --border-subtle: rgba(255, 241, 62, 0.22);
  --border-light: rgba(255, 241, 62, 0.36);
  --border-focus: #fff13e;
  
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --accent-primary: #fff13e;
  --accent-primary-hover: #ffd600;
  --accent-secondary: #00a9e6;
  --accent-success: #00a9e6;
  --accent-warning: #fff13e;
  --accent-danger: #ff4545;
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-sheet: 26px 26px 0 0;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.65);
  
  --transition-fast: 0.12s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-sheet: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  
  --mobile-max-width: 450px;
}

[data-theme="light"] {
  --bg-primary: #fffef2;
  --surface-glass: rgba(255, 255, 255, 0.48);
  --surface-card: rgba(255, 255, 255, 0.42);
  --surface-modal: rgba(255, 255, 255, 0.94);
  --border-subtle: rgba(230, 184, 0, 0.26);
  --border-light: rgba(230, 184, 0, 0.42);
  --border-focus: #00a9e6;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent-primary: #00a9e6;
  --accent-primary-hover: #008ec4;
  --accent-secondary: #fff13e;
  --accent-success: #00a9e6;
  --accent-warning: #e6b800;
  --accent-danger: #ff4545;
  
  --shadow-sm: 0 3px 12px rgba(230, 184, 0, 0.14);
  --shadow-md: 0 8px 24px rgba(230, 184, 0, 0.20);
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: transparent !important;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 17px; /* Scaled 1 size up */
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Mobile Viewport Container */
.app-mobile-container {
  width: 96%;
  max-width: var(--mobile-max-width);
  min-height: calc(100vh - max(8px, env(safe-area-inset-top, 8px)));
  min-height: calc(100dvh - max(8px, env(safe-area-inset-top, 8px)));
  margin: max(8px, env(safe-area-inset-top, 8px)) auto 0 auto;
  position: relative;
  background: transparent !important;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.45);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-top: 1px solid var(--border-subtle);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  z-index: 1;
}

/* Interior glass overlay: left & right 2% margins stay 100% pure wallpaper */
.app-mobile-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 23, var(--bg-overlay-opacity, 0.05));
  pointer-events: none;
  border-radius: 24px 24px 0 0;
  z-index: 0;
}

[data-theme="light"] .app-mobile-container::before {
  background: rgba(248, 250, 252, var(--bg-overlay-opacity, 0.05));
}

/* Scrollable Content Area */
.app-content {
  flex: 1;
  padding: 14px 2% calc(80px + env(safe-area-inset-bottom, 18px)) 2%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}

/* Top iOS Navigation Header */
.ios-nav-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 14px 10px 14px;
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #fff13e 0%, #ffd600 100%);
  border: 1px solid rgba(230, 184, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(255, 241, 62, 0.45);
}

.nav-brand-icon svg {
  width: 20px;
  height: 20px;
  stroke: #1e293b;
}

.nav-title-group {
  display: flex;
  flex-direction: column;
}

.nav-title {
  font-size: 20px; /* Scaled 1 size up */
  font-weight: 750;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.2;
}

.nav-subtitle {
  font-size: 13px; /* Scaled 1 size up */
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Theme Segmented Pill in Header */
.header-theme-toggle {
  display: flex;
  align-items: center;
  background: rgba(125, 125, 125, 0.15);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 3px;
}

.theme-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.theme-toggle-btn.active {
  background: var(--brand-yellow, #fff13e);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(255, 241, 62, 0.45);
}

/* Add Habit Plus Button */
.btn-nav-add {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff13e 0%, #ffd600 100%);
  border: 1px solid rgba(230, 184, 0, 0.5);
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 241, 62, 0.45);
  transition: transform var(--transition-fast);
}

.btn-nav-add:active {
  transform: scale(0.9);
}

.btn-nav-add svg {
  width: 20px;
  height: 20px;
  stroke: #1e293b;
}

/* iOS Bottom Tab Bar */
.ios-tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 96%;
  max-width: var(--mobile-max-width);
  height: calc(68px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface-glass);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 90;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
  padding: 6px 0;
}

.tab-item:active {
  transform: scale(0.92);
}

.tab-item svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
  transition: stroke 0.15s ease;
}

.tab-label {
  font-size: 13px; /* Scaled 1 size up */
  font-weight: 600;
  letter-spacing: 0.1px;
}

.tab-item.active {
  color: var(--brand-yellow, #fff13e);
}

[data-theme="light"] .tab-item.active {
  color: var(--brand-blue, #00a9e6);
}

.tab-item.active svg {
  stroke: currentColor;
}

/* Date Navigator (Mobile) */
.mobile-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.mobile-date-text {
  display: flex;
  flex-direction: column;
}

.mobile-date-title {
  font-size: 18px; /* Scaled 1 size up */
  font-weight: 750;
  color: var(--text-primary);
}

.mobile-date-sub {
  font-size: 13px; /* Scaled 1 size up */
  color: var(--text-secondary);
}

.mobile-quick-days {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-day-pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px; /* Scaled 1 size up */
  font-weight: 600;
  background: rgba(125, 125, 125, 0.12);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-day-pill:active {
  transform: scale(0.92);
}

.quick-day-pill.active {
  background: var(--brand-yellow, #fff13e);
  color: #1e293b;
  font-weight: 750;
  border-color: #e6b800;
  box-shadow: 0 2px 10px rgba(255, 241, 62, 0.4);
}

/* Theme Segmented Modal */
.theme-segmented-modal {
  display: flex;
  background: rgba(125, 125, 125, 0.14);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 6px;
}

.theme-modal-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 14px; /* Scaled 1 size up */
  font-weight: 650;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-modal-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.theme-modal-btn.active {
  background: var(--brand-yellow, #fff13e);
  color: #1e293b;
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(255, 241, 62, 0.4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  font-size: 15px; /* Scaled 1 size up */
  font-weight: 650;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #fff13e 0%, #ffd600 100%);
  color: #1e293b;
  font-weight: 750;
  border-color: #e6b800;
  box-shadow: 0 3px 12px rgba(255, 241, 62, 0.4);
}

.btn-primary:active {
  background: #ffd600;
}

.btn-secondary {
  background: rgba(125, 125, 125, 0.14);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-icon-only {
  padding: 9px;
  border-radius: var(--radius-sm);
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
