/* Modern Cards Layout Styles */

html {
  scroll-padding-top: 80px; /* Adjusted from 120px to 80px for pages without weather header */
  scroll-behavior: smooth;
}

:root {
  --primary-color: #3498db;
  --secondary-color: #2ecc71;
  --background-color: #f5f7fa;
  --card-bg: #ffffff;
  --text-color: #333333;
  --header-color: #2c3e50;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --border-radius: 12px;
  --transition: all 0.3s ease;
  --xfw-green: #2b9540;
  --xfw-blue: #1c7cc7;
  --xfw-dark-blue: #003366;
  --xfw-dark-green: #004d1a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 20px;
}

.weather-container {
  margin-bottom: 20px;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#bookmarkWrapper {
  position: sticky;
  top: 0;
  z-index: 999;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 15px;
  padding-bottom: 25px; /* Increased bottom padding */
  border-radius: var(--border-radius);
  margin-bottom: 25px; /* Increased space below the menu */
  margin-top: 0;
  box-shadow: var(--shadow);
  width: 100%;
}

/* Add a spacer after the bookmark wrapper */
#bookmarkWrapper + * {
  margin-top: 25px !important;
}

/* Or create a specific spacer class */
.content-spacer {
  height: 25px;
  width: 100%;
  display: block;
}

#bookmarkLinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  padding: 0;
}

#bookmarkLinks li a {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

#bookmarkLinks li a:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  background-color: var(--text-color);
  color: var(--card-bg);
}

/* Colored bookmark links */
#bookmarkLinks li a.blue {
  background-color: #3498db;
  color: white;
}

#bookmarkLinks li a.red {
  background-color: #e74c3c;
  color: white;
}

#bookmarkLinks li a.yellow {
  background-color: #f39c12;
  color: white;
}

#bookmarkLinks li a.grey {
  background-color: #7f8c8d;
  color: white;
}

#bookmarkLinks li a.orange {
  background-color: #ff441a;
  color: white;
}

#bookmarkLinks li a.brown {
  background-color: #331c04;
  color: white;
}

/* XferWorx bookmark link styles */
#bookmarkLinks li a.xfwg {
  background-color: var(--xfw-green); /* XferWorx Green */
  color: white; /* White text for better readability */
}

#bookmarkLinks li a.xfwb {
  background-color: var(--xfw-dark-blue); /* Using darker XferWorx Blue */
  color: white; /* White text for better readability */
}

/* Hover effects for colored links - INVERTED COLORS */
#bookmarkLinks li a.blue:hover {
  background-color: white;
  color: #3498db;
}

#bookmarkLinks li a.red:hover {
  background-color: white;
  color: #e74c3c;
}

#bookmarkLinks li a.yellow:hover {
  background-color: white;
  color: #f39c12;
}

#bookmarkLinks li a.grey:hover {
  background-color: white;
  color: #7f8c8d;
}

#bookmarkLinks li a.orange:hover {
  background-color: white;
  color: #ff441a;
}

#bookmarkLinks li a.brown:hover {
  background-color: white;
  color: #331c04;
}

#bookmarkLinks li a.xfwg:hover {
  background-color: white;
  color: var(--xfw-green);
}

#bookmarkLinks li a.xfwb:hover {
  background-color: white;
  color: var(--xfw-dark-blue);
}

/* Common hover effects for all bookmark links */
#bookmarkLinks li a:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.flex-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Adjust row spacing */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding-top: 25px; /* Increased space at top of each row */
  position: relative;
  margin-top: 0;
}

/* Add space between rows */
.row + .row {
  margin-top: 30px; /* Increased space between consecutive rows */
}

/* Add top margin to the first row to create space below bookmark menu */
.row:first-child {
  margin-top: 25px;
}

.row:not(:first-child)::before {
  display: none; /* Hidden by default, remove this line if you want to show section labels */
  content: attr(data-bookmarkName);
  position: absolute;
  top: -10px;
  left: 20px;
  background-color: var(--primary-color);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
}

/* Card styling */
.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  min-width: 160px;
  display: inline-block;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: none;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.card-header {
  background-color: var(--header-color);
  color: white;
  padding: 12px;
  font-weight: 600;
  text-align: center;
  font-size: 14px;
}

