/* DH Popup Frontend Styles */

.dhpopup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dhpopup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.dhpopup-container {
    position: fixed;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dhpopup-container.active {
    opacity: 1;
    visibility: visible;
}

/* Popup Box */
.dhpopup-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.dhpopup-container.active .dhpopup-box {
    transform: scale(1);
}

/* Popup Header - Seamless with container */
.dhpopup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
}

.dhpopup-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #24292f;
    line-height: 1.4;
}

.dhpopup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #57606a;
    transition: all 0.2s ease;
    padding: 0;
}

.dhpopup-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #24292f;
}

.dhpopup-close svg {
    width: 16px;
    height: 16px;
}

/* Dark Theme - Header */
.dhpopup-theme-dark .dhpopup-header {
    background: #161b22;
    border-bottom-color: #30363d;
}

.dhpopup-theme-dark .dhpopup-title {
    color: #c9d1d9;
}

.dhpopup-theme-dark .dhpopup-close {
    background: rgba(255, 255, 255, 0.1);
    color: #8b949e;
}

.dhpopup-theme-dark .dhpopup-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Popup Body */
.dhpopup-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Popup Body - No Scroll */
.dhpopup-body:not(.dhpopup-scroll) {
    overflow-y: visible;
    flex: none;
}

/* Custom Scrollbar - Light Theme (default) */
.dhpopup-theme-light .dhpopup-body::-webkit-scrollbar,
.dhpopup-body::-webkit-scrollbar {
    width: 8px;
}

.dhpopup-theme-light .dhpopup-body::-webkit-scrollbar-track,
.dhpopup-body::-webkit-scrollbar-track {
    background: #f6f8fa;
    border-radius: 4px;
}

.dhpopup-theme-light .dhpopup-body::-webkit-scrollbar-thumb,
.dhpopup-body::-webkit-scrollbar-thumb {
    background: #d0d7de;
    border-radius: 4px;
}

.dhpopup-theme-light .dhpopup-body::-webkit-scrollbar-thumb:hover,
.dhpopup-body::-webkit-scrollbar-thumb:hover {
    background: #afb8c1;
}

/* Custom Scrollbar - Dark Theme */
.dhpopup-theme-dark .dhpopup-body::-webkit-scrollbar {
    width: 8px;
}

.dhpopup-theme-dark .dhpopup-body::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 4px;
}

.dhpopup-theme-dark .dhpopup-body::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

.dhpopup-theme-dark .dhpopup-body::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Firefox Scrollbar - Light Theme */
.dhpopup-theme-light .dhpopup-body,
.dhpopup-body {
    scrollbar-width: thin;
    scrollbar-color: #d0d7de #f6f8fa;
}

/* Firefox Scrollbar - Dark Theme */
.dhpopup-theme-dark .dhpopup-body {
    scrollbar-width: thin;
    scrollbar-color: #30363d #161b22;
}

/* Default text color for all elements in popup body - inherits from theme */
.dhpopup-body {
    color: #24292f;
}

.dhpopup-body p {
    margin: 0 0 12px 0;
    font-size: 15px;
    line-height: 1.6;
    color: inherit;
}

.dhpopup-body p:last-child {
    margin-bottom: 0;
}

.dhpopup-body h1,
.dhpopup-body h2,
.dhpopup-body h3,
.dhpopup-body h4,
.dhpopup-body h5,
.dhpopup-body h6 {
    margin: 0 0 12px 0;
    color: inherit;
}

.dhpopup-body a {
    text-decoration: none;
}

.dhpopup-body a:hover {
    text-decoration: underline;
}

.dhpopup-body ul,
.dhpopup-body ol {
    margin: 0 0 12px 0;
    padding-left: 24px;
    color: inherit;
}

.dhpopup-body li {
    margin-bottom: 4px;
    color: inherit;
}

.dhpopup-body span,
.dhpopup-body div,
.dhpopup-body strong,
.dhpopup-body em,
.dhpopup-body b,
.dhpopup-body i,
.dhpopup-body u,
.dhpopup-body strike,
.dhpopup-body blockquote {
    color: inherit;
}

.dhpopup-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* WordPress Image Alignment Classes */
.dhpopup-body img.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.dhpopup-body img.alignleft {
    float: left;
    margin: 0 15px 10px 0;
}

.dhpopup-body img.alignright {
    float: right;
    margin: 0 0 10px 15px;
}

.dhpopup-body img.alignnone {
    margin: 0 0 10px 0;
}

.dhpopup-body .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.dhpopup-body .alignleft {
    float: left;
    margin: 0 15px 10px 0;
}

.dhpopup-body .alignright {
    float: right;
    margin: 0 0 10px 15px;
}

.dhpopup-body .alignnone {
    margin: 0 0 10px 0;
}

.dhpopup-body .wp-caption {
    max-width: 100%;
}

.dhpopup-body .wp-caption-text {
    font-size: 13px;
    color: inherit;
    opacity: 0.7;
    text-align: center;
    margin-top: 8px;
}

/* Clearfix for floated content */
.dhpopup-body::after {
    content: '';
    display: table;
    clear: both;
}

/* Popup Footer */
.dhpopup-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #f6f8fa;
    border-top: 1px solid #d0d7de;
}

.dhpopup-footer-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    width: 100%;
}

.dhpopup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

/* Dark Button Style */
.dhpopup-btn-dark {
    background: #24292f;
    color: #ffffff;
    border-color: rgba(31, 35, 40, 0.15);
}

