/* Modern CSS reset and custom properties */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
  --font-primary: 'Poppins', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  /* Shared values */
  --accent: #FF8C00;
  --accent-glow: rgba(255, 140, 0, 0.15);
  --accent-hover: #FFA500;
  --periwinkle: #8EA6EE;
  --periwinkle-light: rgba(142, 166, 238, 0.15);
  --taupe-btn: #8D7F7B;
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* Light Theme Variables (Default) */
body, body.light-theme {
  --bg-primary: #f5f7f8;
  --bg-secondary: #ffffff;
  --bg-card: #eaecef;
  --bg-input: #f0f2f5;
  
  --text-primary: #1c1c1e;
  --text-secondary: #606266;
  --text-muted: #909399;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(255, 140, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(255, 140, 0, 0.1);
  
  /* App Mockup variables */
  --phone-bg: #f5f7f8;
  --phone-card: #ffffff;
  --phone-card-border: rgba(0, 0, 0, 0.08);
  --phone-text: #000000;
  --phone-text-sub: #766a67;
  --phone-divider: rgba(0, 0, 0, 0.08);
  --phone-emoji-bg: #8d7f7b;
  --phone-today: #caccd1;
  --phone-today-text: #000000;
}

/* Dark Theme Variables */
body.dark-theme {
  --bg-primary: #0a0a0c;
  --bg-secondary: #121215;
  --bg-card: #18181f;
  --bg-input: #202026;
  
  --text-primary: #f5f5f7;
  --text-secondary: #9ea0a5;
  --text-muted: #626469;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 140, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(255, 140, 0, 0.2);
  
  /* App Mockup variables */
  --phone-bg: #000000;
  --phone-card: #1c1c1e;
  --phone-card-border: rgba(255, 255, 255, 0.1);
  --phone-text: #ffffff;
  --phone-text-sub: #8e8e93;
  --phone-divider: rgba(255, 255, 255, 0.08);
  --phone-emoji-bg: #2c2c2e;
  --phone-today: #3a3a3c;
  --phone-today-text: #ffffff;
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.4s, color 0.4s;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 247, 248, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.4s, border-color 0.4s;
}

body.dark-theme header {
  background-color: rgba(10, 10, 12, 0.8);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #e07b00);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow-glow);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.btn-primary {
  background-color: var(--accent);
  color: white !important;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow-glow);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

/* Main Container Layout */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
  min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  padding: 2rem 0 4rem 0;
}

