/* ===== PROFESSIONAL MOBILE OPTIMIZATION ===== */
/* Applies to screens 768px and below */

@media (max-width: 768px) {
  
  /* ===== BASE SETTINGS ===== */
  html {
    font-size: 14px;
  }
  
  body {
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
  }
  






/* ===== NAVBAR — SHOW TEXT ELEGANTLY ===== */
.status-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.status-bar-inner {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.logo-emblem {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  flex-shrink: 0;
}

.emblem-letter {
  font-size: 0.95rem;
}

/* Show text on mobile - compact version */
.logo-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.logo-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-tagline {
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  line-height: 1;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.journey-indicator {
  padding: 6px 12px;
  font-size: 0.6rem;
  gap: 6px;
  flex-shrink: 0;
}

.journey-dot {
  width: 5px;
  height: 5px;
}

.journey-label {
  display: none; /* Hide "DAY" text on mobile */
}

.journey-progress {
  font-size: 0.7rem;
}










/* ===== HERO SECTION — 50VH COMPACT ===== */
.hero-welcome {
  height: 60vh;
  min-height: 320px;
  padding: 60px 16px 30px;
  overflow: hidden;
}

.hero-inner {
  max-width: 100%;
  gap: 0;
}

.hero-ornament {
  font-size: 1rem;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 1.8rem;
  margin-bottom: 8px;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: 0.8rem;
  margin-bottom: 16px;
  line-height: 1.4;
}

.hero-divider {
  margin-bottom: 16px;
  gap: 10px;
}

.hero-divider span:first-child,
.hero-divider span:last-child {
  width: 40px;
}

.divider-diamond {
  font-size: 0.65rem;
}

/* ===== HERO STATS — BETTER FORMAT ===== */
.hero-stats-preview {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px;
  margin-bottom: 20px;
  width: 100%;
  background: rgba(31, 36, 51, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--gold-border);
  border-radius: 10px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  position: relative;
}

/* Add subtle dividers between stats */
.hero-stat:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--gold-border), transparent);
}

.hero-stat-value {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1;
}

.hero-stat-label {
  font-family: var(--mono);
  font-size: 0.5rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  text-align: center;
}

.hero-stat-divider {
  display: none; /* Hidden - using CSS ::after instead */
}

/* Hide admin button on mobile */
.hero-actions {
  display: none;
}