.dhpopup-btn-dark:hover {
    background: #57606a;
}

/* Light Button Style */
.dhpopup-btn-light {
    background: #f6f8fa;
    color: #24292f;
    border-color: #d0d7de;
}

.dhpopup-btn-light:hover {
    background: #f3f4f6;
}

.dhpopup-btn-secondary {
    background: #f6f8fa;
    color: #24292f;
    border-color: #d0d7de;
}

.dhpopup-btn-secondary:hover {
    background: #f3f4f6;
}

/* ==================== */
/* DARK THEME STYLES    */
/* ==================== */

/* Dark Theme - Box */
.dhpopup-theme-dark .dhpopup-box {
    background: #0d1117;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Dark Theme - Body */
.dhpopup-theme-dark .dhpopup-body {
    color: #c9d1d9;
}

.dhpopup-theme-dark .dhpopup-body a {
    color: #58a6ff;
}

/* Ensure all child elements inherit color in dark theme */
.dhpopup-theme-dark .dhpopup-body p,
.dhpopup-theme-dark .dhpopup-body h1,
.dhpopup-theme-dark .dhpopup-body h2,
.dhpopup-theme-dark .dhpopup-body h3,
.dhpopup-theme-dark .dhpopup-body h4,
.dhpopup-theme-dark .dhpopup-body h5,
.dhpopup-theme-dark .dhpopup-body h6,
.dhpopup-theme-dark .dhpopup-body ul,
.dhpopup-theme-dark .dhpopup-body ol,
.dhpopup-theme-dark .dhpopup-body li,
.dhpopup-theme-dark .dhpopup-body span,
.dhpopup-theme-dark .dhpopup-body div,
.dhpopup-theme-dark .dhpopup-body strong,
.dhpopup-theme-dark .dhpopup-body em,
.dhpopup-theme-dark .dhpopup-body b,
.dhpopup-theme-dark .dhpopup-body i,
.dhpopup-theme-dark .dhpopup-body u,
.dhpopup-theme-dark .dhpopup-body strike,
.dhpopup-theme-dark .dhpopup-body blockquote {
    color: inherit;
}

/* Dark Theme - Footer */
.dhpopup-theme-dark .dhpopup-footer {
    background: #161b22;
    border-top-color: #30363d;
}

.dhpopup-theme-dark .dhpopup-btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border-color: #30363d;
}

.dhpopup-theme-dark .dhpopup-btn-secondary:hover {
    background: #30363d;
}

/* Dark Theme - Dark Button */
.dhpopup-theme-dark .dhpopup-btn-dark {
    background: #21262d;
    color: #c9d1d9;
    border-color: #30363d;
}

.dhpopup-theme-dark .dhpopup-btn-dark:hover {
    background: #30363d;
}

/* Dark Theme - Light Button */
.dhpopup-theme-dark .dhpopup-btn-light {
    background: #f6f8fa;
    color: #24292f;
    border-color: #d0d7de;
}

.dhpopup-theme-dark .dhpopup-btn-light:hover {
    background: #e1e4e8;
}

/* Position Variants */
.dhpopup-container[data-position="center"] {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
}

.dhpopup-container[data-position="center"].active {
    transform: translate(-50%, -50%) scale(1);
}

.dhpopup-container[data-position="top"] {
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
}

.dhpopup-container[data-position="top"].active {
    transform: translateX(-50%) translateY(0);
}

.dhpopup-container[data-position="bottom"] {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
}

.dhpopup-container[data-position="bottom"].active {
    transform: translateX(-50%) translateY(0);
}

.dhpopup-container[data-position="top-left"] {
    top: 20px;
    left: 20px;
    transform: translateY(-20px);
}

.dhpopup-container[data-position="top-left"].active {
    transform: translateY(0);
}

.dhpopup-container[data-position="top-right"] {
    top: 20px;
    right: 20px;
    transform: translateY(-20px);
}

.dhpopup-container[data-position="top-right"].active {
    transform: translateY(0);
}

.dhpopup-container[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
    transform: translateY(20px);
}

.dhpopup-container[data-position="bottom-left"].active {
    transform: translateY(0);
}

.dhpopup-container[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
    transform: translateY(20px);
}

.dhpopup-container[data-position="bottom-right"].active {
    transform: translateY(0);
}

/* Animation - Fade In Up */
@keyframes dhpopup-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dhpopup-container.fade-up .dhpopup-box {
    animation: dhpopup-fade-in-up 0.4s ease forwards;
}

/* Animation - Zoom In */
@keyframes dhpopup-zoom-in {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dhpopup-container.zoom .dhpopup-box {
    animation: dhpopup-zoom-in 0.3s ease forwards;
}

/* Responsive */
@media (max-width: 640px) {
    .dhpopup-box {
        max-width: calc(100vw - 40px);
        margin: 0 20px;
    }
    
    .dhpopup-container[data-position="top-right"],
    .dhpopup-container[data-position="bottom-right"] {
        right: 10px;
    }
    
    .dhpopup-container[data-position="top-left"],
    .dhpopup-container[data-position="bottom-left"] {
        left: 10px;
    }
    
    .dhpopup-container[data-position="top-right"] .dhpopup-box,
    .dhpopup-container[data-position="bottom-right"] .dhpopup-box,
    .dhpopup-container[data-position="top-left"] .dhpopup-box,
    .dhpopup-container[data-position="bottom-left"] .dhpopup-box {
        max-width: calc(100vw - 40px);
    }
}