/* ================================
   Components.css - 通用组件样式
   ================================ */

/* 导航栏控制 - 隐藏特定分区 */
.main-nav a[href*="peripherals.html"],
/* 骨架屏卡片样式 - 防止内容跳动 */
.skeleton-card {
    background: linear-gradient(
        90deg,
        rgba(240, 240, 240, 0.9) 0%,
        rgba(250, 250, 250, 0.9) 50%,
        rgba(240, 240, 240, 0.9) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-xl);
    width: calc(20% - 8px);
    height: 320px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* 骨架屏加载动画 */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 骨架屏内部结构 */
.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    background: linear-gradient(
        135deg,
        rgba(220, 220, 220, 0.3) 0%,
        rgba(230, 230, 230, 0.3) 100%
    );
    border-radius: var(--radius-xl) 16px 0 0;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 15px;
    right: 15px;
    height: 80px;
    background: linear-gradient(
        180deg,
        rgba(230, 230, 230, 0.6) 0%,
        rgba(240, 240, 240, 0.4) 100%
    );
    border-radius: var(--radius-md);
}

/* 内容网格布局 */
.content-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 360px;
    align-content: flex-start;
}

.game-grid {
    /* 继承.content-grid的样式 */
}

.news-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: auto;
}

/* 现代化游戏卡片样式 */
.game-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    overflow: hidden;
    /* 优化：统一为柔和单层阴影 */
    box-shadow: var(--shadow-md);
    /* 恢复正常边框 */
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* 优化：加快过渡速度 */
    transition: all var(--transition-base);
    width: calc(20% - 8px);
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-base) ease;
    border-radius: inherit;
}

.game-card:hover {
    /* 优化：减少位移距离，更精致 */
    transform: translateY(-4px);
    /* 优化：简化悬停阴影 */
    box-shadow: var(--shadow-lg);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card .game-img {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 宽高比 */
    overflow: hidden;
    background-color: var(--color-bg-lighter);
}

.game-card .game-img img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    /* 默认设置，会被JavaScript动态调整 */
    object-fit: cover;
    object-position: center;
    transform: translate(-50%, -50%);
    transition: all var(--transition-base) ease;
}

/* 现代化游戏评分标签 */
.game-score {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 10px;
    border-radius: var(--radius-2xl);
    color: white;
    font-weight: 600;
    font-size: 11px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-base) ease;
}