/* Remove scroll indicator */
.scroll-indicator {
  display: none;
}







  
  /* ===== MAIN CONTENT — PROPER SPACING ===== */
  .main-content {
    padding: 0 16px 60px;
    max-width: 100%;
  }
  
  section {
    margin-bottom: 48px;
  }
  
  /* ===== SECTION HEADERS — COMPACT ===== */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 12px;
  }
  
  .section-header-left {
    gap: 12px;
    width: 100%;
  }
  
  .section-numeral {
    font-size: 1.6rem;
  }
  
  .section-title {
    font-size: 1.25rem;
  }
  
  .section-subtitle {
    font-size: 0.8rem;
  }
  
  /* ===== STATS GRID — 2 COLUMNS ===== */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 16px;
    border-radius: 8px;
  }
  
  .stat-label {
    font-size: 0.6rem;
    margin-bottom: 8px;
  }
  
  .stat-value {
    font-size: 1.15rem;
    margin-bottom: 6px;
  }
  
  .stat-sub {
    font-size: 0.7rem;
  }
  
  /* ===== JOURNEY PATH — STACKED ===== */
  .journey-path {
    gap: 0;
  }
  
  .journey-node {
    flex-direction: column;
    gap: 12px;
    padding-bottom: 28px;
  }
  
  .journey-node:last-child {
    padding-bottom: 0;
  }
  
  .node-marker {
    flex-direction: row;
    gap: 10px;
    align-items: center;
  }
  
  .node-dot {
    width: 16px;
    height: 16px;
  }
  
  .node-line {
    width: auto;
    height: 2px;
    flex: 1;
    margin-top: 0;
  }
  
  .node-content {
    padding: 18px;
    border-radius: 8px;
  }
  
  .node-header {
    margin-bottom: 10px;
  }
  
  .node-phase {
    font-size: 0.6rem;
  }
  
  .node-status {
    font-size: 0.55rem;
    padding: 3px 8px;
  }
  
  .node-title {
    font-size: 1.05rem;
    margin-bottom: 14px;
  }
  
  .node-details {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    margin-bottom: 16px;
  }
  
  .detail-row {
    font-size: 0.8rem;
  }
  
  .progress-bar {
    height: 5px;
    margin-bottom: 8px;
  }
  
  .progress-label {
    font-size: 0.65rem;
  }
  
  /* ===== REWARDS — STACKED ===== */
  .rewards-intro {
    padding: 14px 16px;
    font-size: 0.8rem;
    margin-bottom: 20px;
  }
  
  .rewards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .reward-card {
    padding: 18px;
    gap: 14px;
    border-radius: 8px;
  }
  
  .reward-icon {
    font-size: 2rem;
  }
  
  .reward-title {
    font-size: 0.95rem;
    margin-bottom: 4px;
  }
  
  .reward-desc {
    font-size: 0.75rem;
    margin-bottom: 6px;
  }
  
  .reward-value {
    font-size: 0.8rem;
  }
  
  .reward-status {
    font-size: 0.55rem;
    padding: 4px 10px;
  }
  
  /* ===== CALENDAR — FIX OVERFLOW ===== */
  .calendar-section .section-header {
    align-items: center;
  }
  
  .calendar-controls {
    width: 100%;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
  }
  
  .cal-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  
  .cal-month {
    font-size: 0.9rem;
    min-width: 110px;
  }
  
  .calendar {
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto; /* Allow horizontal scroll if needed */
    -webkit-overflow-scrolling: touch;
  }
  
  .cal-header {
    margin-bottom: 6px;
    padding-bottom: 8px;
    gap: 2px;
  }
  
  .cal-header div {
    font-size: 0.6rem;
    padding: 4px 0;
    letter-spacing: 0.05em;
  }
  
  .cal-grid {
    gap: 3px;
  }
  
  .cal-day {
    padding: 5px;
    border-radius: 5px;
    min-height: 48px; /* Ensure touch targets */
  }
  
  .cal-day.empty {
    background: transparent;
    border: none;
  }
  
  .cal-day-num {
    font-size: 0.7rem;
  }
  
  .cal-day-pl {
    font-size: 0.6rem;
  }
  
  .cal-legend {
    gap: 16px;
    padding: 10px;
    flex-wrap: wrap;
  }
  
  .legend-item {
    font-size: 0.7rem;
    gap: 6px;
  }
  
  .legend-dot {
    width: 8px;
    height: 8px;
  }
  
  /* ===== TRADE LOG — SCROLLABLE ===== */
  .trades-table-wrap {
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .trades-table {
    min-width: 600px; /* Force horizontal scroll */
    font-size: 0.8rem;
  }
  
  .trades-table th {
    padding: 10px 12px;
    font-size: 0.6rem;
    white-space: nowrap;
  }
  
  .trades-table td {
    padding: 10px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  
  .trades-table .empty-state td {
    padding: 40px 16px;
  }
  
  .empty-icon {
    font-size: 2rem;
    margin-bottom: 10px;
  }
  
  .empty-text {
    font-size: 1rem;
    margin-bottom: 4px;
  }
  
  .empty-sub {
    font-size: 0.75rem;
  }
  
  .trade-day,
  .trade-direction,
  .trade-result,
  .trade-pl,
  .trade-equity {
    font-size: 0.75rem;
  }
  
  /* ===== PERFORMANCE — 2 COLUMNS ===== */
  .perf-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .perf-card {
    padding: 16px;
    border-radius: 8px;
  }
  
  .perf-label {
    font-size: 0.6rem;
    margin-bottom: 8px;
  }
  
  .perf-value {
    font-size: 1.1rem;
  }
  
  /* ===== FOOTER — COMPACT ===== */
  .journal-footer {
    padding: 40px 0 20px;
    margin-top: 32px;
  }
  
  .footer-ornament {
    margin-bottom: 20px;
    gap: 12px;
  }
  
  .footer-ornament span:first-child,
  .footer-ornament span:last-child {
    width: 50px;
  }
  
  .footer-diamond {
    font-size: 0.7rem;
  }
  
  .footer-brand {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
  }
  
  .footer-disclaimer {
    font-size: 0.7rem;
    padding: 0 16px;
  }
  
  .footer-copyright {
    font-size: 0.6rem;
    margin-top: 8px;
  }
  
  /* ===== BACKGROUND ELEMENTS — OPTIMIZED ===== */
  .candle-svg {
    width: 40%;
    opacity: 0.08;
  }
  
  .candle-svg-left {
    left: -15%;
  }
  
  .candle-svg-right {
    right: -15%;
  }
  
  #bgCanvas {
    opacity: 0.3;
  }
  
  /* ===== TOUCH OPTIMIZATIONS ===== */
  button,
  a,
  .cal-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .cal-btn:active {
    transform: scale(0.95);
    background: var(--bg-elevated);
  }
  
  /* ===== PREVENT OVERFLOW ===== */
  * {
    max-width: 100%;
  }
  
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* ===== SAFE AREA INSETS (iPhone notch) ===== */
  .status-bar {
    padding-top: env(safe-area-inset-top);
  }
  
  .journal-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  /* ===== REDUCED MOTION ===== */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ===== EXTRA SMALL DEVICES (480px and below) ===== */
@media (max-width: 480px) {
  
  html {
    font-size: 13px;
  }
  
  .status-bar-inner {
    padding: 10px 14px;
  }
  
  .logo-emblem {
    width: 28px;
    height: 28px;
  }
  
  .emblem-letter {
    font-size: 0.85rem;
  }
  
  .journey-indicator {
    padding: 5px 12px;
    font-size: 0.6rem;
  }
  
  .journey-progress {
    font-size: 0.7rem;
  }
  
  .hero-welcome {
    padding: 60px 14px 40px;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-subtitle {
    font-size: 0.8rem;
  }
  
  .main-content {
    padding: 0 14px 48px;
  }
  
  .section-title {
    font-size: 1.15rem;
  }
  
  .stats-grid {
    gap: 10px;
  }
  
  .stat-card {
    padding: 14px;
  }
  
  .stat-value {
    font-size: 1.1rem;
  }
  
  .perf-grid {
    gap: 10px;
  }
  
  .perf-card {
    padding: 14px;
  }
  
  .perf-value {
    font-size: 1.05rem;
  }
  
  .cal-day {
    padding: 4px;
    min-height: 44px;
  }
  
  .cal-day-num {
    font-size: 0.65rem;
  }
  
  .cal-day-pl {
    font-size: 0.55rem;
  }
  
  .node-content {
    padding: 16px;
  }
  
  .reward-card {
    padding: 16px;
  }
  
  .reward-icon {
    font-size: 1.8rem;
  }
  
  .reward-title {
    font-size: 0.9rem;
  }
}

/* ===== VERY SMALL DEVICES (360px and below) ===== */
@media (max-width: 360px) {
  
  html {
    font-size: 12px;
  }
  
  .status-bar-inner {
    padding: 8px 12px;
  }
  
  .logo-emblem {
    width: 26px;
    height: 26px;
  }
  
  .journey-indicator {
    padding: 4px 10px;
    font-size: 0.55rem;
  }
  
  .journey-progress {
    font-size: 0.65rem;
  }
  
  .hero-title {
    font-size: 1.6rem;
  }
  
  .hero-subtitle {
    font-size: 0.75rem;
  }
  
  .hero-stats-preview {
    padding: 12px 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr; /* Single column on very small screens */
  }
  
  .perf-grid {
    grid-template-columns: 1fr; /* Single column */
  }
  
  .cal-header div {
    font-size: 0.55rem;
  }
  
  .cal-day-num {
    font-size: 0.6rem;
  }
  
  .cal-day-pl {
    font-size: 0.5rem;
  }
}

/* ===== LANDSCAPE MODE FIX ===== */
@media (max-height: 600px) and (orientation: landscape) {
  
  .hero-welcome {
    padding: 50px 16px 40px;
    min-height: auto;
  }
  
  .hero-ornament {
    margin-bottom: 12px;
  }
  
  .hero-title {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }
  
  .hero-subtitle {
    margin-bottom: 14px;
  }
  
  .hero-divider {
    margin-bottom: 16px;
  }
  
  .hero-stats-preview {
    padding: 12px 20px;
    margin-bottom: 20px;
  }
  
  .section-header {
    margin-bottom: 20px;
  }
  
  section {
    margin-bottom: 40px;
  }
}

/* ===== MOBILE FOOTER — HIDE BRAND NAME ===== */
@media (max-width: 768px) {
  
  
  /* Keep footer visible and properly spaced */
  .journal-footer {
    padding: 32px 16px 20px;
    margin-top: 24px;
  }
  
  .footer-ornament {
    margin-bottom: 16px;
    gap: 10px;
  }
  
  .footer-ornament span:first-child,
  .footer-ornament span:last-child {
    width: 40px;
  }
  
  .footer-content {
    gap: 6px;
  }
  
  .footer-disclaimer {
    font-size: 0.7rem;
    padding: 0 8px;
    line-height: 1.5;
  }
  
  .footer-copyright {
    font-size: 0.6rem;
    margin-top: 6px;
  }
}

/* ===== VERY SMALL MOBILE (360px) ===== */
@media (max-width: 360px) {
  
  .journal-footer {
    padding: 24px 12px 16px;
  }
  
  .footer-disclaimer {
    font-size: 0.65rem;
  }
  
  .footer-copyright {
    font-size: 0.55rem;
  }
}

/* ===== PAGINATION MOBILE ===== */
@media (max-width: 768px) {
  .pagination {
    gap: 6px;
    margin-top: 16px;
  }
  
  .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    font-size: 0.7rem;
  }
  
  .page-info {
    font-size: 0.65rem;
    width: 100%;
    text-align: center;
    margin-top: 8px;
  }
}