/**
 * Beat License Preview Modals - Styles
 * Prefix: blp- (Beat License Preview)
 * Dark theme with brand blue accents
 * 
 * Based on Oz Reez License Modal styles, cleaned and namespaced
 */

/* ==========================================================================
   CSS Reset for Plugin Elements (Prevent Elementor/Theme Bleed)
   ========================================================================== */

.blp-license-wrapper,
.blp-license-wrapper *,
.blp-modal-overlay,
.blp-modal-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Trigger Button
   ========================================================================== */

.blp-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background-color: transparent;
    color: #3176CE;
    border: 1px solid #3176CE;
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.4;
}

.blp-trigger-btn:hover {
    background-color: rgba(49, 118, 206, 0.1);
    color: #3176CE;
    text-decoration: none;
}

.blp-trigger-btn:focus {
    outline: 2px solid #3176CE;
    outline-offset: 2px;
}

.blp-trigger-btn:active {
    transform: translateY(1px);
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */

.blp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.blp-modal-overlay.blp-active {
    display: flex;
    opacity: 1;
}

/* ==========================================================================
   Modal Container
   ========================================================================== */

.blp-modal-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background-color: #111;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.blp-modal-overlay.blp-active .blp-modal-container {
    transform: translateY(0);
}

/* ==========================================================================
   Modal Header
   ========================================================================== */

.blp-modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.blp-modal-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 22px;
    font-weight: 625;
    color: #D8D8D8;
    margin: 0;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Close Button
   ========================================================================== */

.blp-modal-close {
    background: transparent !important;
    border: none !important;
    color: #d8d8d8 !important;
    font-size: 28px !important;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 8px;
}

.blp-modal-close:focus,
.blp-modal-close:active,
.blp-modal-close:focus-visible,
.blp-modal-close:focus-within {
    background: transparent !important;
    border: none !important;
    color: #d8d8d8 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Modal Body
   ========================================================================== */

.blp-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    position: relative;
    min-height: 200px;
    max-height: calc(90vh - 100px);
}

/* ==========================================================================
   License Content Typography
   ========================================================================== */

.blp-license-content {
    color: rgba(255, 255, 255, 0.9);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;
}

.blp-license-content h1,
.blp-license-content h2,
.blp-license-content h3,
.blp-license-content h4,
.blp-license-content h5,
.blp-license-content h6 {
    color: #D8D8D8;
    margin: 0 0 16px 0;
    font-weight: 600;
    line-height: 1.3;
}

.blp-license-content h1 { font-size: 24px; }
.blp-license-content h2 { font-size: 20px; }
.blp-license-content h3 { font-size: 18px; }
.blp-license-content h4 { font-size: 16px; }

.blp-license-content p {
    margin: 0 0 16px 0;
    color: rgba(255, 255, 255, 0.85);
}

.blp-license-content p:last-child {
    margin-bottom: 0;
}

.blp-license-content ul,
.blp-license-content ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
    color: rgba(255, 255, 255, 0.85);
}

.blp-license-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.blp-license-content li:last-child {
    margin-bottom: 0;
}

.blp-license-content strong,
.blp-license-content b {
    color: #D8D8D8;
    font-weight: 600;
}

.blp-license-content em,
.blp-license-content i {
    font-style: italic;
}

.blp-license-content a {
    color: #3176CE;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.blp-license-content a:hover {
    color: #4a9eff;
}

/* Section Dividers */
.blp-license-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 24px 0;
}

/* Highlight Box for Important Terms */
.blp-license-content .blp-highlight {
    background-color: rgba(49, 118, 206, 0.1);
    border-left: 3px solid #3176CE;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 4px 4px 0;
}

/* Warning Box */
.blp-license-content .blp-warning {
    background-color: rgba(220, 38, 38, 0.1);
    border-left: 3px solid #dc2626;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 4px 4px 0;
    color: #fca5a5;
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */

.blp-modal-body::-webkit-scrollbar {
    width: 8px;
}

.blp-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.blp-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.blp-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Mobile Responsive - Slide Up from Bottom
   ========================================================================== */

@media (max-width: 768px) {
    .blp-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .blp-modal-container {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    
    .blp-modal-overlay.blp-active .blp-modal-container {
        transform: translateY(0);
    }
    
    .blp-modal-header {
        padding: 20px;
    }
    
    .blp-modal-title {
        font-size: 18px;
    }
    
    .blp-modal-body {
        padding: 20px;
        max-height: calc(85vh - 80px);
    }
    
    .blp-license-content {
        font-size: 13px;
    }
    
    .blp-license-content h1 { font-size: 20px; }
    .blp-license-content h2 { font-size: 18px; }
    .blp-license-content h3 { font-size: 16px; }
    .blp-license-content h4 { font-size: 15px; }
    
    .blp-trigger-btn {
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Body Scroll Lock (Applied via JS)
   ========================================================================== */

body.blp-modal-open {
    overflow: hidden !important;
}

/* ==========================================================================
   Accessibility - Focus States
   ========================================================================== */

.blp-modal-overlay:focus {
    outline: none;
}

.blp-modal-container:focus {
    outline: none;
}

/* Focus trap indicator */
.blp-modal-container:focus-within {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(49, 118, 206, 0.3);
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.blp-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    padding: 40px;
}

.blp-spinner {
    width: 35px;
    height: 35px;
    border: 7px solid rgba(255, 255, 255, 0.1);
    border-top-color: #d8d8d8;
    border-radius: 50%;
    animation: blp-spin 0.8s linear infinite;
}

@keyframes blp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Error State
   ========================================================================== */

.blp-error {
    color: #fca5a5;
    background-color: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    padding: 16px;
    border-radius: 4px;
    text-align: center;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .blp-modal-overlay {
        display: none !important;
    }
    
    .blp-trigger-btn,
    .open-license-modal {
        display: none !important;
    }
}
