/* /css/news_board.css */

/* --- News Filter Form --- */
#newsFilterForm {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

/* Make Tagify inputs match the glass theme */
#newsFilterForm .tagify {
    --tags-border-color: var(--apple-card-border);
    border: 1px solid var(--apple-card-border);
    background-color: var(--apple-card-bg);
    border-radius: 0.6rem;
}

[data-bs-theme="dark"] #newsFilterForm .tagify {
    --tags-border-color: var(--apple-card-border-dark);
    background-color: var(--apple-card-bg-dark);
}

#newsFilterForm .tagify__input {
    color: var(--apple-text-color);
}

#newsFilterForm .tagify__input::before {
    color: var(--apple-placeholder-color);
}

/* --- Tagify Tag Text Colors --- */
#newsFilterForm .tagify__tag {
    --tag-bg: var(--apple-accent-color);
    --tag-text-color: #fff; /* Default (light theme) */
}

[data-bs-theme="dark"] #newsFilterForm .tagify__tag {
    --tag-text-color: #1c1c1e; /* Dark theme */
}

/* --- Tagify Remove Button Color in Dark Mode --- */
[data-bs-theme="dark"] #newsFilterForm .tagify__tag__removeBtn {
    color: white;
    opacity: 0.8;
}
[data-bs-theme="dark"] #newsFilterForm .tagify__tag__removeBtn:hover {
    opacity: 1;
}


/* --- TAGIFY DROPDOWN STYLING --- */
.tagify__dropdown {
  border-radius: 0.75rem;
  border: none !important;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

[data-bs-theme="dark"] .tagify__dropdown {
  --tagify-dd-bg-color: var(--apple-card-bg-dark) !important;
  --tagify-dd-text-color: var(--sidebar-text-color) !important;
  --tagify-dd-color-primary: var(--apple-accent-color) !important;
  --tagify-dd-border-color: var(--apple-card-border-dark) !important;
  background-color: rgba(30, 30, 30, 0.75);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body .tagify__dropdown,
body .tagify__dropdown__wrapper {
  border: none !important;
  outline: none !important;
}

.tagify__dropdown__item {
  color: var(--sidebar-text-color);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin: 4px;
  transition: all 0.15s ease;
}

[data-bs-theme="dark"] .tagify__dropdown__item {
  color: var(--apple-text-color);
}

.tagify__dropdown__item--active {
  background-color: var(--apple-accent-color);
  color: white !important;
}

[data-bs-theme="dark"] .tagify__dropdown__item--active {
  background-color: var(--apple-accent-color);
  color: #1c1c1e !important;
}

.tagify__dropdown__wrapper {
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tagify__dropdown__wrapper::-webkit-scrollbar { display: none; }
/* --- END OF TAGIFY STYLES --- */


/* --- News Grid Layout --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    transition: opacity 0.3s ease-in-out;
}

/* --- News Card Styling --- */
.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.25s ease;
    overflow: hidden;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--button-glow);
}

.news-card-image {
    height: 180px;
    width: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--apple-card-border);
}

[data-bs-theme="dark"] .news-card-image {
    border-bottom-color: var(--apple-card-border-dark);
}

.news-card .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.news-source {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
    color: #fff;
}

.news-date {
    font-size: 0.75rem;
    color: var(--apple-secondary-text);
}

.news-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--apple-text-color);
}

