/* 确保模态框在Alpine.js控制下正确显示 */
[x-cloak] { 
    display: none !important; 
}

/* 模态框遮罩层 */
.gallery-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: galleryModalFadeIn 0.3s ease-out;
    backdrop-filter: blur(1px);
}

@keyframes galleryModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 模态框主体 */
.gallery-modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    width: 65vw;
    height: 75vh;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 模态框头部 */
.gallery-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
}

.gallery-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.gallery-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
    border-radius: 50%;
}

/* 模态框主体内容 */
.gallery-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧导航栏 */
.gallery-sidebar {
    width: 130px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 16px 0;
    overflow-y: auto;
}

.gallery-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-weight: 500;
    justify-content: center;
}

.gallery-nav-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.gallery-nav-item.active {
    background-color: #f3f4f6;
    color: #1f2937;
    font-weight: 500;
}

/* 右侧内容区域 */
.gallery-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.gallery-content-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.gallery-content-panel.active {
    opacity: 1;
    visibility: visible;
}

.gallery-section {
    height: 100%;
    padding: 10px 0px;
}

/* 图库容器 */
.gallery-container {
    height: 100%;
    overflow-y: auto;
}

/* 图片网格 - 网格布局替代瀑布流 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0px 10px;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: #f3f4f6;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
}

.gallery-item:hover {
    transform: scale(0.97);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 6px;
}

/* 图片占位符 */
.image-placeholder {
    width: 100%;
    min-height: 150px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.placeholder-content {
    color: rgba(31, 41, 55, 0.4);
    font-size: 14px;
    font-weight: 500;
}

/* 加载动画 */
.image-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #e5e7eb 50%,
        transparent 100%
    );
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 图片加载错误状态 */
.image-error {
    color: #ef4444;
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

/* 加载更多区域 */
.gallery-load-more {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top: 20px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7280;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 暗色主题覆盖样式 */
[data-theme="dark"] .gallery-modal-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .gallery-modal-content {
    background: #1f2937;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-color: #374151;
}

[data-theme="dark"] .gallery-modal-header {
    background: #1f2937;
    border-bottom-color: #374151;
}

[data-theme="dark"] .gallery-modal-title {
    color: #f9fafb;
}

[data-theme="dark"] .gallery-modal-close {
    color: #9ca3af;
}

[data-theme="dark"] .gallery-modal-close:hover {
    background: #374151;
    color: #f9fafb;
}

[data-theme="dark"] .gallery-sidebar {
    background: #1f2937;
    border-right-color: #374151;
}

[data-theme="dark"] .gallery-nav-item {
    color: #9ca3af;
}

[data-theme="dark"] .gallery-nav-item:hover {
    background: #374151;
    color: #f9fafb;
}

[data-theme="dark"] .gallery-nav-item.active {
    background-color: #374151;
    color: #f9fafb;
}

[data-theme="dark"] .gallery-item {
    background: #374151;
}

[data-theme="dark"] .image-placeholder {
    background: #374151;
}

[data-theme="dark"] .placeholder-content {
    color: rgba(249, 250, 251, 0.4);
}

[data-theme="dark"] .image-placeholder::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        #4b5563 50%,
        transparent 100%
    );
}

[data-theme="dark"] .loading-indicator {
    color: #9ca3af;
}

[data-theme="dark"] .loading-spinner {
    border-color: #4b5563;
    border-top-color: #3b82f6;
} 