/* ==========================================================================
   Base Styles & Variables
   ========================================================================== */
:root {
    --primary-color: #007a33;
    --secondary-color: #01471d;
    --background-color: #fff;
    --text-color: #000;
    --grey-text-color: #373737;
    --font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   Font Definitions
   ========================================================================== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/selbsthilfe-sachsen-karte/assets/fonts/inter-v19-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('/selbsthilfe-sachsen-karte/assets/fonts/inter-v19-latin-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/selbsthilfe-sachsen-karte/assets/fonts/inter-v19-latin-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/selbsthilfe-sachsen-karte/assets/fonts/inter-v19-latin-700.woff2') format('woff2');
}

/* ==========================================================================
   Global Element & Utility Styles
   ========================================================================== */
html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    scroll-behavior: smooth;
    font-family: 'Inter', sans-serif;
}

p, a, h1, h2, h3, h4, h5, h6 {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    color: var(--text-color);
}

h3 {
    margin: 0.5rem 0;
}

a{
    color: var(--secondary-color);
    text-decoration: none;
}

a:hover, a:focus {
    color: var(--text-color);
    text-decoration: underline;
}

.hidden {
    display: none;
}

/* ==========================================================================
   Main Layout
   ========================================================================== */
main {
    padding: 0;
    box-sizing: border-box;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    display: flex;
    flex-wrap: wrap;
    flex-grow: 1;
    margin: 0;
    min-height: 0;
}

#contact-list {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Vertically center the content of the list ONLY when the initial message is visible */
#contact-list:has(.initial-message:not([style*="display: none"])) {
    justify-content: center;
}

.initial-message {
    text-align: center;
}

.initial-message img{
    width: 4rem;
    height: auto;
    margin-bottom: 20px;
}

/* ==========================================================================
   Contact Points Column (#contact-points)
   ========================================================================== */
#contact-points {
    width: 33%;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#contact-points > p {
    margin-bottom: 20px;
}

/* Filter Bar */
#filter-bar {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#filter-bar button {
    padding: 8px 12px;
    border: 1px solid var(--primary-color);
    background-color: #fff;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}

#filter-bar button:hover,
#filter-bar button.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Contact List Items */
.contact-point {
    position: relative; /* For copy button positioning */
    background-color: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 0.8rem 0.5rem 0.8rem 0.8rem;
    margin-bottom: 0.625rem;
}

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
}

.copy-button img {
    width: 100%;
    height: 100%;
}

.contact-point h4 {
    font-size: 1.15rem;
    padding: 0.1rem 2rem 0.125rem 0;
}

p.name {
    display: block;
    color: var(--grey-text-color);
    border-bottom: 1px solid #666; /* subtle divider under the name */
    padding-bottom: 0.6rem;
    margin-bottom: 0.9rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

.detail-grid > div {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.detail-grid > .opening-hours-wrapper {
    margin-bottom: -10px;
}

.opening-hours-comment-wrapper, .opening-hours-wrapper {
    align-items: flex-start;
}

.detail-grid > div > img {
    width: 1.25rem;
    height: 1.25rem;
}

.opening-hours-content {
    width: 100%;
}

.opening-hours-header {
    cursor: pointer;
    width: 100%;
    margin-bottom: 0.5rem;
    user-select: none;
    -webkit-user-drag: none;
}

.status-and-chevron {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chevron-icon {
    margin-top: 0.4rem;
    width: 1rem;
    height: 1rem;
    transition: transform 0.3s ease;
}

.chevron-icon.expanded {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.expanded {
    max-height: 500px; /* Adjust as needed */
}

.weekly-opening-hours {
    display: grid;
    grid-template-columns: 80px 1fr; /* Day and time */
    gap: 0.5rem 3.5rem;
    font-size: 0.9rem;
    align-items: start;
    margin-left: 37px;
}

.day-times {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.weekly-opening-hours > div.current-day {
    font-weight: bold;
}

.closed-text {
    color: #666;
}

.opening-hours-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

/* Social Links */
.social-links-container {
    display: flex;
    gap: 0.25rem;
    margin-top: 5px;
}

.social-links-container a {
    background-color: var(--primary-color);
    padding: 0.8rem;
    border-radius: 0.5rem;
}

.social-links-container a:hover {
    background-color: var(--secondary-color);
}

.social-links-container a {
    width: 1.5rem;
    height: 1.5rem;
    display: inline-block;
}

.social-links-container a img {
    width: 100%;
    height: 100%;
}

.contact-point .social a {
    margin-right: 10px;
}

.contact-point .social a:last-child {
    margin-right: 0;
}

/* Load More Button */
#load-more {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: 2px solid var(--primary-color);
    background-color: #fff;
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}

#load-more:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* ==========================================================================
   Map Column (#map-container)
   ========================================================================== */
#map-container {
    width: 67%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#sachsen-map {
    width: 90%;
    height: 90%;
    object-fit: contain;
    user-select: none;
}

/* ==========================================================================
   Opening Status
   ========================================================================== */
.opening-status {
    grid-column: span 2;
    margin-top: 5px;
}

.status-open .status-text-bold {
    color: #28a745; /* Green */
}

.status-closed .status-text-bold {
    color: #dc3545; /* Red */
}

.status-appointment {
    color: #fd7e14; /* Orange */
    font-weight: 600;
}

.status-text-bold {
    font-weight: 600;
}

.status-text-extra {
    color: var(--text-color);
    font-weight: 400;
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media (max-width: 979px) {
    main {
        height: auto;
        overflow: auto;
    }

    .content-wrapper {
        flex-direction: column;
        height: auto;
        overflow: auto;
    }

    #contact-points, #map-container {
        width: 100%;
        height: 50vh;
    }
}

@media (min-width: 979px) {
    #map-container {
        position: sticky;
        top: 20px;
        align-self: flex-start;
        height: calc(100vh - 40px);
    }
}

@media (max-width: 979px) {
    #map-container {
        display: none;
    }

    #contact-points {
        height: auto;
    }
}