/* Popup Overlay */
#sds-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 99998;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 15px;
    box-sizing: border-box;
}

/* Class to show the popup */
#sds-popup-overlay.sds-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* Popup Content Box */
#sds-popup-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 99999;
    width: 100%;
    max-width: 550px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

#sds-popup-overlay.sds-popup-visible #sds-popup-content {
    transform: scale(1);
}

/* Close Button ("Skip") (Request 2: New Styles) */
#sds-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: #f1f1f1;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    line-height: 1.2;
    text-align: center;
    color: #555;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    /* Remove old circle/icon styles */
    width: auto;
    height: auto;
}

#sds-popup-close:hover {
    background: #e0e0e0;
    color: #000;
    /* Remove old transform */
    transform: none;
}

/* Text Container */
.sds-popup-text {
    padding: 2.5rem 2rem 1.5rem 2rem; /* Added more top padding for new close button */
    text-align: center;
    overflow-y: auto;
    flex-grow: 1;
}

/* Main Title */
.sds-popup-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--sds-main-title-color); /* Use CSS variable for color */
    margin: 0 0 1.5rem 0;
}

/* Image Container */
.sds-popup-image {
    width: 100%;
    max-height: 250px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.sds-popup-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* --- Item Styles --- */

/* Container for all items */
.sds-popup-items-container {
    width: 100%;
    margin-top: 1rem;
}

/* A single item block */
.sds-popup-item {
    background: var(--sds-item-bg-color); /* Use CSS variable for background color */
    border-radius: 8px;
    padding: 15px;
    text-align: left;
    margin-bottom: 12px;
    border: 1px solid #eee;
}

/* Item Image */
.sds-popup-item-image {
    width: 100%;
    max-height: 150px;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 10px;
}
.sds-popup-item-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}


/* The title for an item */
.sds-popup-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

/* Item Description */
.sds-popup-item-description {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

/* Container for the 3 links */
.sds-popup-item-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* A single link button (Request 1: Use Color Variable) */
.sds-popup-item-link {
    display: inline-block;
    flex: 1 1 120px;
    background: var(--sds-link-button-color); /* Use CSS variable for color */
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sds-popup-item-link:hover {
    color: #ffffff;
    opacity: 0.85;
    transform: translateY(-2px);
}

/* If there are only 2 links, make them larger (Laptop/Tablet) */
@media (min-width: 601px) {
    .sds-popup-item-links .sds-popup-item-link:first-child:nth-last-child(2),
    .sds-popup-item-links .sds-popup-item-link:last-child:nth-last-child(2) {
        flex-grow: 2;
    }
}


/* Responsive */
@media (max-width: 600px) {
    #sds-popup-content {
        width: 100%;
        max-height: 85vh;
        border-radius: 8px;
    }
    
    .sds-popup-text {
        padding: 2.5rem 1rem 1.5rem 1rem; /* Adjust padding for mobile */
    }

    .sds-popup-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .sds-popup-image {
        max-height: 180px;
        margin-bottom: 1rem;
        border-radius: 6px;
    }

    /* Stack links vertically on small screens */
    .sds-popup-item-links {
        flex-direction: column;
        gap: 8px;
    }

    .sds-popup-item-link {
        flex: 1 1 100%;
        font-size: 0.85rem;
        padding: 12px 10px;
    }
    
    #sds-popup-close {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
}