:root {
    --text-color-light: #000000;
    --text-color-dark: #F7F7FA;
    --background-color-light: #f4f4f9;
    --background-color-dark: #181818;
    --container-bg-color-light: white;
    --container-bg-color-dark: #1D1E22;
    --hover-color: #3498db;
    --author-color-light: gray;
    --author-color-dark: #b3b3b3;
    --modal-bg-blur: 25px;
    --shadow-color-light: rgba(0, 0, 0, 0.1);
    --shadow-color-dark: rgba(255, 255, 255, 0.1);
    --border-color-light: #e3e8f7;
    --border-color-dark: #42444a;
}

[data-theme=light] {
    --text-color: var(--text-color-light);
    --background-color: var(--background-color-light);
    --tag-bg-color: #bfbfbf;
    --container-bg-color: var(--container-bg-color-light);
    --author-color: var(--author-color-light);
    --shadow-color: var(--shadow-color-light);
    --border-color: var(--border-color-light);
    --modal-bg-color: rgba(255, 255, 255, 0.5);
    --modal-content-bg-color: rgba(239, 250, 255, 0.5);
    --load-more-btn-bg-color: var(--container-bg-color);
}

[data-theme=dark] {
    --text-color: var(--text-color-dark);
    --background-color: var(--background-color-dark);
    --tag-bg-color: #474747;
    --container-bg-color: var(--container-bg-color-dark);
    --author-color: var(--author-color-dark);
    --shadow-color: var(--shadow-color-dark);
    --border-color: var(--border-color-dark);
    --modal-bg-color: rgba(0, 0, 0, 0.3);
    --modal-content-bg-color: rgba(20, 20, 20, 0.5);
    --load-more-btn-bg-color: var(--container-bg-color);
}

#friend-circle-lite-root {
    width: 100%;
}

#random-article {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    width: 100%;
    margin: 0 0 16px 0;
    background-color: var(--container-bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 20px;
    transition: all 0.3s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.random-top {
    width: 100%;
}

.random-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background-color: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: var(--hover-color);
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--hover-color);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-text {
    font-size: 11px;
    color: var(--author-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.random-content {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.random-container {
    flex: 1;
    min-width: 0;
}

.random-container-title {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.random-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.random-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.random-author,
.random-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--author-color);
    transition: all 0.3s ease;
}

.random-author:hover,
.random-date:hover {
    border-color: var(--hover-color);
}

.random-button-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.random-button-container a {
    padding: 8px 16px;
    color: var(--text-color) !important;
    text-decoration: none !important;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--background-color);
    transition: all 0.3s ease;
    font-size: 13px;
    white-space: nowrap;
}

.random-button-container a:hover {
    border-color: var(--hover-color);
    color: var(--hover-color) !important;
}

.random-link-button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background-color: var(--hover-color);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.random-link-button:hover {
    opacity: 0.9;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .random-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 600px) {
    .random-content {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .random-container {
        text-align: center;
    }
    
    .random-meta {
        justify-content: center;
    }
    
    .random-button-container {
        justify-content: center;
        width: 100%;
    }
}

@media screen and (max-width: 400px) {
    .random-stats {
        gap: 8px;
    }
    
    .stat-item {
        padding: 10px 8px;
    }
    
    .stat-num {
        font-size: 20px;
    }
}

/* 加载和错误状态样式 */
.loading-placeholder,
.error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--hover-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    color: var(--author-color);
}

.error-icon {
    font-size: 48px;
}

.error-text {
    font-size: 14px;
    color: var(--author-color);
    text-align: center;
}

.retry-button {
    margin-top: 8px;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background-color: var(--hover-color);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.retry-button:hover {
    opacity: 0.9;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg-color);
    backdrop-filter: blur(var(--modal-bg-blur));
    -webkit-backdrop-filter: blur(var(--modal-bg-blur));
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.modal-open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    opacity: 0;
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(-50px);
    width: 350px;
    background-color: var(--modal-content-bg-color);
    padding: 20px;
    border: 1px solid var(--border-color);
    z-index: 1000;
    max-height: 90%;
    overflow: hidden;
    border-radius: 20px;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.modal.modal-open .modal-content {
    transform: translate(-50%, -50%) translateY(0);
    opacity: 1;
}

.modal-content:hover #modal-bg  {
    transform: scale(1.1);
}

@media screen and (max-width: 440px) {
    .modal-content {
        width: 80%;
    }
}

#modal-bg {
    position: absolute;
    filter: blur(5px);
    opacity: 0.2;
    z-index: 0;
    border-radius: 125px 125px 12px 125px !important;
    margin: 0 !important;
    width: 250px;
    height: 250px;
    right: -20px;
    bottom: -20px;
    object-fit: cover;
    transition: transform 0.6s ease !important;
}