.hero-text h1 {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.hero-text h1 span {
  color: var(--accent);
}

body.dark-theme .hero-text h1 {
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-theme .hero-text h1 span {
  background: linear-gradient(135deg, var(--accent), #ffaa33);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-text p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 550px;
}

/* App Download Badge Placeholders */
.badge-container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 600;
  transition: var(--transition);
}

.badge-btn:hover {
  border-color: var(--accent);
  background-color: rgba(255, 140, 0, 0.05);
  transform: translateY(-2px);
}

.badge-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Phone Mockup */
.mockup-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.phone-mockup {
  width: 320px;
  height: 640px;
  background-color: #000;
  border: 12px solid #2d2d30;
  border-radius: 42px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.phone-screen {
  width: 100%;
  height: 100%;
  background-color: var(--phone-bg);
  padding: 1.8rem 0.8rem 1rem 0.8rem;
  display: flex;
  flex-direction: column;
  color: var(--phone-text);
  font-size: 0.8rem;
  overflow-y: auto;
  scrollbar-width: none;
  transition: background-color 0.4s, color 0.4s;
}

.phone-screen::-webkit-scrollbar {
  display: none;
}

.phone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.phone-header-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 20px;
  background-color: #2d2d30;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
  z-index: 10;
}

/* REALISTIC CALENDAR STYLING (matches TableCalendar) */
.real-calendar {
  background-color: var(--phone-card);
  border-radius: 20px;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid var(--phone-card-border);
  transition: background-color 0.4s, border-color 0.4s;
}

.calendar-month-title {
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  margin: 0.25rem 0 0.5rem 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 8px;
  text-align: center;
  font-size: 0.7rem;
}

.calendar-day-header {
  font-weight: bold;
  color: var(--phone-text);
  margin-bottom: 0.25rem;
}

.calendar-cell {
  position: relative;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
}

.calendar-date-number {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 500;
}

/* Selected Date */
.calendar-cell.selected .calendar-date-number {
  background-color: var(--periwinkle);
  color: white;
  font-weight: 700;
}

/* Today Date */
.calendar-cell.today .calendar-date-number {
  background-color: var(--phone-today);
  color: var(--phone-today-text);
  font-weight: 700;
}

/* Emojis under dates */
.calendar-cell-emoji {
  position: absolute;
  bottom: -2px;
  font-size: 0.65rem;
}

/* Dots under dates */
.calendar-cell-dot {
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #ad89d6;
}

/* WARM TAUPE EMOJI BUTTON (matches main.dart) */
.phone-emoji-btn {
  background-color: var(--phone-emoji-bg);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.45rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  margin: 0.25rem auto 0.75rem auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background-color 0.4s;
}

/* REAL DIARY TEXTFIELD */
.phone-diary-field {
  width: 100%;
  background-color: var(--phone-card);
  border: 1px solid var(--phone-card-border);
  border-radius: 15px;
  padding: 0.6rem 0.8rem;
  font-size: 0.75rem;
  color: var(--phone-text);
  margin-bottom: 0.75rem;
  min-height: 70px;
  line-height: 1.4;
  transition: background-color 0.4s, border-color 0.4s;
}

/* REALISTIC TRAINING LOG CARDS (matches _buildLogCard) */
.phone-log-card {
  background-color: var(--phone-card);
  border-radius: 15px;
  border: 1px solid var(--phone-card-border);
  margin-bottom: 0.5rem;
  display: flex;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: background-color 0.4s, border-color 0.4s;
}

/* Left colored vertical bar */
.phone-log-color-bar {
  width: 5px;
}

.phone-log-color-bar.red { background-color: #ff4a4a; }
.phone-log-color-bar.orange { background-color: #ff8c00; }
.phone-log-color-bar.purple { background-color: #9c27b0; }
.phone-log-color-bar.green { background-color: #4cd964; }

.phone-log-content {
  flex: 1;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.phone-log-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.phone-log-title {
  font-weight: 700;
  font-size: 0.78rem;
}

.phone-log-sub {
  font-size: 0.65rem;
  color: var(--phone-text-sub);
  margin-top: -2px;
}

.phone-log-feeling {
  font-size: 1.1rem;
}

/* Log Stats Row with dividers */
.phone-log-stats {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.2rem;
}

.phone-log-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-log-stat-label {
  font-size: 0.55rem;
  color: var(--phone-text-sub);
  font-weight: 700;
  text-transform: uppercase;
}

.phone-log-stat-val {
  font-size: 0.75rem;
  font-weight: bold;
}

.phone-log-divider {
  width: 1px;
  height: 16px;
  background-color: var(--phone-divider);
}

/* Features Grid */
.features-section {
  padding: 6rem 0;
  border-top: 1px solid var(--border-color);
  transition: border-color 0.4s;
}

.section-title {
  text-align: center;
  font-size: 2.25rem;
  margin-bottom: 3rem;
}

.section-title span {
  color: var(--accent);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-5px);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background-color: rgba(255, 140, 0, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.feature-card h3 {
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Documents / Policy Layout */
.doc-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  transition: background-color 0.4s, border-color 0.4s;
}

.doc-card h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.doc-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1.5rem;
}

.lang-switch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.lang-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.lang-btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
}

.doc-section {
  margin-bottom: 2rem;
}

.doc-section h2 {
  font-size: 1.4rem;
  margin: 2rem 0 1rem 0;
  color: var(--text-primary);
}

.doc-section p, .doc-section ul {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.doc-section ul {
  padding-left: 1.5rem;
}

.doc-section li {
  margin-bottom: 0.5rem;
}

/* Contact / Support Form Section */
.contact-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
  transition: border-color 0.4s;
}

.contact-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.contact-info h2 {
  font-size: 2.25rem;
  margin-bottom: 1.5rem;
}

.contact-info p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.contact-details {
  list-style: none;
}

.contact-details li {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.contact-details li svg {
  width: 20px;
  height: 20px;
  fill: var(--accent);
}

.contact-form {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  transition: background-color 0.4s, border-color 0.4s;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.2);
}

/* Footer */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 4rem 2rem 2rem 2rem;
  color: var(--text-secondary);
  transition: background-color 0.4s, border-color 0.4s;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-brand {
  max-width: 300px;
}

.footer-brand p {
  font-size: 0.9rem;
  margin-top: 1rem;
}

.footer-links-grp {
  display: flex;
  gap: 4rem;
}

.footer-col h4 {
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-col a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  transition: border-color 0.4s;
}

/* Language Selection System (JS-less toggle fallback) */
.lang-en, .lang-ja {
  display: block;
}

.jp-active .lang-en {
  display: none;
}
.jp-active .lang-ja {
  display: block;
}

.en-active .lang-ja {
  display: none;
}
.en-active .lang-en {
  display: block;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }
  
  .hero-text p {
    margin-left: auto;
    margin-right: auto;
  }
  
  .badge-container {
    justify-content: center;
  }
  
  .contact-container {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

@media (max-width: 600px) {
  main {
    padding: 2rem 1rem;
  }
  
  .hero-text h1 {
    font-size: 2.5rem;
  }
  
  .nav-container {
    padding: 1rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .nav-links li:not(:last-child) {
    display: none; /* Hide non-button links on tiny mobile devices */
  }
  
  .doc-card {
    padding: 2rem 1.25rem;
  }
  
  .footer-container {
    flex-direction: column;
    gap: 2rem;
  }
  
  .footer-links-grp {
    gap: 2rem;
    flex-wrap: wrap;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
