/* Body styling */
body {
    background-color: #232326; /* Fallback color */
    color: white;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    position: relative;
}

.page-header {
    min-height: 36px;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* Container for the items */
#itemsContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.item {
    background-color: #303033;
    padding: 10px;
    padding-left: 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 90%;
    max-width: 900px;
    min-height: 100px;
    margin: 10px 0;
    -webkit-animation: flip-in-hor-bottom 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
    animation: flip-in-hor-bottom 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}

.item.no-item-animation {
    -webkit-animation: none;
    animation: none;
}

@-webkit-keyframes flip-in-hor-bottom {
  0% {
    -webkit-transform: rotateX(80deg);
            transform: rotateX(80deg);
    opacity: 0;
  }
  100% {
    -webkit-transform: rotateX(0);
            transform: rotateX(0);
    opacity: 1;
  }
}
@keyframes flip-in-hor-bottom {
  0% {
    -webkit-transform: rotateX(80deg);
            transform: rotateX(80deg);
    opacity: 0;
  }
  100% {
    -webkit-transform: rotateX(0);
            transform: rotateX(0);
    opacity: 1;
  }
}

.news-header {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    min-height: 72px;
    margin: 0 0 18px;
    padding-top: 6px;
    box-sizing: border-box;
}

.news-header h1 {
    margin: 0;
    text-align: center;
    line-height: 1.2;
}

/* Wrapper for item content */
.item-content-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 10px;
}

/* Date and time container */
.item-date-container {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 25px;
    min-height: 25px;
    margin-top: 8px;
    box-sizing: border-box;
    border: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-header-row {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.item-title-wrap {
    flex: 1;
    min-width: 0;
}

.item-details-wrap {
    width: 100%;
    margin-top: 6px;
}

/* Date styling */
.item-date {
    font-size: 14px;
    color: #bbb;
}

/* Time styling */
.item-time {
    font-size: 14px;
    color: #bbb;
}

.item-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* No results message */
.no-results-message {
    text-align: center;
    font-size: 18px;
    color: white;
    padding: 20px;
    background-color: #1f1f1f;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 20px;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.page-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:disabled {
    cursor: default;
}

.page-btn:focus {
    outline: none;
}

.page-icon {
    width: 30px;
    height: 30px;
}

.page-btn:disabled .page-icon {
    opacity: 0.25;
}

.page-input {
    width: 55px;
    padding: 6px 8px;
    background: #2d2d2f;
    color: #ffffff;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 15px;
    text-align: center;

    /* Remove spinners in Chrome */
    -moz-appearance: textfield;
}
.page-input::-webkit-inner-spin-button,
.page-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hover/focus effect */
.page-input:focus {
    outline: none;
    border-color: #7a4dff;
    box-shadow: 0 0 6px rgba(122, 77, 255, 0.6);
}

.page-input:hover {
    border-color: #888;
}

.page-total {
  text-align: center;
  line-height: 33px;
}

/* sub-menus */
.item-sitelinks {
    margin-top: 8px;
    border-top: 1px solid #3a3a3d;
    min-height: 90px;
}

.item-sitelink-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    text-decoration: none;
    color: #8ab4f8;
    border-bottom: 1px solid #3a3a3d;
    transition: background-color 0.2s ease;
}

.item-sitelink-row:last-child {
    border-bottom: none;
}

.item-sitelink-row:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.item-sitelink-title {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Box for the icon/image */
.box {
    width: 45px;
    height: 45px;
    border-radius: 5px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    margin-right: 10px;
    animation: fade-in 1.2s cubic-bezier(0.390, 0.575, 0.565, 1.000) both;
}

/* Content styling */
.item-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
    min-width: 0;
}

/* Title styling */
.item-title {
    color: white;
    font-weight: bold;
    margin-bottom: 4px;

    /* wrapping & safety */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;

    /* clamp */
    display: -webkit-box;
    -webkit-line-clamp: 2;     /* ⬅ limit title height */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-title a {
    color: #8ab4f8; /* search-style link blue */
    text-decoration: none;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;

    word-break: break-word;
    overflow-wrap: anywhere;
}

.item-title a:hover {
    text-decoration: underline;
}

/* Description styling */
.item-description {
    color: #bbb;
    margin-top: 8px;

    /* wrapping */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;

    /* clamp */
    display: -webkit-box;
    -webkit-line-clamp: 3;          /* max lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-url {
    color: #8ab4f8;
    font-size: 14px;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.load-more-button {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.load-more-button:hover {
    background-color: #45a049;
}

.load-more-button:active {
    background-color: #388e3c;
}

/* Loading spinner container */
#dbspinner-container {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 15px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 9999;
}

/* Spinner animation */
.dbspinner {
    width: 16px;
    height: 16px;
    border: 3px solid white;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* General spinner */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 40%;
    left: 35%;
    transform: translate(-50%, -50%);
    display: none;
}

/* Spinner animation keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search container */
.search-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin: auto;
}

/* Search box styling */
.search-box {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: none;
    border-radius: 25px;
    background-color: #1f1f1f;
    color: white;
    font-size: 16px;
    transition: background-color 0.3s;
}

/* Search box placeholder */
.search-box::placeholder {
    color: #888;
}

/* Focused search box */
.search-box:focus {
    outline: none;
    background-color: #333;
    box-shadow: 1px 1px 4px 0 rgba(0,0,0,0.2);
}
.suggestion-box {
    display: none;
}
/* Clear button */
#clearButton {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: white;
    display: none;
}