#modal-author-avatar {
    display: block;
    margin: 5px auto !important;
    border-radius: 50% !important;
    width: 110px;
    height: 110px;
    object-fit: cover;
}

#modal-author-name-link {
    display: block;
    text-align: center;
    font-size: 15px;
    margin: 15px 0;
    color: var(--hover-color);
    text-decoration: none;
}

#modal-author-name-link:hover {
    text-decoration: underline;
}

.modal-content hr {
    margin: 20px 0;
}

#modal-articles-container {
    position: relative;
    z-index: 1;
    border-top: var(--hover-color) double 2px;
    margin-top: 20px;
    padding-top: 10px;
}

.modal-article {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: var(--hover-color) dashed 1px;
}

.modal-article .modal-article-title {
    color: var(--text-color);
    font-size: 18px;
    line-height: 1.2;
    cursor: pointer;
    max-height: 2.5em;
    width: 100%;
    margin-bottom: 5px;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-article .modal-article-title:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

.modal-article .modal-article-date {
    font-size: 12px;
    width: 100%;
    color: var(--author-color);
    padding: 5px;
    cursor: default;
    text-align: right;
}

.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    width: 100%;
}

.card {
    background-color: var(--container-bg-color);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 120px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:hover {
    border-color: var(--hover-color);
    transform: translateY(-4px);
}

#random-article:hover {
    border-color: var(--hover-color);
}

.card-title {
    z-index: 1;
    font-size: 16px;
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    line-height: 1.5;
    max-height: 4.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    transition: all 0.3s ease;
}

.card-title:hover {
    color: var(--hover-color);
}

.card-author,
.card-date {
    font-size: 12px;
    color: var(--author-color);
    padding: 4px 10px 4px 2px;
    line-height: 15px;
}

.card-author:hover {
    border-color: var(--hover-color);
}

.card-author {
    cursor: pointer;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    padding-right: 10px;
    width: fit-content;
    align-items: center;
    transition: all 0.3s ease;
}

#friend-circle-lite-root .card-author img {
    border-radius: 50%;
    width: 15px;
    height: 15px;
    margin: 0 2px !important;
    object-fit: cover;
}

.card-date {
    position: absolute;
    z-index: 1;
    bottom: 10px;
    cursor: default;
    right: 10px;
    display: flex;
    align-items: center;
}

#friend-circle-lite-root .card-bg {
    cursor: default;
    z-index: 0;
    border-radius: 50% !important;
    margin: 0 !important;
    position: absolute;
    bottom: -20px;
    right: -16px;
    width: 140px;
    height: 140px;
    opacity: 0.4;
    object-fit: cover;
    transition: transform 0.6s ease, bottom 0.3s ease, right 0.3s ease;
}

#friend-circle-lite-root .card:hover .card-bg {
    transform: scale(1.1);
    bottom: -10px;
    right: -8px;
}

#load-more-btn {
    color: var(--text-color);
    font-size: 13px;
    font-weight: 500;
    background-color: var(--container-bg-color);
    cursor: pointer;
    width: 140px;
    max-width: 100%;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 8px 24px;
    transition: all 0.3s ease;
    margin: 20px auto;
    display: block;
}

#load-more-btn:hover {
    background-color: var(--hover-color);
    border-color: var(--hover-color);
    color: white;
    width: 180px;
    max-width: 100%;
}

#stats-container {
    font-size: 13px;
    text-align: right;
    margin-top: 20px;
}

#stats-container > * {
    margin-bottom: 3px;
}

#stats-container a {
    color: var(--author-color);
    text-decoration: none;
}