.card-main {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.material-icons {
  font-size: 40px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.card:hover .material-icons {
  transform: scale(1.1);
}

.main-description {
  text-align: center;
  font-size: 13px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: none;
  padding: 0 5px;
  color: var(--text-color); /* Default color */
}

/* Color themes - Updated to match header and description colors */
/* Blue theme */
.blue .card-header,
.row.blue::before {
  background-color: #3498db;
  color: white;
}
.blue .main-description {
  color: #3498db; /* Updated to match header background */
}

/* Red theme */
.red .card-header,
.row.red::before {
  background-color: #e74c3c;
  color: white;
}
.red .main-description {
  color: #e74c3c; /* Updated to match header background */
}

/* Yellow theme */
.yellow .card-header,
.row.yellow::before {
  background-color: #f39c12;
  color: white;
}
.yellow .main-description {
  color: #f39c12; /* Updated to match header background */
}

/* Grey theme */
.grey .card-header,
.row.grey::before {
  background-color: #7f8c8d;
  color: white;
}
.grey .main-description {
  color: #7f8c8d; /* Updated to match header background */
}

/* Orange theme */
.orange .card-header,
.row.orange::before {
  background-color: #ff441a;
  color: white;
}
.orange .main-description {
  color: #ff441a; /* Updated to match header background */
}

/* Brown theme */
.brown .card-header,
.row.brown::before {
  background-color: #331c04;
  color: white;
}
.brown .main-description {
  color: #331c04; /* Updated to match header background */
}

/* XferWorx Green theme */
.xfwg .card-header,
.row.xfwg::before {
  background-color: var(--xfw-green); /* XferWorx Green */
  color: white; /* White text on green background */
}
.xfwg .main-description {
  color: var(--xfw-green); /* Updated to match header background */
}
.xfwg a {
  color: var(--xfw-green); /* Updated to match header background */
}

/* XferWorx Blue theme */
.xfwb .card-header,
.row.xfwb::before {
  background-color: var(--xfw-dark-blue); /* Using darker XferWorx Blue */
  color: white; /* White text on blue background */
}
.xfwb .main-description {
  color: var(--xfw-dark-blue); /* Updated to match header background */
}
.xfwb a {
  color: var(--xfw-dark-blue); /* Updated to match header background */
}

/* Scroll to top button */
#myBtnToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: var(--transition);
  box-shadow: var(--shadow);
  z-index: 1000;
}

#myBtnToTop:hover {
  opacity: 1;
  transform: translateY(-3px);
}

/* Right-aligned link styles */
.right-aligned {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

/* Responsive breakpoints */
@media (max-width: 768px) {
  .card {
    min-width: 140px;
    display: inline-block;
  }

  .material-icons {
    font-size: 36px;
  }

  .card-header {
    font-size: 13px;
    padding: 10px;
  }

  .card-main {
    padding: 15px;
    min-height: 100px;
  }

  #bookmarkLinks li a {
    padding: 6px 12px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .card {
    min-width: 130px;
    display: inline-block;
  }

  .row {
    gap: 10px;
    justify-content: center;
  }

  body {
    padding: 10px;
  }

  .card-main {
    padding: 12px 8px;
  }

  .main-description {
    font-size: 12px;
  }
}

.fa-home {
  color: #000000 !important;
}

a[href=""] {
  display: none;
}

.template {
  display: none;
}

.hide {
  display: none;
}

/* NEW CODE: Make card-specific styling override row styling */
/* These selectors are more specific than row-based selectors */
.row.xfwg .card.orange .card-header,
.row.xfwb .card.orange .card-header,
.row.blue .card.orange .card-header,
.card.orange .card-header {
  background-color: #ff441a !important;
  color: white !important;
}

.row.xfwg .card.orange .main-description,
.row.xfwb .card.orange .main-description,
.row.blue .card.orange .main-description,
.card.orange .main-description {
  color: #ff441a !important;
}

/* Blue card overrides */
.row.xfwg .card.blue .card-header,
.row.xfwb .card.blue .card-header,
.row.orange .card.blue .card-header,
.card.blue .card-header {
  background-color: #3498db !important;
  color: white !important;
}

.row.xfwg .card.blue .main-description,
.row.xfwb .card.blue .main-description,
.row.orange .card.blue .main-description,
.card.blue .main-description {
  color: #3498db !important;
}

/* Red card overrides */
.row.xfwg .card.red .card-header,
.row.xfwb .card.red .card-header,
.row.blue .card.red .card-header,
.card.red .card-header {
  background-color: #e74c3c !important;
  color: white !important;
}

.row.xfwg .card.red .main-description,
.row.xfwb .card.red .main-description,
.row.blue .card.red .main-description,
.card.red .main-description {
  color: #e74c3c !important;
}

/* Yellow card overrides */
.row.xfwg .card.yellow .card-header,
.row.xfwb .card.yellow .card-header,
.row.blue .card.yellow .card-header,
.card.yellow .card-header {
  background-color: #f39c12 !important;
  color: white !important;
}

.row.xfwg .card.yellow .main-description,
.row.xfwb .card.yellow .main-description,
.row.blue .card.yellow .main-description,
.card.yellow .main-description {
  color: #f39c12 !important;
}

/* Grey card overrides */
.row.xfwg .card.grey .card-header,
.row.xfwb .card.grey .card-header,
.row.blue .card.grey .card-header,
.card.grey .card-header {
  background-color: #7f8c8d !important;
  color: white !important;
}

.row.xfwg .card.grey .main-description,
.row.xfwb .card.grey .main-description,
.row.blue .card.grey .main-description,
.card.grey .main-description {
  color: #7f8c8d !important;
}

/* Brown card overrides */
.row.xfwg .card.brown .card-header,
.row.xfwb .card.brown .card-header,
.row.blue .card.brown .card-header,
.card.brown .card-header {
  background-color: #331c04 !important;
  color: white !important;
}

.row.xfwg .card.brown .main-description,
.row.xfwb .card.brown .main-description,
.row.blue .card.brown .main-description,
.card.brown .main-description {
  color: #331c04 !important;
}

/* Improved Font Awesome icon styling */
.fa-icon-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 58px; /* Default height if not specified */
  margin-bottom: 15px;
  transition: var(--transition);
  width: 100%;
}