/* Hover effect for clear button */
#clearButton:hover {
    color: #ff4d4d;
}

/* Search count */
#searchcount {
    padding-bottom: 5px;
}

/* Error message */
#errorMessage {
    color: red;
    margin: 40px 20px 0;
    text-align: center;
    font-size: large;
}

/* Info button */
.open-modal-btn {
    display: block;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 0;
    border: none;
    background-color: #3B358B;
    -webkit-mask: url('/icons/infoicon.svg');
    mask: url('/icons/infoicon.svg');
    -webkit-mask-size: 28px 28px;
    mask-size: 28px 28px;
    mask-repeat: no-repeat;
    mask-position: center;
}

/* About overlay */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

/* Modal box */
.modal-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 600px;
    max-width: 90%;

    background: #303033;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;

    text-align: center;
    position: relative;
}

/* Title */
.modal-box h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

/* Purple pill meta bar */
.about-meta-bar {
    display: flex;
    gap: 18px;
    padding: 8px 20px;
    background: linear-gradient(90deg, #6a32e6, #7b3ff2);
    border-radius: 999px;
    font-size: 14px;
    color: #fff;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.about-meta-bar strong {
    font-weight: 600;
}

/* Body text */
.modal-box p {
    margin: 0;
    font-size: 16px;
    color: #e0e0e0;
    line-height: 1.4;
}

/* Links */
.modal-box a {
    color: #b18cff;
    text-decoration: none;
}

.modal-box a:hover {
    text-decoration: underline;
}

/* Close button */
.close-modal-btn {
    width: 30px;
    height: 30px;
    cursor: pointer;

    position: absolute;
    top: 14px;
    right: 14px;

    background-color: #3B358B;
    -webkit-mask: url('/icons/close.svg');
    mask: url('/icons/close.svg');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;

    border: none;
}

.close-modal-btn:hover {
    background-color: #5a52c6;
}

.top-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    z-index: 100;
}

.news-btn {
    display: block;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex: 0 0 40px;
    background-color: #3B358B;

    -webkit-mask: url('/icons/news.svg');
    mask: url('/icons/news.svg');

    -webkit-mask-size: 28px 28px;
    mask-size: 28px 28px;
    mask-repeat: no-repeat;
    mask-position: center;
}

.search-btn {
    display: block;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex: 0 0 40px;
    background-color: #3B358B;

    -webkit-mask: url('/icons/search.svg');
    mask: url('/icons/search.svg');

    -webkit-mask-size: 28px 28px;
    mask-size: 28px 28px;
    mask-repeat: no-repeat;
    mask-position: center;
}

.filter-btn {
    display: block;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex: 0 0 40px;
    border: none;
    background-color: #3B358B;
    -webkit-mask: url('/icons/filter.svg');
    mask: url('/icons/filter.svg');
    -webkit-mask-size: 28px 28px;
    mask-size: 28px 28px;
    mask-repeat: no-repeat;
    mask-position: center;
}

.filter-btn.active,
.filter-btn:hover {
    background-color: #5a52c6;
}

.filter-modal-box {
    width: 480px;
    max-width: 92%;
    max-height: 70vh;
    overflow-y: auto;
    text-align: left;
    align-items: stretch;
}

.filter-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-menu-header h2 {
    margin: 0;
    font-size: 20px;
}

.filter-menu-subtitle {
    margin: 8px 0 14px;
    color: #c2c2d9;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tag {
    border: 1px solid #5a5a6a;
    background: #2f2f36;
    color: #efefff;
    border-radius: 999px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.filter-tag:hover {
    border-color: #7a4dff;
}

.filter-tag.selected {
    border-color: #7a4dff;
    background: rgba(122, 77, 255, 0.24);
}

.open-modal-btn {
    flex: 0 0 40px;
}

/* Responsive tweaks */

@media (max-width: 600px) {
    .filter-modal-box {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    .modal-box {
        padding: 16px;
        gap: 14px;
    }

    .modal-box h2 {
        font-size: 24px;
    }

    .about-meta-bar {
        flex-direction: column;
        gap: 6px;
        padding: 10px 16px;
    }
}

/* Mobile: keep cards visually consistent even when date/time row is missing */
@media (max-width: 600px) {
    .item {
        min-height: 160px; /* tune: 130–160 depending on your font sizes */
    }
}

/* Mobile layout correction */
@media (max-width: 600px) {

    /* Remove artificial left shift */
    .item-url,
    .item-description {
        margin-left: 0;
    }

    /* Reduce card padding so text fills width */
    .item {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Tighten icon spacing */
    .box {
        margin-right: 8px;
    }

    /* Ensure text uses full width */
    .item-text {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .item-content-wrapper {
        flex-direction: column;
    }

    .item-header-row {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .item-details-wrap {
        margin-left: 0;
        padding-left: 0;
        width: 100%;
    }

    .item-url,
    .item-description {
        margin-left: 0;
        padding-left: 0;
    }

    .box {
        margin-right: 8px;
    }
}