.game-score:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-score.score-high {
    background: linear-gradient(135deg, #28a745, #20c997);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.game-score.score-medium {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: var(--color-text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
}

.game-score.score-average {
    background: linear-gradient(135deg, #fd7e14, #e74c3c);
    box-shadow: 0 2px 8px rgba(253, 126, 20, 0.4);
}

.game-score.score-low {
    background: linear-gradient(135deg, #dc3545, #c82333);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

/* 游戏卡片信息区域 */
.game-card-info {
    padding: var(--space-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.game-card-info h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: bold;
    color: var(--color-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    hyphens: none;
}

.game-card-info .game-tags {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.2;
}

.game-card-info .game-release-date {
    margin: 0;
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: auto;
}

.game-card .game-title,
.game-info .game-title,
.game-info h3.game-title,
h3.game-title {
    padding: var(--space-sm) !important;
    font-size: 14px !important;
    font-weight: bold !important;
    color: var(--color-text-primary) !important;
    line-height: 1.4 !important;
    min-height: 54px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    word-wrap: break-word !important;
    hyphens: none !important;
}

.game-card .game-desc {
    padding: 0 8px 8px;
    font-size: 12px;
    color: #777;
    line-height: 1.4;
}

.game-card .game-date {
    padding: 0 8px 8px;
    font-size: 12px;
    color: var(--color-text-tertiary);
    line-height: 1.4;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #777;
    padding: 0 8px 8px;
}

.game-meta .game-author,
.game-meta .game-created-at {
    display: flex;
    align-items: center;
}

.game-meta i {
    margin-right: 4px;
}

/* 新闻卡片样式 */
.news-card {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border);
    background-color: #fff;
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
    transition: background-color 0.2s;
    cursor: pointer;
}

.news-card:last-child {
    border-bottom: none;
}

.news-card:hover {
    background-color: var(--color-bg-light);
    transform: none;
}

.news-card .game-img {
    flex: 0 0 120px;
    height: 80px;
    padding-top: 0;
    margin-right: 15px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--color-bg-lighter);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.news-card .game-img.no-image {
    background-image: none !important;
    background-color: var(--color-bg-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-card .game-img.no-image::after {
    content: '📰';
    font-size: 24px;
    color: #ccc;
}

.news-card .game-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.news-card .news-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
}

.news-card .game-title {
    font-size: 17px;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
    padding: 0;
    min-height: auto;
    overflow-wrap: break-word;
    hyphens: auto;
}

.news-card .game-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 6px;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-card .news-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.news-author,
.news-date,
.news-author-date {
    display: flex;
    align-items: center;
}

.news-author i,
.news-date i,
.news-author-date i {
    margin-right: 4px;
    margin-left: 8px;
}

/* 抽奖卡片样式 */
.lottery-grid {
    /* 使用.content-grid样式 */
}

.lottery-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    width: calc(25% - 7.5px);
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    padding: 15px;
    justify-content: space-between;
    min-height: 150px;
}

.lottery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lottery-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lottery-title {
    font-size: 16px;
    font-weight: bold;
    color: #3366cc;
    margin-bottom: 10px;
    line-height: 1.3;
}

.lottery-prize {
    font-size: 14px;
    color: #495057;
    margin-bottom: 15px;
    flex-grow: 1;
}

.lottery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
    margin-top: auto;
}

.lottery-meta span {
    display: flex;
    align-items: center;
}

.lottery-meta i {
    margin-right: 5px;
}

/* 评分圆圈组件 */
.score-circle {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    border-radius: var(--radius-full);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 1.5;
    stroke-dasharray: 2, 3;
}

.score-circle-fill {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
}

.score-text {
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 14px;
    line-height: 1;
}

/* 现代化按钮组件 */
.btn {
    display: inline-block;
    padding: var(--space-md) 20px;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B35, #E8425A);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

/* 表单组件 */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--color-text-primary);
}

.form-control {
    width: 100%;
    padding: var(--space-sm) 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3366cc;
    box-shadow: 0 0 0 2px rgba(51, 102, 204, 0.2);
}

/* 模态框组件 */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.modal.show,
.modal.is-open {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: var(--space-xl);
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: var(--radius-md);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    color: var(--color-text-primary);
}

.modal-close,
.close-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    float: right;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.modal-close:hover,
.close-button:hover,
.close-button:focus {
    color: var(--color-text-primary);
}

/* 认证模态框（登录/注册）*/
.auth-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.auth-modal .modal-content {
    background-color: #fff;
    padding: var(--space-3xl) 40px;
    border-radius: var(--radius-md);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
    font-size: 24px;
    color: var(--color-text-primary);
}

.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.modal-content .form-group input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 16px;
    box-sizing: border-box;
}

.modal-content .auth-hint {
    display: block;
    margin-top: 6px;
    color: var(--color-text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.modal-content .form-actions {
    margin-top: 25px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.modal-content .form-actions button {
    flex: 1;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-content .form-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.modal-content .form-actions button[type="submit"] {
    background-color: #3366cc;
    color: white;
}

.modal-content .form-actions button[type="submit"]:hover {
    background-color: #2654a3;
}

.modal-content .form-actions button[type="button"] {
    background-color: #6c757d;
    color: white;
}

.modal-content .form-actions button[type="button"]:hover {
    background-color: #5a6268;
}

.modal-content p {
    text-align: center;
    margin-top: 20px;
    color: var(--color-text-secondary);
}

.modal-content p a {
    color: #3366cc;
    text-decoration: none;
}

.modal-content p a:hover {
    text-decoration: underline;
}

/* 忘记密码弹窗特定样式 */
.forgot-step {
    transition: opacity var(--transition-base) ease;
}

.countdown-text {
    display: block;
    color: var(--color-text-secondary);
    font-size: 12px;
    margin-top: 5px;
}

.message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.modal-content .form-actions button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.modal-content .form-actions button:disabled:hover {
    background-color: #ccc;
}

/* 下拉菜单组件 */
.nav-item.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px); /* 增加一点间距 */
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 180px;
    z-index: 1001;
    border: 1px solid rgba(255, 107, 53, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 显示下拉菜单时的动画 */
.nav-item.dropdown.open .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 用户下拉菜单显示规则 */
.user-dropdown.open .dropdown-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    z-index: 9999 !important;
}

/* 用户下拉菜单特殊样式 */
.user-dropdown .dropdown-menu {
    left: auto;
    right: 0;
    min-width: 160px;
}

.dropdown-item {
    display: block;
    padding: 12px 20px;
    color: var(--color-text-primary);
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

/* 禁用下拉菜单项继承的 ::before（因为它会从 .nav-item::before 继承） */
.dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(135deg, #FF6B35, #E8425A);
    transform: scaleY(0);
    transition: transform 0.25s ease;
    /* 重要：覆盖任何继承的样式 */
    z-index: 1;
}

.dropdown-item:hover::before {
    transform: scaleY(1);
}

.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(255, 107, 53, 0.08), transparent);
    color: #FF6B35;
    padding-left: 24px;
}

/* 未读消息指示器 */
.unread-indicator::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: red;
    border-radius: var(--radius-full);
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
