/* CSS Variables for Theming */
:root {
  --primary: #2c3e50;
  --secondary: #ff6b6b;
  --accent: #3d5a80;
  --light-bg: #f8f9fa;
  --teal: #4ecdc4;
  --border-color: #e0e0e0;
  --text-color: #000000;
  --text-light: #666;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Times New Roman', Times, serif;
}

body {
  font-size: 1rem;
  line-height: 1.6;
  color: #000;
  background-color: var(--light-bg);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
}

.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.breadcrumb {
    padding: 0px 10px;
    color: #000;
    margin-bottom: 5px;
    font-size: 1rem;
}

.breadcrumb a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Main Layout */
.main-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  text-align: center;
}

.calculator-container {
  flex: 1;
}

.ad-container {
  display: none;
}

/* Card Styles */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

/* Tab Styles */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.tab-btn {
  padding: 8px 16px;
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
  font-family: 'Times New Roman', Times, serif;
  color: #000;
}

.tab-btn:hover {
  background: #e9ecef;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Section Titles */
.section-title {
  color: var(--primary);
  margin-bottom: 15px;
  font-weight: bold;
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.25rem;
}

.feature-description {
  margin-bottom: 20px;
  color: var(--text-light);
  font-style: italic;
  font-family: 'Times New Roman', Times, serif;
}

/* Input Grid */
.input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--primary);
  font-family: 'Times New Roman', Times, serif;
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Times New Roman', Times, serif;
  font-size: 1rem;
  color: #000;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Matrix Input Styles */
.matrix-input {
  margin: 20px 0;
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.matrix-title {
  color: var(--accent);
  margin-bottom: 10px;
  font-family: 'Times New Roman', Times, serif;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 auto;
  font-family: 'Times New Roman', Times, serif;
  table-layout: fixed;
  min-width: 100%;
}

th, td {
  border: 1px solid var(--border-color);
  padding: 8px;
  text-align: center;
  font-family: 'Times New Roman', Times, serif;
  color: #000;
}

th {
  background-color: var(--light-bg);
  font-weight: bold;
  font-size: 1rem;
}

.matrix-input-cell {
  width: 60px;
  padding: 5px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'Times New Roman', Times, serif;
  color: #000;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Times New Roman', Times, serif;
  flex: 1;
  justify-content: center;
  font-size: 1rem;
}

.calculate-btn {
  background: var(--primary);
  color: white;
}

.calculate-btn:hover {
  background: #1a252f;
}

.btn-reset {
  background: #ff6b6b;
  color: white;
}

.btn-reset:hover {
  background: #ff5252;
}

.btn-secondary {
  background: var(--teal);
  color: white;
}

.btn-secondary:hover {
  background: #3dbbb3;
}

/* Results Section */
.results {
  display: none;
}

.result-summary {
  margin-bottom: 20px;
}

.result-matrix {
  overflow-x: auto;
  margin: 20px 0;
}

.result-matrix table {
  margin: 20px auto;
  max-width: 100%;
}

.result-value {
  font-size: 1.25rem;
  font-weight: bold;
  margin: 15px 0;
  text-align: center;
  color: var(--primary);
  font-family: 'Times New Roman', Times, serif;
}

/* Visualization */
.visualization {
  margin: 30px 0;
}

.chart-container {
  height: 300px;
  margin-top: 15px;
}

/* Export Options */
.export-options {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.export-btn {
  flex: 1;
  min-width: 120px;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  border-radius: 4px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  z-index: 1000;
  font-family: 'Times New Roman', Times, serif;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Export Loading */
.export-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--light-bg);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive Typography */
h1 {
  font-size: 1.25rem;
  color: #000;
  margin-bottom: 20px;
  font-family: 'Times New Roman', Times, serif;
}

h2 {
  font-size: 1.125rem;
  font-family: 'Times New Roman', Times, serif;
  color: #ff6b6b;
}

h3 {
  font-size: 1rem;
  font-family: 'Times New Roman', Times, serif;
  color: #000;
}

/* Desktop Ad Styles */
.desktop-ad-box {
  width: 300px;
  margin-bottom: 30px;
}

.desktop-ad-tall {
  height: 600px;
}

.desktop-ad-wide {
  height: 250px;
}

/* Related Tools Styles */
#related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.tools-list {
    list-style: none;
}

.tools-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.tools-list li:last-child {
    border-bottom: none;
}

.tools-list a {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools-list a:hover {
    color: var(--teal);
}

/* Tablet Layout (768px–1024px) */
@media (min-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
    color: #ff6b6b;
  }
  
  h3 {
    font-size: 1.125rem;
  }
  
  .input-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  #ad-tablet {
    display: block;
    margin: 10px auto 0;
    text-align: center;
  }
  
  #related-tools {
    display: block;
    margin: 30px auto;
    text-align: left;
  }
}

/* Desktop Layout (≥1025px) */
@media (min-width: 1025px) {
  .main-layout {
    flex-direction: row;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.375rem;
    color: #ff6b6b;
  }
  
  h3 {
    font-size: 1.25rem;
  }
  
  .ad-container {
    display: block;
    width: 300px;
  }
  
  #ad-left, #ad-right {
    position: sticky;
    top: 20px;
    height: fit-content;
  }
  
  #related-tools {
    margin-top: 20px;
    display: block;
  }
  
  /* Hide tablet and mobile ads on desktop */
  #ad-tablet, #ad-mobile {
    display: none !important;
  }
  
  /* Desktop ad sizing */
  #ad-left .ad-placeholder {
    height: 250px;
  }
  
  #ad-right .ad-placeholder {
    height: 600px;
  }
}

/* Mobile Layout (≤767px) */
@media (max-width: 767px) {
  .tab-btn {
    font-size: 0.875rem;
  }
  
  .tabs {
    overflow-x: auto;
    padding-bottom: 10px;
  }
  
  .tab-btn {
    white-space: nowrap;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .export-options {
    flex-direction: column;
  }
  
  #ad-mobile {
    display: block;
    margin: 0 auto;
    text-align: center;
  }
  
  #related-tools {
    display: block;
    margin: 20px auto;
    text-align: left;
  }
  
  /* Hide desktop and tablet ads on mobile */
  #ad-left, #ad-right, #ad-tablet {
    display: null !important;
  }
}

/* Ad Placeholder Styles */
.ad-placeholder {
  background: var(--light-bg);
  border: 2px dashed var(--border-color);
  padding: 20px;
  text-align: center;
  color: var(--text-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Times New Roman', Times, serif;
}

/* Print Styles */
@media print {
  .ad-container,
  .tabs,
  .export-options,
  .breadcrumb,
  #related-tools {
    display: none !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .matrix-input {
    overflow-x: visible;
  }
  
  table {
    width: 100%;
  }
}

.mobile-table {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
}
.mobile-table table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}
.mobile-table th, .mobile-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    color: #000;
}
.mobile-table th {
    background-color: #4ecdc4;
    font-weight: bold;
    font-size: 1rem;
}
.mobile-table tr:nth-child(even) {
    background-color: #fafafa;
}