* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    text-wrap: pretty;
}

body {
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    transition: background-color 0.3s ease;
}

body.dark-mode {
    background-color: #1a1a1a;
}

.main-container {
    background-color: #d9e3e4;
    width: 100%;
    max-width: 1000px;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    overflow: visible;
}

body.dark-mode .main-container {
    background-color: #2a2a2a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    overflow: visible;
}

header {
    text-align: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ccc;
    transition: border-bottom-color 0.3s ease;
}

body.dark-mode header {
    border-bottom: 1px solid #555;
}

header img {
    max-width: 160px;
    height: auto;
    margin-bottom: 1rem;
    border-radius: 50%;
    border: none;
}

header h2 {
    color: #428ea8;
    font-size: 3rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    padding-bottom: 25px;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

body.dark-mode header h2 {
    color: #5a9bb6;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

header p {
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 2;
    font-size: 1.2rem;
    font-weight: 400;
    margin: 0.5rem 0;
    background: rgba(66, 142, 168, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-align: center;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode header p {
    background: rgba(66, 142, 168, 0.4);
    color: #e0e0e0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#theme-toggle {
    padding: 6px 10px;
    border: 1px solid #83b9cc;
    background-color: #e9ecef;
    color: #072539;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background-color 0.2s, color 0.2s;
    margin: 10px;
}

#theme-toggle:hover {
    background-color: #ced4da;
}

#theme-toggle.active {
    background-color: #428ea8;
    color: white;
    border-color: #428ea8;
}

.loader {
    display: block; /* Visible by default */
    border: 4px solid #f3f3f3;
    border-top: 4px solid #428ea8;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.loader.hidden {
    display: none; /* Hide when done */
}

.unbolded {
    font-weight: normal;
}

.label-text {
    font-size: 1rem;
    font-style: normal;
    color: #072539;
    font-weight: 700;
    line-height: 2;
    display: inline;
    background-color: transparent;
    transition: color 0.3s ease;
}

body.dark-mode .label-text {
    color: #e0e0e0;
}

#result .result-text {
    font-size: 1rem;
    padding: 1.25rem;
    border-radius: 12px;
    background-color: #f0f0f0;
    border: 2px solid #83b9cc;
    margin: 0.75rem auto;
    text-align: center;
    font-style: normal;
    color: #072539;
    font-weight: 400;
    text-shadow: 1px 1px 3px rgba(66, 142, 168, 0.3);
    line-height: 2;
    box-shadow: none;
    max-width: 60%;
    outline: none;
    background-image: none;
    background-clip: padding-box;
    min-width: 0;
    width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode #result .result-text {
    background-color: #3a3a3a;
    border: 2px solid #5a9bb6;
    color: #e0e0e0;
    text-shadow: 1px 1px 3px rgba(66, 142, 168, 0.5);
}

#result {
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    width: 100%;
    transition: background-color 0.3s ease;
}

body.dark-mode #result {
    background-color: #2a2a2a;
}

#result p {
    background-color: transparent;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    transition: background-color 0.3s ease;
}

body.dark-mode #result p {
    background-color: #3a3a3a;
}

.result-spacing {
    margin-top: 1rem;
}

.filter-container {
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

body.dark-mode .filter-container {
    background-color: #3a3a3a;
}

.filter-container div {
    margin: 10px 0;
}

.filter-container h4 {
    padding: 0.5rem 1rem;
    background-color: transparent;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #072539;
    transition: color 0.3s ease;
}

body.dark-mode .filter-container h4 {
    color: #e0e0e0;
}

.filter-container button {
    margin: 5px;
    padding: 8px 12px;
    border: 1px solid #83b9cc;
    background-color: #f0f0f0;
    color: #072539;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s, border-color 0.3s ease;
}

body.dark-mode .filter-container button {
    border: 1px solid #5a9bb6;
    background-color: #2a2a2a;
    color: #e0e0e0;
}

.filter-container button.active {
    background-color: #428ea8;
    color: white;
    border-color: #428ea8;
}

body.dark-mode .filter-container button.active {
    background-color: #5a9bb6;
    border-color: #5a9bb6;
}

.filter-container button:hover {
    background-color: #ced4da;
}

body.dark-mode .filter-container button:hover {
    background-color: #3a3a3a;
}

.content-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 0;
    align-items: center;
    background-color: #d9e3e4;
    transition: background-color 0.3s ease;
}

