/* Pet Memorial Wall Plugin Styles */

/* Lightbox2 Custom Styles */
/* Hide the image number display */
.lb-number {
    display: none !important;
}

/* Move close button to outside top right corner of the image */
.lb-closeContainer {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10000 !important;
}

.lb-close {
    background: rgba(0, 0, 0, 0.8) !important;
    border-radius: 30% !important;
    width: 50px !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 28px !important;
    line-height: 1 !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    /* Ensure the close button content is centered */
    text-align: center !important;
    vertical-align: middle !important;
    /* Override any default positioning */
    position: relative !important;
}

/* Target the close button's pseudo-element (×) */
.lb-close::before,
.lb-close::after {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: block !important;
    content: '×' !important;
    font-size: 28px !important;
    line-height: 1 !important;
    color: white !important;
}

.lb-close:hover {
    background: rgba(0, 0, 0, 1) !important;
    transform: scale(1.1) !important;
    /* Keep the button perfectly circular and centered */
    border-radius: 30% !important;
}

/* Ensure hover state keeps content centered */
.lb-close:hover::before,
.lb-close:hover::after {
    transform: translate(-50%, -50%) scale(1) !important;
}

/* Remove padding adjustment since button is now outside */
.lb-dataContainer {
    padding-top: 0 !important;
}

/* Memorial card link styles */
.memorial-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.memorial-card-link:hover {
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.memorial-card-link:focus {
    outline: 2px solid #4ecdc4;
    outline-offset: 2px;
    text-decoration: none;
    color: inherit;
}

.memorial-card-link:hover .memorial-card {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.pet-memorial-wall {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.pet-memorial-wall .memorial-grid {
    column-count: 3;
    column-gap: 20px;
    column-fill: balance;
    padding: 20px 0;
    /* 覆盖Elementor的网格样式 */
    word-spacing: normal !important;
    margin-bottom: 0 !important;
}

/* 确保加载完成后的网格显示正确 */
.pet-memorial-wall .memorial-grid.grid-loaded {
    column-count: 3;
    column-gap: 20px;
    column-fill: balance;
}

/* 强制移除JavaScript添加的绝对定位 */
.pet-memorial-wall .memorial-card {
    position: static !important;
    left: auto !important;
    top: auto !important;
}

/* 强制覆盖Elementor的网格样式 */
.elementor-grid .pet-memorial-wall .memorial-grid,
.elementor-grid-0 .pet-memorial-wall .memorial-grid {
    column-count: 3;
    column-gap: 20px;
    column-fill: balance;
    width: auto !important;
    word-spacing: normal !important;
}

.elementor-grid .pet-memorial-wall .memorial-card,
.elementor-grid-0 .pet-memorial-wall .memorial-card {
    display: inline-block;
    width: 100%;
    word-break: normal !important;
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .pet-memorial-wall .memorial-grid {
        column-count: 2;
        column-gap: 15px;
    }
}

@media (max-width: 480px) {
    .pet-memorial-wall .memorial-grid {
        column-count: 1;
        column-gap: 10px;
    }
}

.pet-memorial-wall .memorial-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e0e0e0;
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
    /* 确保不被Elementor网格影响 */
    word-break: normal !important;
}

/* Removed individual card hover effect - now handled by link wrapper */

/* Card header with photo and name */
.pet-memorial-wall .memorial-card .card-header {
    display: flex !important;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.pet-memorial-wall .memorial-card .pet-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-right: 15px;
    flex-shrink: 0;
}

.memorial-card .pet-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Date range - aligned with header */
.pet-memorial-wall .memorial-card .date-range {
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 15px;
    border: 1px solid #ddd;
    font-weight: 500;
    margin-left: auto;
    align-self: center;
    white-space: nowrap;
}

/* Pet name */
.pet-memorial-wall .memorial-card .pet-name {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
    flex-grow: 1;
    align-self: center;
}

/* Memorial text - center area */
.pet-memorial-wall .memorial-card .memorial-text {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    text-align: center;
    margin: 15px 0 20px 0;
    font-style: italic;
    padding: 0 10px;
    position: relative;
    /* 限制为12行 */
    display: -webkit-box;
    -webkit-line-clamp: 12;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 计算12行的最大高度: 14px * 1.6 * 12 = 268.8px */
    max-height: 268.8px;
    /* 移除之前的flex布局和min-height */
    /* min-height: 60px; */
    /* display: flex; */
    /* align-items: center; */
    /* justify-content: center; */
}

/* 渐隐效果 - 使用伪元素实现渐变遮罩 */
.pet-memorial-wall .memorial-card .memorial-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    /* 渐变高度覆盖最后2行: 14px * 1.6 * 2 = 44.8px */
    height: 44.8px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 30%, 
        rgba(255, 255, 255, 0.7) 60%, 
        rgba(255, 255, 255, 0.95) 90%, 
        rgba(255, 255, 255, 1) 100%);
    pointer-events: none;
    /* 只在内容超过12行时显示渐变 */
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0 0 8px 8px;
}

