/**
 * Public styles for DCOM Dynamic Disclosure
 */

/* Base Modal Styles */
.dcom-dd-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    font-family: Tahoma, Geneva, sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.dcom-dd-modal * {
    box-sizing: border-box;
}

.dcom-dd-modal-content {
    padding: 5px;
    border-radius: 5px;
    max-width: 100%;
}

.dcom-dd-modal-header {
    margin-bottom: 10px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dcom-dd-modal-header h3 {
    margin: 0;
    padding: 0;
    font-size: 18px;
    font-weight: bold;
}

.dcom-dd-close {
    position: absolute;
    right: 3px;
    top: -3px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0px;
    margin: 0;
    color: #000000 !important;
    transition: all 0.2s ease;
    width: auto;
    height: auto;
    display: inline-block;
}

.dcom-dd-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.dcom-dd-modal-body {
    margin-bottom: 15px;
}

.dcom-dd-modal-description {
    margin-bottom: 10px;
}

.dcom-dd-modal-description p {
    margin: 0 0 10px;
    padding: 5px 20px;
}

.dcom-dd-modal-description a {
    color: inherit;
    text-decoration: underline;
}

.dcom-dd-modal-description ul, 
.dcom-dd-modal-description ol {
    margin: 0 0 10px 20px;
    padding: 0;
}

.dcom-dd-modal-description strong, 
.dcom-dd-modal-description b {
    font-weight: bold;
}

.dcom-dd-modal-description em, 
.dcom-dd-modal-description i {
    font-style: italic;
}

.dcom-dd-modal-footer {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 15px;
    gap: 10px;
}

/* Button Styles */
.dcom-dd-button {
    display: inline-block;
    padding: 8px 16px;
    margin-right: 0;
    margin-bottom: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s ease;
    /* Force text wrapping for long button text */
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.2;
    min-height: 2.5em;
    /* Allow buttons to grow proportionally */
    max-width: none;
    flex: 1 1 auto;
}

.dcom-dd-button:hover {
    opacity: 0.9;
}

.dcom-dd-more-info {
    display: inline-block;
    margin-left: 0;
    text-decoration: underline;
    cursor: pointer;
    /* Apply same text wrapping as buttons */
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.2;
    /* Allow link to grow proportionally */
    max-width: none;
    flex: 1 1 auto;
    text-align: center;
}

/* FORCE text wrapping in footer elements - override any other styles */
.dcom-dd-modal-footer .dcom-dd-button,
.dcom-dd-modal-footer .dcom-dd-more-info,
.dcom-dd-modal-footer a {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    /* Remove max-width restriction and let buttons grow proportionally */
    max-width: none !important;
    flex: 1 1 auto !important;
    text-align: center !important;
    line-height: 1.2 !important;
    min-height: 2.5em !important;
    /* Ensure buttons fill available space */
    min-width: 0 !important;
}

/* Position Variants */
.dcom-dd-position-bottom {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
}

.dcom-dd-position-top {
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
}

.dcom-dd-position-top-left {
    left: 5px;
    top: 5px;
    max-width: 300px;
}

.dcom-dd-position-top-right {
    right: 5px;
    top: 5px;
    max-width: 300px;
}

.dcom-dd-position-bottom-left {
    left: 5px;
    bottom: 5px;
    max-width: 300px;
}

.dcom-dd-position-bottom-right {
    right: 5px;
    bottom: 5px;
    max-width: 300px;
}

/* Layout Variants */
.dcom-dd-layout-block .dcom-dd-modal-content {
    border-radius: 0;
}

.dcom-dd-layout-floating {
    width: 400px; /* Default width, will be overridden by inline style if set */
    max-width: 90%;
    /* Ensure that inline width has priority */
}

.dcom-dd-layout-floating .dcom-dd-modal-content {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dcom-dd-layout-popup {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.dcom-dd-layout-popup .dcom-dd-modal-content {
    position: relative;
    margin: auto;
    max-width: 500px;
    width: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Theme Variants */
.dcom-dd-theme-light {
    background-color: #ffffff;
    color: #333333;
}

.dcom-dd-theme-light .dcom-dd-modal-content {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #e5e5e5;
}

.dcom-dd-theme-light .dcom-dd-button {
    background-color: #0073aa;
    color: #ffffff;
}

.dcom-dd-theme-light .dcom-dd-more-info {
    color: #0073aa;
}

.dcom-dd-theme-dark {
    background-color: #333333;
    color: #ffffff;
}

.dcom-dd-theme-dark .dcom-dd-modal-content {
    background-color: #333333;
    color: #ffffff;
    border: 1px solid #555555;
}

.dcom-dd-theme-dark .dcom-dd-button {
    background-color: #00a0d2;
    color: #ffffff;
}

.dcom-dd-theme-dark .dcom-dd-more-info {
    color: #00a0d2;
}

/* Animations */
@keyframes dcom-dd-slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes dcom-dd-slide-down {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes dcom-dd-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile Responsive Styles for Floating Layout */
@media screen and (max-width: 768px) {
    /* FORCE floating layout to full width on mobile - override inline styles */
    #dcom-dd-modal.dcom-dd-modal.dcom-dd-layout-floating,
    .dcom-dd-modal.dcom-dd-layout-floating {
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
        min-width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
        margin: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* FORCE all floating positioned modals to take full width */
    #dcom-dd-modal.dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-top-left,
    #dcom-dd-modal.dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-top-right,
    #dcom-dd-modal.dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-bottom-left,
    #dcom-dd-modal.dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-bottom-right,
    .dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-top-left,
    .dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-top-right,
    .dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-bottom-left,
    .dcom-dd-modal.dcom-dd-layout-floating.dcom-dd-position-bottom-right {
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
        min-width: calc(100% - 20px) !important;
        left: 10px !important;
        right: auto !important;
        margin: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Override any inline styles that may be applied */
    [style*="width"].dcom-dd-layout-floating {
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
    }
    
    /* Override footer layout for mobile - side by side */
    .dcom-dd-modal.dcom-dd-layout-floating .dcom-dd-modal-footer {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    /* Force buttons to be side by side with equal width */
    .dcom-dd-modal.dcom-dd-layout-floating .dcom-dd-modal-footer .dcom-dd-button,
    .dcom-dd-modal.dcom-dd-layout-floating .dcom-dd-modal-footer a {
        flex: 1 1 auto !important;
        margin: 0 !important;
        min-width: 0 !important;
        width: auto !important;
        /* Ensure text wrapping works on mobile */
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        line-height: 1.2 !important;
        min-height: 2.5em !important;
    }
}

/* Extra Small Mobile: Stack buttons vertically on very small screens */
@media screen and (max-width: 460px) {
    /* Stack buttons vertically for better usability on very small screens */
    .dcom-dd-modal.dcom-dd-layout-floating .dcom-dd-modal-footer {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    
    /* Make buttons full width when stacked */
    .dcom-dd-modal.dcom-dd-layout-floating .dcom-dd-modal-footer .dcom-dd-button,
    .dcom-dd-modal.dcom-dd-layout-floating .dcom-dd-modal-footer a {
        flex: none !important;
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        text-align: center !important;
        /* Ensure text wrapping works on very small screens */
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        line-height: 1.2 !important;
        min-height: 2.5em !important;
    }
}

.dcom-dd-position-bottom {
    animation: dcom-dd-slide-up 0.5s ease-out;
}

.dcom-dd-position-top {
    animation: dcom-dd-slide-down 0.5s ease-out;
}

.dcom-dd-position-top-left,
.dcom-dd-position-top-right,
.dcom-dd-position-bottom-left,
.dcom-dd-position-bottom-right,
.dcom-dd-layout-popup {
    animation: dcom-dd-fade-in 0.5s ease-out;
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .dcom-dd-position-top-left,
    .dcom-dd-position-top-right,
    .dcom-dd-position-bottom-left,
    .dcom-dd-position-bottom-right {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
    
    .dcom-dd-modal-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dcom-dd-button {
        width: 100%;
        margin-right: 0;
    }
    
    .dcom-dd-more-info {
        margin-left: 0;
        margin-top: 10px;
    }
}
