/* JULY.ART 自定义样式 - Bootstrap 5 版本 */

/* ========== 全局样式 ========== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;

    /* 自定义颜色 */
    --gradient-start: #f8fafc;
    --gradient-end: #e0e7ef;
    --dark-gradient-start: #181f2a;
    --dark-gradient-end: #232946;
}

/* ========== 渐变背景 ========== */
.gradient-bg {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
}

.mobile-gradient-bg {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
}

/* ========== 侧边栏样式 ========== */
.sidebar {
    width: 280px;
    min-width: 280px;
    min-height: 100vh;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 1.75rem 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

/* 侧边栏头部 */
.sidebar-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f3f5;
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    transition: all 0.3s ease;
}

.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background-color: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.3);
}

.sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 0.5rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: #dee2e6;
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background-color: #adb5bd;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: 0.625rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    margin-bottom: 0.375rem;
    white-space: nowrap;
    position: relative;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(13, 110, 253, 0.08);
    color: var(--bs-primary);
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    background-color: rgba(13, 110, 253, 0.12);
    color: var(--bs-primary);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background-color: var(--bs-primary);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-section-title {
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0.75rem 1rem 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sidebar-nav .nav-link-text {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* 侧边栏收起状态 */
.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    padding: 1.75rem 0.75rem;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding-bottom: 1rem;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-link-text,
.sidebar.collapsed .nav-section-title {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-toggle-btn {
    margin: 0 auto;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
    gap: 0;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
}

.sidebar.collapsed .badge {
    display: none;
}

.sidebar.collapsed .sidebar-nav .nav-link.active::before {
    width: 4px;
    height: 80%;
    left: 0;
    border-radius: 0 3px 3px 0;
}

.sidebar.collapsed .collapse {
    display: none !important;
}

/* 侧边栏底部区域样式 */
.sidebar-footer {
    transition: all 0.3s ease;
}

.sidebar-footer-btn {
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-footer-icon {
    display: none;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-footer-icon {
    display: inline-block;
}

.sidebar-footer-text {
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar-footer-links {
    transition: all 0.3s ease;
}

.sidebar-footer-content {
    transition: all 0.3s ease;
}

/* 收起状态下的底部区域 */
.sidebar.collapsed .sidebar-footer-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 0.625rem;
    margin-left: auto;
    margin-right: auto;
}

.sidebar.collapsed .sidebar-footer-text,
.sidebar.collapsed .sidebar-footer-content,
.sidebar.collapsed .sidebar-footer-links > div:not(.dropdown) {
    opacity: 0;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.sidebar.collapsed .sidebar-footer-links {
    padding-top: 0.75rem;
    border-top: 1px solid #f1f3f5;
}


.sidebar.collapsed .sidebar-footer-btn .dropdown-toggle::after {
    display: none;
}

.sidebar.collapsed .sidebar-footer .dropdown-menu {
    position: fixed !important;
    left: 90px !important;
    margin-top: 0;
}

/* ========== 主内容区域适配侧边栏 ========== */
.main-content-wrapper {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 当侧边栏收起时，主内容区域可以稍微扩展 */
.sidebar.collapsed ~ .main-content-wrapper {
    /* 可以添加额外的样式优化 */
}

/* ========== 卡片样式 ========== */
.app-card {
    transition: all 0.2s ease;
    cursor: pointer;
    height: 100%;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.app-card-img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    width: 100%;
}

.app-card-placeholder {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    font-size: 2rem;
}

/* ========== 瀑布流布局样式 ========== */
.apps-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.app-card-item {
    break-inside: avoid;
    page-break-inside: avoid;
    width: 100%;
}

.app-card-item .app-card-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

/* 响应式调整 */
@media (min-width: 576px) {
    .apps-masonry {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (min-width: 768px) {
    .apps-masonry {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (min-width: 992px) {
    .apps-masonry {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 1200px) {
    .apps-masonry {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (min-width: 1400px) {
    .apps-masonry {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ========== 上传区域样式 ========== */
.upload-area {
    border: 2px dashed #e5e7eb;
    border-radius: 1rem;
    padding: 3rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: #ffffff;
}

.upload-area:hover {
    border-color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.05);
}

.upload-area.dragover {
    border-color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: var(--bs-secondary);
    margin-bottom: 1rem;
}

/* ========== 轮播样式 ========== */
.featured-carousel {
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 2rem;
}

.featured-carousel .carousel-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

@media (max-width: 768px) {
    .featured-carousel .carousel-item img {
        height: 250px;
    }
}

/* ========== 分类筛选标签 ========== */
.category-filter {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.category-filter::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.category-filter .btn {
    white-space: nowrap;
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========== 热门模型横向滚动 ========== */
.popular-models {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--bs-secondary) transparent;
}

.popular-models::-webkit-scrollbar {
    height: 6px;
}

.popular-models::-webkit-scrollbar-track {
    background: transparent;
}

.popular-models::-webkit-scrollbar-thumb {
    background-color: var(--bs-secondary);
    border-radius: 3px;
}

.model-card {
    min-width: 200px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .model-card {
        min-width: 150px;
    }
}

/* ========== 移动端样式 ========== */
@media (max-width: 767.98px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    /* 移动端卡片间距 */
    .app-card {
        margin-bottom: 1rem;
    }

    /* 移动端按钮全宽 */
    .btn-mobile-full {
        width: 100%;
    }
}

/* ========== 安全区域适配（iOS） ========== */
.safe-area-top {
    padding-top: max(1rem, env(safe-area-inset-top));
}

.safe-area-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* ========== 触摸反馈 ========== */
.touch-feedback {
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.touch-feedback:active {
    transform: scale(0.98);
    opacity: 0.8;
}

/* ========== 隐藏滚动条但保持滚动功能 ========== */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ========== 文本截断 ========== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 加载动画 ========== */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid var(--bs-secondary);
    border-top-color: var(--bs-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========== 过渡动画 ========== */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ========== 响应式图片 ========== */
img {
    max-width: 100%;
    height: auto;
}

/* ========== 自定义按钮样式 ========== */
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* ========== 表单样式 ========== */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ========== 导航栏样式 ========== */
.navbar-mobile {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* ========== 底部导航栏 ========== */
.bottom-nav {
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.bottom-nav-safe {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

/* ========== 模态框样式 ========== */
.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
}

/* ========== 工具提示和弹出框 ========== */
.tooltip {
    font-size: 0.875rem;
}

.popover {
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ========== 动画效果 ========== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* ========== 实用工具类 ========== */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.box-shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.box-shadow-md {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.box-shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ========== 社区页面样式 ========== */
.post-card {
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.post-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.post-description {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

.post-images {
    display: grid;
    gap: 0.5rem;
}

.post-images img {
    width: 100%;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.post-images img:hover {
    transform: scale(1.02);
}

/* 单张图片样式 */
.post-images.single-image img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

/* 多张图片网格布局 */
.post-images:not(.single-image) {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (max-width: 768px) {
    .post-images:not(.single-image) {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 现代浏览器支持 :has() 时使用 */
@supports selector(:has(*)) {
    .post-images:has(img:only-child) img {
        max-width: 100%;
        max-height: 500px;
        object-fit: contain;
    }

    .post-images:not(:has(img:only-child)) {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    @media (max-width: 768px) {
        .post-images:not(:has(img:only-child)) {
            grid-template-columns: repeat(2, 1fr);
        }
    }
}

.post-actions {
    display: flex;
    justify-content: space-around;
}

.post-actions .btn-link {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-actions .btn-link:hover {
    color: var(--bs-primary);
}

.post-actions .btn-link i {
    font-size: 1.25rem;
}

/* 上传图片区域 */
.upload-images-area {
    border: 2px dashed #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 200px;
    transition: all 0.3s ease;
}

.upload-images-area.dragover {
    border-color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.05);
}

.upload-placeholder {
    text-align: center;
    padding: 2rem;
    cursor: pointer;
    color: #6b7280;
}

.uploaded-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.uploaded-image-item {
    position: relative;
    width: 120px;
    height: 120px;
}

.uploaded-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

.uploaded-image-item .btn-close {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    opacity: 1;
}

.uploaded-image-item .btn-close:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

/* 评论样式 */
.comments-list {
    max-height: 500px;
    overflow-y: auto;
}

.comment-item {
    padding: 0.5rem 0;
}

.comment-content {
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.comment-children {
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid #e5e7eb;
}

.comment-form {
    position: sticky;
    bottom: 0;
    background-color: #ffffff;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* 移动端社区样式 */
.mobile-posts-list {
    padding-bottom: 100px; /* 为底部发布按钮留出空间 */
}

@media (max-width: 768px) {
    .post-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-bottom: 0;
    }

    .post-card:first-child {
        border-top: none;
    }

    .modal-dialog {
        margin: 0;
    }

    .modal-content {
        border-radius: 1rem 1rem 0 0;
        min-height: 80vh;
    }
}

/* 点赞动画 */
@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.like-btn.liked i {
    animation: heartBeat 0.5s ease;
}

/* ========== 打印样式 ========== */
@media print {
    .sidebar,
    .navbar-mobile,
    .bottom-nav,
    .btn {
        display: none !important;
    }
}

