/* General Reset */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
    overflow-x: hidden;
  }
  
  /* Container */
  .container {
    width: 90%;
    max-width: 1100px;
    margin: auto;
  }
  
  /* Header */
  header {
    background-color: transparent;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  /* Modals must always appear above the sticky header */
  .modal-overlay {
    z-index: 1100 !important;
  }
  
  .header-bar {
    background-color: #fff;
    width: 100%;
    padding: 0.35rem 0;
    border-bottom: 1px solid #ccc;
  }

  .header-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
  }

  /* Login button in header bar */
  .hdr-login-btn {
    color: #004080;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 5px 12px;
    border: 1.5px solid #004080;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
  }
  .hdr-login-btn:hover {
    background: #004080;
    color: #fff;
  }

  /* Profile icon & dropdown */
  .profile-menu {
    position: relative;
  }
  .profile-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
  }
  .profile-avatar {
    width: 34px;
    height: 34px;
    background: #2b6cb0;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    user-select: none;
    transition: background 0.2s;
  }
  .profile-btn:hover .profile-avatar {
    background: #2c5282;
  }
  .profile-dropdown-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    min-width: 210px;
    z-index: 1050;
    padding: 6px 0;
  }
  .profile-dropdown-panel.show {
    display: block;
  }
  .profile-info-block {
    padding: 10px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .profile-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a202c;
  }
  .profile-company {
    font-size: 0.82rem;
    color: #718096;
  }
  .profile-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0 0 4px;
  }
  .profile-menu-link {
    display: block;
    padding: 9px 16px;
    color: #2d3748;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
  }
  .profile-menu-link:hover {
    background: #f7fafc;
  }
  .profile-logout-link {
    color: #e53e3e;
  }
  .profile-logout-link:hover {
    background: #fff5f5;
  }

  .site-title-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
    cursor: pointer;
  }
  .site-title-link:hover {
    opacity: 0.8;
  }
  .site-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #004080;
  }
  .site-icon {
    width: 28px;
    height: 28px;
    margin-right: 0.4rem;
  }

  /* Active nav link — yellow highlight */
  .nav-links li a.active {
    color: #f6ad55 !important;
    font-weight: 700;
  }
  @media (max-width: 768px) {
    .nav-links li a.active {
      background: rgba(246, 173, 85, 0.12) !important;
    }
  }

  /* Coming Soon nav item */
  .coming-soon-link {
    cursor: default !important;
    opacity: 0.45 !important;
    pointer-events: none;
  }
  .coming-soon-badge {
    font-size: 0.65rem;
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;
  }

  /* Push "My Commodity News →" to the far right in app nav on desktop */
  @media (min-width: 769px) {
    .app-nav-switch {
      margin-left: auto;
    }
    .app-nav-switch > a {
      opacity: 0.8;
    }
    .app-nav-switch > a:hover {
      opacity: 1;
      color: #f6ad55 !important;
    }
  }
  
  
  /* Main Content */
  main {
    margin: 2rem 0;
  }
  
  /* Article Cards */
.article-card {
  display: flex;
  align-items: flex-start;
  background-color: #fff;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  gap: 1rem;
}

.article-card .thumbnail {
  width: 140px;
  height: auto;
  max-height: 120px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.article-card h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.article-date {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 0.5rem 0 !important;
  font-weight: 500;
}

.article-card p {
  margin: 0;
}

.article-card .mobile-text {
  display: none;
}

.article-card .desktop-text {
  display: block;
}

.article-card div {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .article-card {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
  }
  
  .article-card .thumbnail {
    width: 100px;
    height: 80px;
    flex-shrink: 0;
    margin: 0;
    object-fit: cover;
  }
  
  .article-card div {
    flex: 1;
    overflow: visible;
  }

  .article-card h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
  }

  .article-date {
    font-size: 0.75rem;
    margin: 0 !important;
  }

  .welcome-bar {
    text-align: center;
  }

  .welcome-bar .container {
    justify-content: center;
  }

  .article-card .desktop-text {
    display: none;
  }
}

  
  .article-card h2 a {
    text-decoration: none;
    color: #004080;
    transition: background-color 0.3s, color 0.3s;
  }
  
  .article-card h2 a:hover {
    background-color: #eef3fa;
    color: #002855;
  }

  .article-link {
    text-decoration: none;
    color: inherit;
    display: block;
  }
  
  .article-link:hover .article-card {
    background-color: #eef3fa;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  }

  /* full article */

  .article-banner {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    border-radius: 6px;
    margin: 1rem 0;
  }
  
  
  /* navigation menu */
  .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    z-index: 999;
    width: 40px; /* Add width and height */
    height: 40px;
    line-height: 40px;
    text-align: center;
  }
  
  