body.dark-mode .content-section {
    background-color: #3a3a3a;
}

.content-section.hidden {
    display: none;
}

.content-section p {
    margin: 0.5rem 0;
    font-size: 1rem;
    line-height: 1.6;
    color: #072539;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

body.dark-mode .content-section p {
    color: #e0e0e0;
    text-shadow: 1px 1px 3px rgba(66, 142, 168, 0.5);
}

.content-section p strong {
    font-weight: 600;
}

.info-box {
    background-color: #fff;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    text-align: left;
    color: #072539;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode .info-box {
    background-color: #4a4a4a;
    color: #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.info-box .title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-direction: row;
}

.info-box h3 {
    font-size: 1.5rem;
    color: #83b9cc;
    margin: 0;
    transition: color 0.3s ease;
}

body.dark-mode .info-box h3 {
    color: #5a9bb6;
}

.info-box p.image-links {
    display: flex;
    align-items: center;
    margin: 0;
    position: relative;
}

.info-box p.image-links a img {
    width: 32px;
    height: 32px;
    margin: 0 8px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: box-shadow 0.3s ease;
}

body.dark-mode .info-box p.image-links a img {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.info-box p.image-links a {
    position: relative;
}

a {
    color: #83b9cc;
    transition: color 0.3s ease;
}

body.dark-mode a {
    color: #5a9bb6;
}

.info-box p.image-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(66, 142, 168, 0.3), rgba(131, 185, 204, 0.3));
    border-radius: 50%;
    z-index: 0;
    transition: background 0.3s ease;
}

body.dark-mode .info-box p.image-links a::before {
    background: linear-gradient(135deg, rgba(66, 142, 168, 0.5), rgba(131, 185, 204, 0.5));
}

.info-box p.image-links:not(.title-row p) {
    position: relative;
}

.info-box p.image-links:not(.title-row p)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(66, 142, 168, 0.3), rgba(131, 185, 204, 0.3));
    border-radius: 50%;
    z-index: 0;
}

body.dark-mode .info-box p.image-links:not(.title-row p)::before {
    background: linear-gradient(135deg, rgba(66, 142, 168, 0.5), rgba(131, 185, 204, 0.5));
}

.info-box p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0.5rem 0;
    text-align: left;
    color: #072539;
    transition: color 0.3s ease;
}

body.dark-mode .info-box p {
    color: #e0e0e0;
}

.info-box .smalltext {
    font-size: 0.7rem;
    margin: 0.25rem 0;
    transition: color 0.3s ease;
}

body.dark-mode .info-box .smalltext {
    color: #d0d0d0;
}

.section-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}

.section-buttons button {
    padding: 6px 10px;
    border: 1px solid #83b9cc;
    background-color: #e9ecef;
    color: #072539;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background-color 0.2s, color 0.2s, border-color 0.3s ease;
}

body.dark-mode .section-buttons button {
    border: 1px solid #5a9bb6;
    background-color: #2a2a2a;
    color: #e0e0e0;
}

.section-buttons button.active {
    background-color: #428ea8;
    color: white;
    border-color: #428ea8;
}

body.dark-mode .section-buttons button.active {
    background-color: #5a9bb6;
    border-color: #5a9bb6;
}

.section-buttons button:hover {
    background-color: #ced4da;
}

body.dark-mode .section-buttons button:hover {
    background-color: #3a3a3a;
}

.image-container {
    max-width: 100%;
    overflow: hidden;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.image-container img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}

