/* ====================================
   Base styles for all popups
   ==================================== */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.popup-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    opacity: 0;
    transform: scale(0.9);
    animation: popIn 0.3s 0.1s forwards;
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #666;
    z-index: 10;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #000;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes popIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* ====================================
   1. Modal (center of the screen)
   ==================================== */

.popup-modal {}

.popup-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}

.popup-modal-content {
    width: 500px;
    padding: 40px;
    position: relative;
    background: #f2f2f2;
    border-radius: 4px;
    max-height: 90%;
    overflow: auto;
}

.popup-modal .popup-header {
    margin-bottom: 20px;
}

.popup-modal .popup-title {
    font-size: 30px;
    font-weight: 600;
    color: #364A63;
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.popup-modal .popup-subtitle {
    margin-bottom: 1rem;
}

.popup-subtitle {
    font-size: 24px;
    text-align: center;
}

.popup-modal .popup-description {
    font-size: 16px;
    line-height: 1.5;
    color: #555;
    margin: 0;
}

.popup-modal .popup-body {
    margin-bottom: 24px;
}

.popup-modal .popup-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.popup-modal .popup-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-modal .popup-btn-primary {
    background: #007bff;
    color: #fff;
}

.popup-modal .popup-btn-primary:hover {
    background: #0056b3;
}

.popup-modal .popup-btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.popup-modal .popup-btn-secondary:hover {
    background: #dee2e6;
}


/* ====================================
   2. Banner (top or bottom)
   ==================================== */

.popup-banner {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

.popup-banner.banner-top {
    top: 0;
}

.popup-banner.banner-bottom {
    bottom: 0;
}

.popup-banner .popup-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
}

.popup-banner .popup-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.popup-banner .popup-text {
    flex: 1;
}

.popup-banner .popup-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #222;
}

.popup-banner .popup-description {
    font-size: 14px;
    line-height: 1.4;
    color: #555;
    margin: 0;
}

.popup-banner .popup-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.popup-banner .popup-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.popup-banner .popup-btn-primary {
    background: #007bff;
    color: #fff;
}

.popup-banner .popup-btn-primary:hover {
    background: #0056b3;
}

.popup-banner .popup-close {
    position: static;
    width: 24px;
    height: 24px;
    font-size: 20px;
    margin-left: 8px;
}


/* ====================================
   3. Corner (corner notification)
   ==================================== */

.popup-corner {
    position: fixed;
    width: 360px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 9999;
}

.popup-corner.corner-top-left {
    top: 20px;
    left: 20px;
}

.popup-corner.corner-top-right {
    top: 20px;
    right: 20px;
}

.popup-corner.corner-bottom-left {
    bottom: 20px;
    left: 20px;
}

.popup-corner.corner-bottom-right {
    bottom: 20px;
    right: 20px;
}

.popup-corner .popup-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.popup-corner .popup-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.popup-corner .popup-text {
    flex: 1;
    padding-right: 24px;
}

.popup-corner .popup-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #222;
}

.popup-corner .popup-description {
    font-size: 14px;
    line-height: 1.4;
    color: #555;
    margin: 0;
}

.popup-corner .popup-body {
    margin-bottom: 16px;
}

.popup-corner .popup-footer {
    display: flex;
    gap: 8px;
}

.popup-corner .popup-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-corner .popup-btn-primary {
    background: #007bff;
    color: #fff;
}

.popup-corner .popup-btn-primary:hover {
    background: #0056b3;
}

.popup-corner .popup-btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.popup-corner .popup-btn-secondary:hover {
    background: #dee2e6;
}


/* ====================================
   4. Fullscreen (full screen)
   ==================================== */

