/* Expandable Content Shortcode Styles */
.expandable-content-container {
    font-family: 'Inter', sans-serif;
    max-width: 800px;
    margin: 20px auto;
    position: relative;
}

.expandable-content-container .expandable-content-text {
    position: relative;
}

/* Main content text */
.expandable-content-text {
    line-height: 1.6;
    font-size: 16px;
    color: #333;
    position: relative;
    overflow: hidden;
}

/* Initial state - prevent flash of full content */
.expandable-content-container:not(.initialized) .expandable-content-text {
    max-height: calc(1.6em * 3); /* Default to 3 rows */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dynamic initial states for different row values */
.expandable-content-container[data-rows="1"]:not(.initialized) .expandable-content-text {
    max-height: calc(1.6em * 1);
    -webkit-line-clamp: 1;
}

.expandable-content-container[data-rows="2"]:not(.initialized) .expandable-content-text {
    max-height: calc(1.6em * 2);
    -webkit-line-clamp: 2;
}

.expandable-content-container[data-rows="4"]:not(.initialized) .expandable-content-text {
    max-height: calc(1.6em * 4);
    -webkit-line-clamp: 4;
}

.expandable-content-container[data-rows="5"]:not(.initialized) .expandable-content-text {
    max-height: calc(1.6em * 5);
    -webkit-line-clamp: 5;
}

.expandable-content-container[data-rows="6"]:not(.initialized) .expandable-content-text {
    max-height: calc(1.6em * 6);
    -webkit-line-clamp: 6;
}

/* Row limiting - will be set by JavaScript */
.expandable-content-container.row-limited .expandable-content-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

/* Add ellipsis for truncated content */
.expandable-content-container.row-limited .expandable-content-text::after {
    content: "...";
    position: absolute;
    bottom: 0;
    right: 0;
    background: white;
    padding-left: 20px;
    background: linear-gradient(to right, transparent, white 50%);
    color: #666;
    font-weight: 500;
}

/* Fade overlay - positioned relative to the text content */
.expandable-content-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.95));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.expandable-content-container.no-overflow .expandable-content-overlay {
    display: none;
}

.expandable-content-container.expanded .expandable-content-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Hide ellipsis when expanded */
.expandable-content-container.expanded .expandable-content-text::after {
    display: none;
}

/* Desktop accordion behavior */
@media (min-width: 769px) {
    .expandable-content-container.expanded .expandable-content-text {
        max-height: none !important;
        -webkit-line-clamp: unset !important;
        -webkit-box-orient: unset !important;
        display: block !important;
        overflow: visible !important;
    }
}

/* Toggle button */
.expandable-content-toggle {
    background: #ff8800;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    margin-top: 15px;
    display: inline-block;
    position: relative;
    z-index: 2;
}

.expandable-content-toggle:hover {
    background: #e67e00;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 136, 0, 0.3);
}

.expandable-content-toggle:active {
    transform: translateY(0);
}

/* Modal styles - exactly matching class modal pattern */
.expandable-content-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
}

.expandable-content-modal-content {
    background: white;
    padding: 0;
    border-radius: 15px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInModal 0.3s ease;
}

.expandable-content-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 10001;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.expandable-content-modal-close:hover {
    background-color: #ff8800;
    color: white;
}

.expandable-content-modal-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.expandable-content-modal-title {
    margin: 0 0 15px 0;
    padding-right: 50px;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.expandable-content-modal-body {
    padding: 20px;
    line-height: 1.7;
    font-size: 16px;
    color: #333;
}

.expandable-content-modal-body p {
    margin-bottom: 15px;
}

.expandable-content-modal-body p:last-child {
    margin-bottom: 0;
}

.expandable-content-modal-body h1,
.expandable-content-modal-body h2,
.expandable-content-modal-body h3,
.expandable-content-modal-body h4,
.expandable-content-modal-body h5,
.expandable-content-modal-body h6 {
    color: #333;
    margin-top: 25px;
    margin-bottom: 15px;
}

.expandable-content-modal-body ul,
.expandable-content-modal-body ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

/* Mobile responsive modal */
@media (max-width: 768px) {
    .expandable-content-modal-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .expandable-content-modal-header {
        padding: 15px;
    }
    
    .expandable-content-modal-title {
        font-size: 20px;
        padding-right: 45px;
        margin-bottom: 12px;
    }
    
    .expandable-content-modal-body {
        padding: 15px;
    }
    
    .expandable-content-modal-close {
        top: 10px;
        right: 15px;
        font-size: 24px;
        width: 32px;
        height: 32px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInModal {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Content styling for better readability */
.expandable-content-text p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.expandable-content-text p:last-child {
    margin-bottom: 0;
}

.expandable-content-text h1,
.expandable-content-text h2,
.expandable-content-text h3,
.expandable-content-text h4,
.expandable-content-text h5,
.expandable-content-text h6 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.expandable-content-text ul,
.expandable-content-text ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.expandable-content-text li {
    margin-bottom: 5px;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .expandable-content-full,
    .expandable-content-toggle,
    .expandable-content-modal,
    .expandable-content-modal-content {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .expandable-content-toggle {
        border: 2px solid #ff8800;
    }
    
    .expandable-content-overlay {
        background: linear-gradient(transparent, rgba(255, 255, 255, 1));
    }
}