.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    transition: all 0.3s ease-in-out;
}

@media (max-width: 768px) {
    .nav-links {
        gap: 0;
        margin: 0;
        padding: 0;
    }

    .nav-links > li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
        width: 100%;
    }

    .nav-links > li:last-child {
        border-bottom: none;
    }

    .nav-links > li > a {
        font-size: 1.1rem;
        padding: 20px;
        width: 100%;
        text-align: center;
        position: relative;
    }

    .dropdown > a {
        width: 100%;
        text-align: center;
    }

    .dropdown-content {
        transition: all 0.3s ease-in-out;
    }
}@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
        background-color: transparent;
        color: #fff;
        font-size: 1.8rem;
        padding: 8px;
        margin: 0;
        cursor: pointer;
        border: none;
        outline: none;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .menu-toggle:hover {
        color: #E28928;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        background-color: #004080;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .nav-links.show {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links li a {
        padding: 8px 20px;
        display: block;
        text-align: center;
    }

    .dropdown.active > a::after {
        transform: rotate(180deg);
    }

    .dropdown-content {
        display: none;
        position: static;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        box-shadow: none;
    }

    .dropdown-content.show {
        display: block;
    }

    .dropdown-content li a {
        padding-left: 40px;
        text-align: center;
    }

    /* Mobile specific styles */
    @media (max-width: 768px) {
        .nav-bar {
            padding: 0;
        }

        .dropdown-content {
            display: none;
            background-color: #003366;
        }

        .dropdown-content.show {
            display: block;
        }

        .nav-links li a {
            color: #fff;
            font-size: 1rem;
            padding: 8px 1.5rem;
        }

        .dropdown-content li a {
            background-color: #003366;
            padding-left: 2.5rem;
        }

        /* Override desktop hover behavior */
        .dropdown:hover .dropdown-content {
            display: none;
        }
    }
}    
  nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
  }
  
  nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
    padding: 6px 0;
    display: inline-block;
  }
  
  nav ul li a:hover {
    color: #E28928;
  }
  

.nav-bar {
    background-color: #004080;
    padding: 0.1rem 0;
    position: relative;
}
  
.nav-links {
    align-items: center;
}

.nav-bar .container {
    position: relative;
    display: flex;
    align-items: center;
}

.login-btn {
    color: #f6ad55 !important;
    padding: 8px 18px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s;
}

.login-btn:hover {
    color: white;
}

/* Ensure the welcome text fits nicely */
#auth-section strong {
    color: #f6ad55; /* Use your accent color */
}

/* Push the auth section to the right */
.auth-right {
    margin-left: auto; /* This is the magic line */
}

/* Style for the 'Welcome' dropdown to ensure it aligns right */
.user-menu {
    position: relative;
}

.user-menu .dropdown-content {
    right: 0; /* Align dropdown to the right edge so it doesn't overflow the screen */
    left: auto;
}

/* Legacy auth classes — kept for safety, no longer used in header */
.hidden-auth { display: none !important; }

@media (max-width: 768px) {
    .nav-bar {
        padding: 0;
    }
    
    .nav-bar .container {
        min-height: 38px;
        display: flex;
        align-items: center;
    }

    .nav-links li a {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 36px;
        position: relative;
        padding: 8px 20px;
    }

    .dropdown > a::after {
        position: absolute;
        right: 25px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }

    .dropdown.active > a::after {
        transform: translateY(-50%) rotate(180deg);
    }

    /* Profile menu stays visible on mobile (in header bar) */
}  /* --- Dropdown Menu Styles --- */