.news-description {
    font-size: 0.875rem;
    color: var(--apple-secondary-text);
    flex-grow: 1;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-card .btn {
    align-self: flex-start;
}

/* --- Source-Specific Colors --- */
.source-scitech .news-source { background-color: #007bff; }
.source-neuro .news-source  { background-color: #6f42c1; }
/* NASA News */
.source-nasa_main .news-source   { background-color: #dc3545; }
.source-nasa_tech .news-source   { background-color: #fd7e14; }
.source-nasa_aero .news-source   { background-color: #20c997; }
.source-nasa_iss .news-source    { background-color: #17a2b8; }
.source-nasa_artemis .news-source { background-color: #6c757d; }
/* Live Science & Science Alert */
.source-livescience .news-source  { background-color: #ff6f00; }
.source-sciencealert .news-source { background-color: #4caf50; }
/* Phys.org */
.source-phys_main .news-source    { background-color: #d63384; }
.source-phys_physics .news-source { background-color: #6610f2; }
.source-phys_nano .news-source    { background-color: #ffc107; }
.source-phys_earth .news-source   { background-color: #198754; }
.source-phys_space .news-source   { background-color: #0d6efd; }
.source-phys_biology .news-source { background-color: #28a745; }
.source-phys_chemistry .news-source{ background-color: #6f42c1; }
/* Blog Feeds */
.source-conversation .news-source { background-color: #d32f2f; }
.source-symmetry .news-source     { background-color: #7b1fa2; }
.source-planetary_soc .news-source{ background-color: #f57c00; }
.source-quanta .news-source       { background-color: #388e3c; }
.source-nasa_blog_artemis .news-source { background-color: #adb5bd;}
.source-nasa_blog_commcrew .news-source{ background-color: #0d6efd;}
.source-nasa_blog_commres .news-source{ background-color: #0dcaf0;}
.source-nasa_blog_station .news-source{ background-color: #198754;}
.source-nasa_blog_webb .news-source   { background-color: #6610f2;}
.source-nasa_blog_scinews .news-source{ background-color: #d63384;}
.source-nasa_blog_nisar .news-source  { background-color: #ffc107;}
.source-nasa_blog_parker .news-source { background-color: #fd7e14;}
.source-nasa_blog_punch .news-source  { background-color: #dc3545;}
.source-nasa_blog_smallsat .news-source{ background-color: #20c997;}
.source-nasa_blog_skies .news-source  { background-color: #17a2b8;}


/* --- Dark mode adjustments --- */
[data-bs-theme="dark"] .source-scitech .news-source { background-color: #3f9cff; }
[data-bs-theme="dark"] .source-neuro .news-source  { background-color: #a37bed; }
/* NASA News */
[data-bs-theme="dark"] .source-nasa_main .news-source   { background-color: #e57373; }
[data-bs-theme="dark"] .source-nasa_tech .news-source   { background-color: #ffb74d; }
[data-bs-theme="dark"] .source-nasa_aero .news-source   { background-color: #4db6ac; }
[data-bs-theme="dark"] .source-nasa_iss .news-source    { background-color: #4dd0e1; }
[data-bs-theme="dark"] .source-nasa_artemis .news-source { background-color: #90a4ae; }
/* Live Science & Science Alert */
[data-bs-theme="dark"] .source-livescience .news-source  { background-color: #ffa000; }
[data-bs-theme="dark"] .source-sciencealert .news-source { background-color: #81c784; }
/* Phys.org */
[data-bs-theme="dark"] .source-phys_main .news-source    { background-color: #ec407a; }
[data-bs-theme="dark"] .source-phys_physics .news-source { background-color: #9575cd; }
[data-bs-theme="dark"] .source-phys_nano .news-source    { background-color: #ffda69; }
[data-bs-theme="dark"] .source-phys_earth .news-source   { background-color: #4da677; }
[data-bs-theme="dark"] .source-phys_space .news-source   { background-color: #64b5f6; }
[data-bs-theme="dark"] .source-phys_biology .news-source { background-color: #52c41a; }
[data-bs-theme="dark"] .source-phys_chemistry .news-source{ background-color: #b39ddb; }
/* Blog Feeds */
[data-bs-theme="dark"] .source-conversation .news-source { background-color: #ef5350; }
[data-bs-theme="dark"] .source-symmetry .news-source     { background-color: #ba68c8; }
[data-bs-theme="dark"] .source-planetary_soc .news-source{ background-color: #ffb74d; }
[data-bs-theme="dark"] .source-quanta .news-source       { background-color: #81c784; }
/* NASA Blog Feeds */
[data-bs-theme="dark"] .source-nasa_blog_artemis .news-source { background-color: #ced4da;}
[data-bs-theme="dark"] .source-nasa_blog_commcrew .news-source{ background-color: #64b5f6;}
[data-bs-theme="dark"] .source-nasa_blog_commres .news-source{ background-color: #5ae1f8;}
[data-bs-theme="dark"] .source-nasa_blog_station .news-source{ background-color: #4da677;}
[data-bs-theme="dark"] .source-nasa_blog_webb .news-source   { background-color: #9575cd;}
[data-bs-theme="dark"] .source-nasa_blog_scinews .news-source{ background-color: #ec407a;}
[data-bs-theme="dark"] .source-nasa_blog_nisar .news-source  { background-color: #ffda69;}
[data-bs-theme="dark"] .source-nasa_blog_parker .news-source { background-color: #ffcc80;}
[data-bs-theme="dark"] .source-nasa_blog_punch .news-source  { background-color: #ef5350;}
[data-bs-theme="dark"] .source-nasa_blog_smallsat .news-source{ background-color: #80cbc4;}
[data-bs-theme="dark"] .source-nasa_blog_skies .news-source  { background-color: #80deea;}


/* --- Custom Spinner Styles --- */
.custom-spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    width: 100%;
}

.pulsing-dots-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.pulsing-dots-spinner div {
    width: 12px;
    height: 12px;
    margin: 0 5px;
    background-color: var(--apple-accent-color);
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out both;
}

.pulsing-dots-spinner div:nth-child(1) { animation-delay: -0.32s; }
.pulsing-dots-spinner div:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1.0); opacity: 1; }
}