/* 当文本内容超出时显示渐变效果 */
.pet-memorial-wall .memorial-card .memorial-text.text-overflow::after {
    opacity: 1;
}

/* Pet Story - center area */
.pet-memorial-wall .memorial-card .pet-story {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    text-align: center;
    margin: 15px 0 20px 0;
    font-style: italic;
    padding: 0 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card footer */
.pet-memorial-wall .memorial-card .card-footer {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 13px;
}

.pet-memorial-wall .memorial-card .owner-info {
    display: flex;
    align-items: center;
}

.memorial-card .owner-name {
    color: #333;
    font-weight: 600;
    flex: 1;
    margin-right: 8px;
}

.memorial-card .owner-city {
    color: #666;
    font-style: italic;
}

.pet-memorial-wall .memorial-card .publish-date {
    font-size: 0.85em;
    color: #999;
}

.pet-memorial-wall .memorial-card .no-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: #999;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Color variations for cards - removed left border */

/* Masonry/Waterfall effect using CSS Columns */
.memorial-grid {
    column-count: 3;
    column-gap: 20px;
    column-fill: balance;
}

/* Loading animation */
.pet-memorial-wall.loading {
    opacity: 0.7;
}

.pet-memorial-wall.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.pet-memorial-wall .no-memorials {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.pet-memorial-wall .no-memorials::before {
    content: '🐾';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Accessibility improvements */
.memorial-card:focus {
    outline: 2px solid #4ecdc4;
    outline-offset: 2px;
}

.memorial-card .pet-photo img {
    transition: transform 0.3s ease;
}

.memorial-card:hover .pet-photo img {
    transform: scale(1.1);
}

/* Load More Button Styles */
.load-more-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.load-more-btn,
.wdt-button {
    background: #745ab1;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 36px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: #f8e170;
    color: white;
}

.load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-btn.loading {
    position: relative;
    color: transparent;
}

.load-more-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    .pet-memorial-wall .memorial-grid,
    .pet-memorial-wall .memorial-grid.grid-loaded,
    .memorial-grid {
        column-count: 1 !important;
        column-gap: 0;
    }
    
    .pet-memorial-wall {
        padding: 15px;
    }
    
    .memorial-card {
        margin-bottom: 20px;
        width: 100%;
    }
    
    /* Mobile layout adjustments for card header */
    .pet-memorial-wall .memorial-card .card-header {
        display: grid !important;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        column-gap: 15px;
        row-gap: 8px;
        align-items: start;
    }
    
    .pet-memorial-wall .memorial-card .card-header .pet-photo,
    .pet-memorial-wall .memorial-card .card-header .no-photo {
        grid-column: 1;
        grid-row: 1 / span 2;
        margin-right: 0;
        margin-bottom: 0;
    }
    
    .pet-memorial-wall .memorial-card .card-header .pet-name {
        grid-column: 2;
        grid-row: 1;
        margin-bottom: 0;
        font-size: 20px;
        line-height: 1.2;
        align-self: start;
    }
    
    .pet-memorial-wall .memorial-card .date-range {
        grid-column: 2;
        grid-row: 2;
        margin-left: 0;
        margin-top: 0;
        font-size: 11px;
        padding: 4px 8px;
        line-height: 1.2;
        align-self: start;
        justify-self: start;
        width: fit-content;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .pet-memorial-wall .memorial-grid,
    .pet-memorial-wall .memorial-grid.grid-loaded,
    .memorial-grid {
        column-count: 2 !important;
        column-gap: 15px;
    }
}

/* Print styles */
@media print {
    .memorial-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .memorial-grid {
        column-count: 2;
        column-gap: 15px;
    }
    
    .load-more-container {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .memorial-card {
        border: 2px solid #000;
    }
    
    .memorial-card .date-range {
        background: #fff;
        border: 1px solid #000;
    }
}

/* Tab styles for memorial content */
.memorial-tabs {
    margin-bottom: 30px;
}

.tab-headers {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
    gap: 0;
}

.tab-header {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.tab-header:hover {
    color: #333;
    background: rgba(116, 90, 177, 0.05);
}

.tab-header.active {
    color: #745ab1;
    border-bottom-color: #745ab1;
    font-weight: 600;
}

.tab-contents {
    position: relative;
    min-height: 200px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

.tab-content p {
    font-size: 1.1em;
    line-height: 1.7;
    color: #444;
    margin: 0;
    padding: 20px 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive for tabs */
@media (max-width: 768px) {
    .tab-headers {
        flex-direction: column;
        gap: 0;
    }
    
    .tab-header {
        padding: 12px 20px;
        font-size: 1em;
        border-bottom: 1px solid #f0f0f0;
        border-right: none;
    }
    
    .tab-header.active {
        border-bottom-color: #745ab1;
        background: rgba(116, 90, 177, 0.05);
    }
    
    .tab-content p {
        font-size: 1em;
        padding: 15px 0;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .memorial-card {
        transition: none;
    }
    
    .memorial-card .pet-photo img {
        transition: none;
    }
    
    .pet-memorial-wall.loading::after {
        animation: none;
    }
}