body.dark-mode .image-container img {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

footer {
    text-align: center;
    color: #666;
    font-size: 1rem;
    padding: 1.2rem;
    border-top: 1px solid #ccc;
    transition: color 0.3s ease, border-top-color 0.3s ease;
}

body.dark-mode footer {
    color: #999;
    border-top: 1px solid #555;
}

footer a {
    color: #83b9cc;
    text-decoration: none;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

body.dark-mode footer a {
    color: #5a9bb6;
}

footer a:hover {
    text-decoration: underline;
}

/* Accordion Styles */
.accordion {
    width: 100%;
    max-width: 100%;
    margin: 1.5rem auto;
    transition: margin 0.3s ease;
}

body.dark-mode .accordion {
    background-color: #3a3a3a;
}

.accordion-item {
    border-bottom: 2px solid #83b9cc;
    transition: border-bottom-color 0.3s ease;
}

body.dark-mode .accordion-item {
    border-bottom: 2px solid #5a9bb6;
}

.accordion-header {
    background-color: #f0f0f0;
    border: none;
    padding: 1rem;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #428ea8;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s, border-color 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .accordion-header {
    background-color: #2a2a2a;
    color: #5a9bb6;
}

.accordion-header:hover {
    background-color: #ced4da;
}

body.dark-mode .accordion-header:hover {
    background-color: #3a3a3a;
}

.accordion-header::after {
    content: '\25BC'; /* Down arrow */
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.accordion-header.active::after {
    transform: rotate(180deg); /* Up arrow when active */
}

.accordion-content {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .accordion-content {
    background-color: #4a4a4a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.accordion-content.active {
    max-height: 1500px;
    padding: 0.5rem 1rem;
}

.accordion-content p {
    font-size: 0.9rem;
    line-height: 2;
    font-weight: 400;
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-wrap: balance;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode .accordion-content p {
    background: rgba(66, 142, 168, 0.4);
}

/* Mobile (<600px) */
@media (max-width: 600px) {
    body {
        padding: 1.5rem;
    }

    .main-container {
        padding: 1rem;
        overflow: visible;
    }

    header img {
        max-width: 100px;
    }

    header h2 {
        font-size: 2.4rem;
    }

    .info-box {
        padding: 0.8rem;
    }

    .info-box .title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .info-box h3 {
        font-size: 1.2rem;
    }

    .info-box p.image-links {
        justify-content: flex-start;
        margin: 0;
    }

    .info-box p.image-links a img {
        width: 28px;
        height: 28px;
        margin: 0 6px;
        border-radius: 50%;
        box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
    }

    .info-box p.image-links a::before {
        width: 28px;
        height: 28px;
    }

    .info-box p.image-links img {
        width: 28px;
        height: 28px;
        margin: 0 6px;
        border-radius: 50%;
    }

    .info-box p.image-links:not(.title-row p)::before {
        width: 28px;
        height: 28px;
    }

    .info-box p {
        font-size: 0.9rem;
        text-align: left;
    }

    .info-box .smalltext {
        font-size: 0.6rem;
        margin: 0.2rem 0;
    }

    .section-buttons button {
        padding: 5px 8px;
        font-size: 0.8rem;
    }

    .image-container img {
        width: 100%;
        height: auto;
    }

    footer {
        font-size: 0.9rem;
        padding: 0.8rem;
    }

    .accordion-content.active {
        max-height: 1500px;
        padding: 0.3rem 0.5rem;
    }
    
    .accordion-content p {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
        text-wrap: balance;
        word-break: break-word;
    }

    #result .result-text {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        border-radius: 10px;
        max-width: 85%;
    }

    .result-spacing {
        margin-top: 0.75rem;
    }

    .filter-container button {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .filter-container h4 {
        font-size: 0.8rem;
    }
}

/* Tablet (600px - 1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
    .main-container {
        padding: 1.5rem;
        overflow: visible;
    }

    .info-box h3 {
        font-size: 1.4rem;
    }

    .info-box p {
        font-size: 1.05rem;
    }

    .info-box p.image-links a img,
    .info-box p.image-links img {
        width: 30px;
        height: 30px;
    }

    .info-box p.image-links a::before,
    .info-box p.image-links:not(.title-row p)::before {
        width: 30px;
        height: 30px;
    }

    .accordion-content.active {
        padding: 0.5rem 1rem; /* Maintain original padding */
    }
    .accordion-content p {
        padding: 0.5rem 1rem; /* Maintain inner padding */
    }

    .info-box .smalltext {
        font-size: 0.65rem;
    }

    .section-buttons button {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    #result .result-text {
        max-width: 70%;
    }

    .filter-container button {
        padding: 7px 11px;
        font-size: 0.85rem;
    }

    .filter-container h4 {
        font-size: 0.85rem;
    }
}
