/* Prevent horizontal scrolling and ensure adaptive layout for all screens */
html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
* {
  box-sizing: border-box !important;
}
.container, .main-content, .row, .col, .col-12, .col-md-6 {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
@media (min-width: 1200px) {
  .container {
    max-width: 1200px !important;
    margin-left: auto;
    margin-right: auto;
  }
}
/* Responsive styles for mobile devices */
@media (max-width: 600px) {
  html, body {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    font-size: 0.95rem;
    padding: 0 0.3rem;
  }
  body {
    font-size: 1.08rem;
    padding: 0 0.3rem;
    margin: 0;
    overflow-x: hidden;
    background: linear-gradient(120deg, #f8fafc 0%, #e3eafc 100%);
  }
  .header-bar {
    flex-direction: row;
    align-items: center;
    padding: 0.4rem 0.5rem;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
  }
  .logo {
    font-size: 1.05rem;
    margin: 0.2rem 0 0.2rem 0.2rem;
    position: static;
  }
  .nav-custom {
    display: none !important;
  }
  .hamburger-btn {
    display: block !important;
    cursor: pointer;
    font-size: 2rem;
    margin-left: auto;
    background: none;
    border: none;
    z-index: 1000;
  }
  .mobile-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100vw;
    background: #fff;
    box-shadow: 0 2px 8px rgba(44,62,80,0.08);
    z-index: 100;
    padding: 0.5rem 1rem 0.7rem 1rem;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
  }
  .mobile-nav a {
    display: block;
    padding: 0.9rem 0;
    color: #2c3e50;
    text-decoration: none;
    font-size: 1.13rem;
    border-bottom: 1px solid #e3eafc;
    font-weight: 500;
  }
  .mobile-nav a:last-child {
    border-bottom: none;
  }
  .main-content, .main-content-wrapper, .info-panel, .right-info-wrapper, .row, .col-12, .col-md-6, .col, .card, .card-body, .card-header {
    max-width: 98vw;
    margin: 0 auto 0.5rem auto;
    padding: 0.4rem 0.4rem;
    border-radius: 0.6rem;
    box-shadow: 0 1px 3px rgba(44,62,80,0.04);
    display: block;
    background: #fff;
  }
  .main-header, h1, h2, h3, h4, h5, h6 {
    font-size: 1em;
    margin-top: 0.3em;
    margin-bottom: 0.2em;
    text-align: left;
    word-break: break-word;
  }
  .keywords-list, .keyword-item {
    flex-direction: row;
    flex-wrap: wrap;
    font-size: 0.92em;
    margin: 0.1em 0;
    word-break: break-word;
  }
  .table-responsive, table, .table {
    font-size: 0.82em;
    max-width: 90vw;
    margin: 0.2rem auto 0.4rem auto;
    border-radius: 0.3rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(44,62,80,0.03);
  }
  th, td {
    padding: 0.12em 0.18em;
    min-width: 40px;
    font-size: 0.95em;
    vertical-align: middle;
  }
  .footer-custom {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.4rem 0.5rem;
    gap: 0.5rem;
    font-size: 0.89rem;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0.6rem 0.6rem 0 0;
    margin-bottom: 0;
  }
  .footer-info-group {
    min-width: 0;
    width: 100%;
    gap: 0.2rem;
    box-sizing: border-box;
  }
  .footer-socials {
    margin-top: 0.3rem;
    gap: 0.7rem;
    width: 100%;
    justify-content: flex-start;
    box-sizing: border-box;
  }
  .footer-copyright {
    font-size: 0.93em;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }
  .btn, button, input, select {
    font-size: 0.98em;
    min-height: 1.7em;
    width: auto;
    box-sizing: border-box;
    margin-bottom: 0.2rem;
    padding: 0.3em 0.5em;
  }
  .btn.btn-primary, .btn.btn-success, .btn.btn-danger {
    width: 100%;
  }
  img, svg {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.4rem;
  }
  /* Hide spinning earth and 3D globe on mobile */
  #earth-container, canvas#earth-canvas, .graphic-hero {
    display: none !important;
  }
  /* Modal dialogs: full width on mobile */
  .modal-dialog, .modal-content {
    width: 98vw;
    max-width: 98vw;
    min-width: 0;
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 0.6rem;
  }
  .modal-body, .modal-header, .modal-footer {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  /* Progress bars and charts */
  .progress, .chart-container, canvas {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
  }
  /* Prevent horizontal scroll on all elements */
  * {
    box-sizing: border-box;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }
  /* Sources grid for mobile */
  .sources-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  @media (min-width: 401px) and (max-width: 600px) {
    .sources-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }
  .source-card {
    padding: 0.4rem 0.3rem;
    font-size: 0.92em;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(44,62,80,0.04);
    background: #fff;
    margin: 0;
    min-width: 0;
    text-align: center;
  }
  .dashboard-action-btns {
    display: flex;
    flex-direction: row;
    gap: 0.18rem;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
  }
  .dashboard-action-btns .btn, .dashboard-action-btns button {
    font-size: 0.85em;
    padding: 0.18em 0.4em;
    margin: 0;
    min-width: unset;
    width: auto;
    white-space: nowrap;
    border-radius: 0.3rem;
  }
  .dashboard-action-btns .btn {
    display: inline-block;
  }
  /* Abbreviate table headers for mobile */
  .dashboard-table th[data-abbr]:after {
    content: attr(data-abbr);
    display: block;
    font-size: 0.85em;
    color: #888;
    font-weight: 400;
  }
  .keyword-row {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .keyword-main {
    width: 100% !important;
  }
  .keyword-name {
    white-space: normal !important;
    word-break: break-word !important;
    max-width: none !important;
    display: block !important;
  }
  .keyword-stats-row {
    display: flex !important;
    width: 100% !important;
    gap: 1.5em !important;
    margin-top: 0.2em !important;
    align-items: center !important;
  }
  .keyword-stats {
    min-width: 90px !important;
    display: inline-block !important;
    text-align: left !important;
  }
  /* --- Buzzlytix custom keyword card styles for mobile trends page --- */
  .buzz-keyword-card {
    background: linear-gradient(120deg, #f8fafc 60%, #e3eafc 100%);
    border-radius: 1.1rem;
    box-shadow: 0 2px 8px rgba(44,62,80,0.09);
    padding: 1.1rem 1rem 0.9rem 1rem;
    margin-bottom: 1.1rem;
    transition: box-shadow 0.18s, transform 0.18s;
    cursor: pointer;
    border: none;
    position: relative;
  }
  .buzz-keyword-card:active {
    box-shadow: 0 1px 3px rgba(44,62,80,0.06);
    transform: scale(0.98);
  }
  .buzz-keyword-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
  }
  .buzz-keyword-dot {
    width: 0.9em;
    height: 0.9em;
    border-radius: 50%;
    margin-right: 0.5em;
    display: inline-block;
    box-shadow: 0 1px 4px rgba(44,62,80,0.10);
  }
  .buzz-dot-up { background: #2ecc71; }
  .buzz-dot-down { background: #dc3545; }
  .buzz-dot-stable { background: #888; }
  .buzz-keyword-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 0.01em;
    flex: 1 1 0;
    word-break: break-word;
  }
  .buzz-keyword-trend {
    font-size: 0.98em;
    font-weight: 500;
    padding: 0.18em 0.7em;
    border-radius: 0.7em;
    display: flex;
    align-items: center;
    gap: 0.3em;
  }
  .buzz-trend-up { background: #eafaf1; color: #2ecc71; }
  .buzz-trend-down { background: #fdeaea; color: #dc3545; }
  .buzz-trend-stable { background: #f4f4f4; color: #888; }
  .buzz-keyword-bar {
    width: 100%;
    height: 18px;
    background: #e3eafc;
    border-radius: 0.7em;
    overflow: hidden;
    display: flex;
    margin-bottom: 0.6rem;
    box-shadow: 0 1px 4px rgba(44,62,80,0.06);
  }
  .buzz-bar {
    height: 100%;
    transition: width 0.3s;
  }
  .buzz-bar-positive { background: linear-gradient(90deg, #2ecc71 60%, #a8e063 100%); border-top-left-radius: 0.7em; border-bottom-left-radius: 0.7em; }
  .buzz-bar-neutral { background: #f1c40f; }
  .buzz-bar-negative { background: linear-gradient(90deg, #dc3545 60%, #f67272 100%); border-top-right-radius: 0.7em; border-bottom-right-radius: 0.7em; }
  .buzz-keyword-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.97em;
    color: #888;
    margin-top: 0.2rem;
  }
  .buzz-keyword-positive {
    font-weight: 500;
    color: #2ecc71;
  }
  .buzz-keyword-btn {
    font-size: 0.97em;
    border-radius: 0.7em;
    padding: 0.2em 0.9em;
    background: #fff;
    color: #3498db;
    border: 1.5px solid #3498db;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
  }
  .buzz-keyword-btn:active {
    background: #e3eafc;
    color: #217dbb;
  }
  /* --- Minimalistic Buzzlytix keyword card styles for mobile trends page --- */
  .buzz-keyword-card-minimal {
    background: #fff;
    border-radius: 0.8rem;
    border: 1px solid #e3eafc;
    box-shadow: 0 1px 2px rgba(44,62,80,0.03);
    padding: 0.8rem 0.7rem 0.6rem 0.7rem;
    margin-bottom: 0.7rem;
    transition: box-shadow 0.15s, transform 0.15s;
    cursor: pointer;
    border-left: 3px solid #e3eafc;
    position: relative;
  }
  .buzz-keyword-card-minimal:active {
    box-shadow: 0 1px 1px rgba(44,62,80,0.02);
    transform: scale(0.98);
  }
  .buzz-keyword-header-minimal {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }
  .buzz-keyword-dot-minimal {
    width: 0.65em;
    height: 0.65em;
    border-radius: 50%;
    margin-right: 0.3em;
    display: inline-block;
    box-shadow: none;
    opacity: 0.7;
  }
  .buzz-dot-up { background: #2ecc71; }
  .buzz-dot-down { background: #dc3545; }
  .buzz-dot-stable { background: #bbb; }
  .buzz-keyword-name-minimal {
    font-size: 1.03rem;
    font-weight: 600;
    color: #2c3e50;
    flex: 1 1 0;
    word-break: break-word;
    letter-spacing: 0.01em;
  }
  .buzz-keyword-trend-minimal {
    font-size: 0.93em;
    font-weight: 400;
    color: #bbb;
    background: none;
    padding: 0;
    border-radius: 0.5em;
    display: flex;
    align-items: center;
    gap: 0.2em;
  }
  .buzz-keyword-bar-minimal {
    width: 100%;
    height: 12px;
    background: #f6f8fa;
    border-radius: 0.5em;
    overflow: hidden;
    display: flex;
    margin-bottom: 0.4rem;
    box-shadow: none;
  }
  .buzz-bar-minimal {
    height: 100%;
    transition: width 0.3s;
  }
  .buzz-bar-positive { background: #2ecc71; border-top-left-radius: 0.5em; border-bottom-left-radius: 0.5em; }
  .buzz-bar-neutral { background: #f1c40f; }
  .buzz-bar-negative { background: #dc3545; border-top-right-radius: 0.5em; border-bottom-right-radius: 0.5em; }
  .buzz-keyword-footer-minimal {
    display: flex;
    align-items: center;
    font-size: 0.93em;
    color: #888;
    margin-top: 0.1rem;
    margin-bottom: 0.1rem;
    padding-left: 0.1rem;
  }
  .buzz-keyword-positive-minimal {
    font-weight: 500;
    color: #2ecc71;
  }
  .buzz-keyword-link-row {
    margin-top: 0.1rem;
    padding-left: 0.1rem;
  }
  .buzz-keyword-link {
    font-size: 0.93em;
    color: #3498db;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.15s;
  }
  .buzz-keyword-link:active {
    color: #217dbb;
  }
  .buzz-keyword-link-minimal {
    font-size: 0.93em;
    color: #bbb;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.15s;
    display: inline-block;
  }
  .buzz-keyword-link-minimal:active {
    color: #888;
  }
}
/* --- Desktop chart container fix for trends page --- */
@media (min-width: 601px) {
  .chart-container {
    width: 100%;
    max-width: 100%;
    height: 300px;
    overflow-x: auto;
    margin: 0 auto;
  }
  #sentimentChart {
    width: 100% !important;
    max-width: 100% !important;
    height: 300px !important;
    display: block;
  }
}
@media (min-width: 901px) {
  .sources-grid-desktop {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
  .source-card-desktop {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 2px 12px rgba(44,62,80,0.08);
    padding: 2rem 1.2rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 260px;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid #e3eafc;
    position: relative;
  }
  .source-card-desktop:hover {
    box-shadow: 0 6px 24px rgba(44,62,80,0.16);
    transform: translateY(-4px) scale(1.025);
    z-index: 2;
  }
  .source-logo-wrapper {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 50%;
    border: 1px solid #e3eafc;
    overflow: hidden;
  }
  .source-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    border-radius: 50%;
    background: #fff;
  }
  .source-info {
    text-align: center;
    margin-bottom: 0.7rem;
  }
  .source-name {
    font-weight: 700;
    font-size: 1.13em;
    margin-bottom: 0.2rem;
    color: #2c3e50;
  }
  .source-articles, .source-bias {
    font-size: 0.98em;
    color: #34495e;
    margin-bottom: 0.1rem;
  }
  .source-bias {
    color: #888;
  }
} 