/* Base styling for Font Awesome icons */
.fa-icon-wrapper i.fa,
.fa-icon-wrapper i.fas,
.fa-icon-wrapper i.far,
.fa-icon-wrapper i.fab {
  font-size: 2.5rem; /* Default size */
  line-height: 1;
  /* Allow color inheritance from parent */
  color: inherit;
}

/* Ensure icons scale properly on hover */
.card:hover .fa-icon-wrapper {
  transform: scale(1.1);
}

/* Specific sizing classes for Font Awesome icons */
.fa-icon-xs i {
  font-size: 1.5rem !important;
}
.fa-icon-sm i {
  font-size: 2rem !important;
}
.fa-icon-md i {
  font-size: 2.5rem !important;
}
.fa-icon-lg i {
  font-size: 3rem !important;
}
.fa-icon-xl i {
  font-size: 3.5rem !important;
}
.fa-icon-xxl i {
  font-size: 4rem !important;
}

/* Handling custom sizes through height property */
[data-icon-height="45px"] i {
  font-size: 2rem !important;
}
[data-icon-height="53px"] i {
  font-size: 2.5rem !important;
}
[data-icon-height="58px"] i {
  font-size: 2.8rem !important;
}
[data-icon-height="64px"] i {
  font-size: 3rem !important;
}
[data-icon-height="72px"] i {
  font-size: 3.5rem !important;
}

/* Colors for icons based on card class */
.card.blue .fa-icon-wrapper i {
  color: #3498db;
}
.card.red .fa-icon-wrapper i {
  color: #e74c3c;
}
.card.yellow .fa-icon-wrapper i {
  color: #f39c12;
}
.card.grey .fa-icon-wrapper i {
  color: #7f8c8d;
}
.card.orange .fa-icon-wrapper i {
  color: #ff441a;
}
.card.brown .fa-icon-wrapper i {
  color: #331c04;
}
.card.xfwg .fa-icon-wrapper i {
  color: var(--xfw-green);
}
.card.xfwb .fa-icon-wrapper i {
  color: var(--xfw-dark-blue);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .fa-icon-wrapper {
    height: 48px;
    margin-bottom: 12px;
  }

  .fa-icon-wrapper i.fa,
  .fa-icon-wrapper i.fas,
  .fa-icon-wrapper i.far,
  .fa-icon-wrapper i.fab {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .fa-icon-wrapper {
    height: 42px;
    margin-bottom: 10px;
  }

  .fa-icon-wrapper i.fa,
  .fa-icon-wrapper i.fas,
  .fa-icon-wrapper i.far,
  .fa-icon-wrapper i.fab {
    font-size: 1.8rem;
  }
}
