/* ==========================================================================
   Home vs Rent Lifetime Cost Simulator 2026 - Commercial Media CSS
   Clean, Professional, Trustworthy White Theme Default for High AdSense CTR
   ========================================================================== */

:root {
  /* Default Clean Light Theme (Commercial Finance Media Standard) */
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sub: #F1F5F9;
  
  --border-color: #E2E8F0;
  --border-darker: #CBD5E1;
  
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;

  --accent-brand: #1D4ED8;        /* Professional Trust Blue */
  --accent-brand-hover: #1E40AF;
  --accent-brand-light: #EFF6FF;
  
  --home-color: #0284C7;          /* Sky Blue */
  --home-bg: #F0F9FF;
  --home-border: #BAE6FD;
  
  --rent-color: #E11D48;          /* Crimson / Rose */
  --rent-bg: #FFF1F2;
  --rent-border: #FECDD3;
  
  --color-success: #059669;
  --color-warning: #D97706;
  --color-purple: #7C3AED;

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

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1);

  --font-main: 'Noto Sans JP', sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Noto Sans JP', sans-serif;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Optional Dark Theme (Manual Toggle Only) */
.dark-theme {
  --bg-main: #0F172A;
  --bg-card: #1E293B;
  --bg-sub: #334155;
  
  --border-color: #334155;
  --border-darker: #475569;
  
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --accent-brand: #3B82F6;
  --accent-brand-hover: #60A5FA;
  --accent-brand-light: rgba(59, 130, 246, 0.12);

  --home-color: #38BDF8;
  --home-bg: rgba(56, 189, 248, 0.12);
  --home-border: rgba(56, 189, 248, 0.3);

  --rent-color: #FB7185;
  --rent-bg: rgba(251, 113, 133, 0.12);
  --rent-border: rgba(251, 113, 133, 0.3);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Reset & Base Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styling */
.site-header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--accent-brand);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.25);
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-brand);
  background: var(--accent-brand-light);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.logo-area h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.vs-badge {
  background: var(--rent-color);
  color: #fff;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 900;
}

.highlight-text {
  color: var(--accent-brand);
}

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

/* AdSense Native Responsive Units Styling */
.adsense-top-wrapper {
  margin: 18px auto 8px auto;
}

.adsense-unit {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  position: relative;
}

.dark-theme .adsense-unit {
  background: var(--bg-card);
}

.ads-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  font-weight: 700;
}

.ads-placeholder-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ads-badge {
  background: #E2E8F0;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ads-info {
  flex: 1;
  font-size: 0.88rem;
  min-width: 260px;
}

.ads-info strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.94rem;
}

.ads-info span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.ads-action-btn {
  background: var(--accent-brand);
  color: #FFFFFF !important;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color var(--transition-fast);
  white-space: nowrap;
}

.ads-action-btn:hover {
  background: var(--accent-brand-hover);
}

.ads-action-btn.btn-success {
  background: var(--color-success);
}

.ads-action-btn.btn-success:hover {
  background: #047857;
}

.ads-placeholder-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.84rem;
}

.ads-placeholder-infeed {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ads-infeed-badge {
  background: var(--rent-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}

.ads-infeed-body {
  flex: 1;
  min-width: 250px;
}

.ads-infeed-body strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.ads-infeed-body p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Preset Section */
.preset-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.preset-label {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-accent {
  color: var(--accent-brand);
}

.preset-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.chip:hover, .chip.active {
  background: var(--accent-brand);
  color: #FFFFFF;
  border-color: var(--accent-brand);
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 20px;
  align-items: start;
}

/* Card Styling */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 1.08rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.icon-brand {
  color: var(--accent-brand);
}

/* Input Form Controls */
.tab-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-sub);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-brand);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.unit-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input, select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-darker);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-display);
  outline: none;
  transition: border-color var(--transition-fast);
}

.input-with-unit input:focus, select:focus {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 3px var(--accent-brand-light);
}