/* Desktop Dropdown Styles */
@media (min-width: 769px) {
    .dropdown {
        position: relative;
    }

    /* Removed arrow indicator */

    .dropdown-content {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #003366;
        min-width: 180px;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        z-index: 100;
        padding: 0;
        margin: 0;
        list-style-type: none;
        border-top: 1px solid #004080;
    }

    /* Show dropdown on hover for desktop only */
    .dropdown:hover .dropdown-content {
        display: block !important;
    }
}

/* Dropdown links */
.dropdown-content li {
  width: 100%;
}

.dropdown-content li a {
  color: #fff;
  padding: 6px 16px;
  text-decoration: none;
  display: block;
  font-weight: normal;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.dropdown-content li a:hover {
  background-color: #E28928; /* Highlight on hover */
  color: #000;
}

/* 3. Show the dropdown on hover */
.dropdown:hover .dropdown-content {
  display: block;
}

/* --- Mobile Menu Adjustments --- */

@media (max-width: 768px) {
    .dropdown > a {
        width: 100%;
        text-align: center;
        padding: 8px 20px;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        box-shadow: none;
        border: none;
        min-width: auto;
    }

    .dropdown-content.show {
        display: block;
    }

    .dropdown-content li a {
        padding: 8px 20px;
        text-align: center;
        background-color: rgba(0, 0, 0, 0.2);
    }
    
    .dropdown-content li:first-child a {
        border-top: none;
    }
    
    .dropdown:hover .dropdown-content {
        display: none;
    }

}

  .thumbnail {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.75rem;
  }
 
  
  /* Footer */
  footer {
    background-color: #eee;
    text-align: center;
    padding: 1rem 0;
    font-size: 0.9rem;
  }

  /* Price Page */
  .price-page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ddd;
  }

  .price-page-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
  }

  .price-unit {
    margin: 0;
    color: #666;
    font-size: 1rem;
  }

  .chart-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .chart-container h2 {
    margin-top: 0;
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .table-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
  }

  .table-container h2 {
    margin-top: 0;
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
  }

  .price-table thead {
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
  }

  .price-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #333;
  }

  .price-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
  }

  .price-table tbody tr:hover {
    background-color: #fafafa;
  }

  .price-row.up {
    border-left: 3px solid #10b981;
  }

  .price-row.down {
    border-left: 3px solid #ef4444;
  }

  @media (max-width: 768px) {
    .price-table tbody tr[data-href] {
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
    }

    .price-table tbody tr[data-href]:active {
      background-color: #e8f0f7;
      opacity: 0.9;
    }

    .price-table tbody tr[data-href]:hover {
      background-color: #f0f7ff;
    }
  }

  .commodity-name {
    font-weight: 600;
    color: #333;
  }

  .commodity-link {
    color: #004080;
    text-decoration: none;
    transition: color 0.3s;
  }

  .commodity-link:hover {
    color: #002855;
    text-decoration: underline;
  }

  .price-value {
    font-weight: 500;
  }

  .price-change-cell {
    text-align: right;
  }

  .change-percent {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
  }

  .price-date {
    font-weight: 500;
    color: #333;
  }

  .price-value {
    font-weight: 600;
    color: #004080;
  }

  .price-change.positive {
    color: #10b981;
    font-weight: 500;
  }

  .price-change.negative {
    color: #ef4444;
    font-weight: 500;
  }

  .price-percent.positive {
    color: #10b981;
    font-weight: 600;
  }

  .price-percent.negative {
    color: #ef4444;
    font-weight: 600;
  }

  .price-unit-cell {
    color: #666;
    font-size: 0.9rem;
  }

  @media (max-width: 768px) {
    .price-page-header h1 {
      font-size: 1.5rem;
    }

    .chart-container,
    .table-container {
      padding: 1rem;
      margin-bottom: 1.5rem;
    }

    .price-table {
      font-size: 0.85rem;
    }

    .price-table th,
    .price-table td {
      padding: 0.5rem;
    }
  }