.popup-fullscreen {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.popup-fullscreen .popup-close {
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    font-size: 32px;
}

.popup-fullscreen .popup-content {
    max-width: 600px;
}

.popup-fullscreen .popup-image {
    max-width: 100%;
    max-height: 40vh;
    margin-bottom: 32px;
}

.popup-fullscreen .popup-title {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #222;
}

.popup-fullscreen .popup-description {
    font-size: 18px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 32px;
}

.popup-fullscreen .popup-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.popup-fullscreen .popup-btn {
    padding: 16px 40px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-fullscreen .popup-btn-primary {
    background: #007bff;
    color: #fff;
}

.popup-fullscreen .popup-btn-primary:hover {
    background: #0056b3;
}

.popup-fullscreen .popup-btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.popup-fullscreen .popup-btn-secondary:hover {
    background: #dee2e6;
}


/* ====================================
   5. Slide-in (slide-out panel from right)
   ==================================== */

/* Container without overlay */
.popup-slidein-container {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 500px;
    max-height: 500px;
    z-index: 9999;
}

.popup-slidein-container.active {
    pointer-events: all;
}

/* Panel */
.popup-slidein {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 500px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-radius: 8px 0 0 8px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    /* Hidden on the right */
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-slidein.active {
    transform: translateX(0);
    /* Slides in */
}

/* Close button */
.popup-slidein .popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #666;
    z-index: 10;
    transition: color 0.2s;
    padding: 0;
}

.popup-slidein .popup-close:hover {
    color: #000;
}

/* Panel content */
.popup-slidein .popup-content {
    padding: 60px 24px 24px;
    /* Top padding for close button */
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Title */
.popup-slidein .popup-title {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: #222;
    margin: 0;
    word-wrap: break-word;
    text-align: center;
}

/* Subtitle */
.popup-slidein .popup-subtitle {
    font-size: 16px;
    line-height: 1.4;
    color: #555;
    margin: 0;
    word-wrap: break-word;
}

/* Body (description) with text clipping */
.popup-slidein .popup-body {
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    margin: 0;

    /* Clip text to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.5em * 3);
    /* 3 lines × line-height */
}

/* Image (if present) */
.popup-slidein .popup-image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* CTA button */
.popup-slidein .popup-cta {
    display: flex;
    justify-content: center;
    margin-top: auto;
    /* Stick to bottom */
    padding-top: 16px;
}

/* Hide scrollbar for panel (optional) */
.popup-slidein::-webkit-scrollbar {
    width: 6px;
}

.popup-slidein::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.popup-slidein::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.popup-slidein::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Color variants of CTA buttons */
.popup-slidein .popup-btn-cta.btn-success {
    background: #28a745;
}

.popup-slidein .popup-btn-cta.btn-success:hover {
    background: #218838;
}

.popup-slidein .popup-btn-cta.btn-danger {
    background: #dc3545;
}

.popup-slidein .popup-btn-cta.btn-danger:hover {
    background: #c82333;
}

.popup-slidein .popup-btn-cta.btn-warning {
    background: #ffc107;
    color: #000;
}

.popup-slidein .popup-btn-cta.btn-warning:hover {
    background: #e0a800;
}

/* Content appearance animation */
@keyframes slideInContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-slidein.active .popup-content>* {
    animation: slideInContent 0.5s ease-out 0.15s backwards;
}

.popup-slidein.active .popup-content>*:nth-child(2) {
    animation-delay: 0.2s;
}

.popup-slidein.active .popup-content>*:nth-child(3) {
    animation-delay: 0.25s;
}

.popup-slidein.active .popup-content>*:nth-child(4) {
    animation-delay: 0.3s;
}


/* ====================================
   Responsiveness
   ==================================== */

@media (max-width: 768px) {
    .popup-modal {
        padding: 16px;
    }

    .popup-modal-content {
        padding: 20px;
    }

    .popup-modal .popup-title {
        font-size: 24px;
        line-height: 1.2;
    }

    .popup-modal .popup-subtitle {
        font-size: 18px;
        line-height: 1.2;
    }

    .popup-corner {
        width: calc(100% - 32px);
        left: 16px !important;
        right: 16px !important;
    }

    .popup-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .popup-banner .popup-actions {
        width: 100%;
    }

    .popup-banner .popup-btn {
        flex: 1;
    }

    .popup-fullscreen {
        padding: 24px;
    }

    .popup-fullscreen .popup-title {
        font-size: 28px;
    }

    .popup-fullscreen .popup-description {
        font-size: 16px;
    }
}

/* Mobile devices for slide-in (≤500px) */
@media (max-width: 500px) {
    .popup-slidein-container {
        width: 300px;
    }

    .popup-slidein .popup-content {
        padding: 50px 16px 16px;
        gap: 12px;
    }

    .popup-slidein .popup-close {
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
        font-size: 24px;
    }

    .popup-slidein .popup-title {
        font-size: 20px;
    }

    .popup-slidein .popup-subtitle {
        font-size: 14px;
    }

    .popup-slidein .popup-body {
        font-size: 13px;
    }

    .popup-slidein .popup-image {
        max-height: 150px;
    }

    .popup-slidein .popup-btn-cta {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* Very small screens (≤320px) */
@media (max-width: 320px) {
    .popup-slidein-container {
        width: 280px;
    }

    .popup-slidein .popup-content {
        padding: 45px 12px 12px;
    }

    .popup-slidein .popup-btn-cta {
        padding: 10px 20px;
    }
}


/* ====================================
   Utilities and additional classes
   ==================================== */

.popup-image {
    display: flex;
    justify-content: center;
    max-height: 500px;
}

.popup-image img {
    object-fit: contain;
    width: 100%;
    height: auto;
}

.popup-form-group {
    margin-bottom: 16px;
}

.popup-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
}

.popup-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.popup-input:focus {
    outline: none;
    border-color: #007bff;
}

.popup-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.popup-link {
    color: #007bff;
    text-decoration: none;
}

.popup-link:hover {
    text-decoration: underline;
}

/* Color themes */
.popup-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.popup-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.popup-danger {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
}

.popup-info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
}