.unit {
  position: absolute;
  right: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  pointer-events: none;
}

input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--accent-brand);
  cursor: pointer;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-row .col {
  flex: 1;
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-brand);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.btn-primary:hover {
  background: var(--accent-brand-hover);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-sub);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--accent-brand);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.light-theme .sun-icon { display: none; }
.light-theme .moon-icon { display: block; }
.dark-theme .sun-icon { display: block; }
.dark-theme .moon-icon { display: none; }

/* Verdict Card */
.verdict-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 2px solid var(--border-color);
}

.dark-theme .verdict-card {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
}

.verdict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.verdict-tag {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-verdict {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.98rem;
  font-weight: 900;
}

.verdict-home {
  background: var(--home-bg);
  color: var(--home-color);
  border: 1px solid var(--home-border);
}

.verdict-rent {
  background: var(--rent-bg);
  color: var(--rent-color);
  border: 1px solid var(--rent-border);
}

.verdict-even {
  background: #F3E8FF;
  color: var(--color-purple);
  border: 1px solid #E9D5FF;
}

.verdict-main-stat {
  text-align: center;
  margin: 10px 0 18px 0;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-title {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--text-primary);
  margin: 4px 0;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.verdict-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric-box {
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--bg-card);
}

.box-home { background: var(--home-bg); border-color: var(--home-border); }
.box-rent { background: var(--rent-bg); border-color: var(--rent-border); }
.box-crossover { background: var(--bg-sub); }

.metric-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 800;
}

.metric-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Chart Controls */
.chart-controls {
  display: flex;
  gap: 6px;
}

.chart-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.chart-tab-btn.active {
  background: var(--accent-brand);
  color: #FFFFFF;
  border-color: var(--accent-brand);
}

.chart-container {
  position: relative;
  height: 380px;
  width: 100%;
}

/* Breakdown Table */
.table-responsive {
  overflow-x: auto;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.85rem;
}

.breakdown-table th {
  background: var(--bg-sub);
  color: var(--text-secondary);
  font-weight: 800;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-color);
}

.breakdown-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
}

.breakdown-table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.breakdown-table th:first-child,
.breakdown-table td:first-child {
  text-align: left;
}

/* Editorial Content Guide */
.editorial-card {
  background: var(--bg-card);
}

.editorial-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.editorial-item {
  display: flex;
  gap: 12px;
  background: var(--bg-sub);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.editorial-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-brand);
  color: #FFFFFF;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.editorial-item h3 {
  font-size: 0.92rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.editorial-item p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer & Modals */
.site-footer {
  background: #0F172A;
  color: #F8FAFC;
  padding: 36px 0;
  margin-top: 40px;
}

.footer-inner {
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 0.82rem;
}

.footer-links a {
  color: #94A3B8;
  text-decoration: none;
  font-weight: 700;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #FFFFFF;
}

.footer-links .sep {
  color: #475569;
}

.copyright {
  font-size: 0.82rem;
  color: #94A3B8;
  margin-bottom: 8px;
}

.disclaimer {
  font-size: 0.72rem;
  color: #64748B;
  max-width: 900px;
  margin: 0 auto;
}

/* Policy Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body h4 {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 12px 0 4px 0;
  color: var(--accent-brand);
}

.modal-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent-brand);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.toast.hidden { display: none; }

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .editorial-grid { grid-template-columns: 1fr; }
  .verdict-metrics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 1.8rem; }
  .chart-container { height: 280px; }
  .preset-section { flex-direction: column; align-items: flex-start; }
}

/* Print Styles */
@media print {
  .site-header, .adsense-unit, .preset-section, #themeToggleBtn, #shareBtn, #printBtn, .site-footer {
    display: none !important;
  }
  body { background: #FFFFFF !important; color: #000000 !important; }
  .dashboard-grid { display: block !important; }
  .card { border: 1px solid #CBD5E1 !important; box-shadow: none !important; margin-bottom: 16px !important; }
}
