/* styles.css */

/* Basic reset & layout */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f6f6f6;
  color: #333;
}

header {
  background-color: #222;
  color: #fff;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

nav ul li a {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

nav ul li a:hover {
  background-color: #444;
}

.language-selector {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.language-selector button.language-btn {
  background-color: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.language-selector button.language-btn:hover {
  background-color: #444;
  border-color: #777;
}

.language-selector button.language-btn.active {
  background-color: #0073e6;
  border-color: #0073e6;
}

.language-selector .flag {
  font-size: 0.6rem;
  display: inline-block;
  margin-right: 0.2rem;
}

.language-selector .lang-name {
  font-size: 0.6rem;
}

/* RTL Support for Arabic */
[dir="rtl"] .language-selector .flag {
  margin-right: 0;
  margin-left: 0.25rem;
}

[dir="rtl"] nav ul {
  padding-right: 0;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Hero Section */
.hero-section {
  background-color: #fff;
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero-cta {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.cta-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: #0073e6;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: bold;
  transition: background-color 0.2s;
}

.cta-button:hover {
  background-color: #005bb8;
}

.cta-button.secondary {
  background-color: #444;
}

.cta-button.secondary:hover {
  background-color: #333;
}

/* Multi-column layout */
.multi-column-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Category Sections */
.category-section {
  background-color: #fff;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Data container styles */
.data-container {
  margin: 1rem 0;
}

.loading-text {
  color: #777;
  text-align: center;
}

/* Chart container */
.chart-container {
  height: 300px;
  margin: 1.5rem 0;
}

/* Crypto prices grid */
.crypto-price-grid, .indices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.crypto-item, .index-item {
  background-color: #f8f8f8;
  padding: 1rem;
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.crypto-item h4, .index-item h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.price {
  font-size: 1.25rem;
  font-weight: bold;
  margin: 0.5rem 0;
}

/* Price change indicators */
.price-up {
  color: #4CAF50;
  font-weight: bold;
}

.price-down {
  color: #F44336;
  font-weight: bold;
}

.price-unchanged {
  color: #9E9E9E;
}

/* News section styles */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.news-card {
  background-color: #fff;
  border-radius: 4px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.news-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  line-height: 1.4;
}

.news-card a {
  color: #0073e6;
  text-decoration: none;
}

.news-card a:hover {
  text-decoration: underline;
}

.news-source {
  font-size: 0.8rem;
  color: #666;
  margin: 0.25rem 0 0.75rem;
}

.news-excerpt {
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
  color: #555;
}

/* Calculator Section */
.calculator-section {
  background-color: #fff;
  padding: 2rem;
  margin-bottom: 2rem;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.calculator-section form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin: 1rem auto;
}

.calculator-section label {
  font-weight: bold;
}

.calculator-section input,
.calculator-section select {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.calculator-section button {
  padding: 0.75rem 1.25rem;
  background-color: #0073e6;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

.calculator-section button:hover {
  background-color: #005bb8;
}

#calc-result {
  text-align: center;
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: #f8f8f8;
  border-radius: 4px;
}

/* Directory section styles */
.directory-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.directory-filters input,
.directory-filters select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.directory-filters input {
  flex-grow: 1;
  min-width: 200px;
}

/* Consolidated Chart Section Styles */
#consolidated-chart-section {
  margin-bottom: 2rem;
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}

#consolidated-chart-section h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: #222;
  font-weight: 600;
}

#consolidated-chart-section p {
  color: #666;
  margin-bottom: 1.5rem;
}

/* Investment Type Tabs */
.investment-type-tabs {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  gap: 0.25rem;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #0073e6;
}

.tab-btn.active {
  color: #0073e6;
  border-bottom-color: #0073e6;
  font-weight: 500;
}

/* Investment Search */
.investment-search {
  display: flex;
  margin-bottom: 1.5rem;
  max-width: 500px;
}

#investment-search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 0.95rem;
}

#investment-search-btn {
  padding: 0.75rem 1rem;
  background-color: #0073e6;
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

/* Data Summary Table */
.data-summary-table {
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

#investment-summary {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

#investment-summary th,
#investment-summary td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

#investment-summary th {
  background-color: #f8f8f8;
  color: #444;
  font-weight: 600;
}

#investment-summary tbody tr:hover {
  background-color: #f5f8ff;
}

.price-up {
  color: #00c853;
}

.price-down {
  color: #f44336;
}

.action-btn {
  padding: 0.35rem 0.5rem;
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  transition: all 0.2s ease;
}

.action-btn.remove {
  color: #f44336;
  border-color: #f44336;
}

.action-btn.add {
  color: #00c853;
  border-color: #00c853;
}

/* Chart Controls */
.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.chart-type-selector, .time-range-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chart-type-btn, .time-range-btn {
  padding: 0.5rem 1rem;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  color: #555;
}

.chart-type-btn:hover, .time-range-btn:hover {
  background-color: #e0e0e0;
}

.chart-type-btn.active, .time-range-btn.active {
  background-color: #0073e6;
  color: white;
  border-color: #0073e6;
}

.consolidated-chart-canvas {
  width: 100%;
  height: 400px;
}

/* Footer */
footer {
  background-color: #222;
  color: #ccc;
  padding: 2rem 1rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: left;
}

.footer-section h3 {
  color: #fff;
  margin-top: 0;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

.footer-section a {
  color: #ccc;
  text-decoration: none;
}

.footer-section a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid #444;
  text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  nav ul {
    margin-top: 1rem;
  }
  
  .category-section,
  .calculator-section {
    padding: 1rem;
  }
  
  .chart-container {
    height: 250px;
  }
  
  .crypto-price-grid,
  .indices-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  
  .news-grid {
    grid-template-columns: 1fr;
  }
}
