/**
 * 後台管理 - 遊戲卡片樣式
 * Admin Game Cards Styles
 */

/* ==================== 遊戲卡片（後台版本） ==================== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.game-card-admin {
    background-color: #1e1e1e;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card-admin:hover {
    transform: translateY(-0.25rem);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

.light-theme .game-card-admin {
    background-color: #fff;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.05);
}

.game-card-admin.disabled {
    opacity: 0.7;
}

.game-card-image {
    position: relative;
    height: 10rem;
    background-color: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.disabled-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.disabled-overlay span {
    background-color: #ff6b6b;
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.game-card-body {
    padding: 1rem;
}

.game-card-body h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-id,
.game-project,
.game-sort {
    margin: 0;
    font-size: 0.75rem;
    color: #888;
}

.game-sort {
    color: var(--accent-primary);
    font-weight: 600;
}

/* 遊戲環境狀態 */
.game-env-status {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.env-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

.env-badge.active {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.env-badge.inactive {
    background-color: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

/* 環境狀態全名 badge */
.env-badge-full {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.env-badge-full.active {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.env-badge-full.inactive {
    background-color: rgba(158, 158, 158, 0.15);
    color: #6e6e6e;
}

/* 環境代碼 badge */
.env-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.env-code-badge.env-code-dev {
    background-color: rgba(212, 165, 32, 0.2);
    color: #d4a520;
}

.env-code-badge.env-code-uat {
    background-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.env-code-badge.env-code-pp {
    background-color: rgba(168, 85, 247, 0.2);
    color: #b8860b;
}

.env-code-badge.env-code-prod {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.env-code-badge.env-code-unknown {
    background-color: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* 角色 checkbox 群組 */
.role-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color, #333);
    border-radius: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.role-checkbox-group::-webkit-scrollbar {
    width: 6px;
}

.role-checkbox-group::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.role-checkbox-group::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.role-checkbox-group::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.role-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.role-checkbox-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.role-checkbox-item:has(input:checked) {
    background-color: rgba(212, 165, 32, 0.2);
    border-color: rgba(212, 165, 32, 0.5);
}

.role-checkbox-item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #d4a520;
    cursor: pointer;
}

.role-checkbox-label {
    font-size: 0.875rem;
    color: var(--text-primary, #e0e0e0);
}

.loading-roles,
.no-roles {
    width: 100%;
    text-align: center;
    color: #888;
    font-size: 0.875rem;
    padding: 0.5rem;
}

/* 權限選擇器樣式 */
.permissions-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.permissions-container::-webkit-scrollbar {
    width: 6px;
}

.permissions-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.permissions-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.permission-group {
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

.permission-group:last-child {
    margin-bottom: 0;
}

.permission-group-header {
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.permission-group-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.permission-group-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #d4a520;
    cursor: pointer;
}

.permission-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.permission-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.permission-checkbox-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.permission-checkbox-item:has(input:checked) {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.permission-checkbox-item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #22c55e;
    cursor: pointer;
}

.permission-checkbox-label {
    font-size: 0.8125rem;
    color: var(--text-primary, #e0e0e0);
}

.loading-permissions,
.no-permissions {
    width: 100%;
    text-align: center;
    color: #888;
    font-size: 0.875rem;
    padding: 1rem;
}

/* 權限標籤樣式 */
.permissions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.permission-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    background-color: rgba(212, 165, 32, 0.2);
    color: #d4a520;
    white-space: nowrap;
}

.permission-badge.permission-more {
    background-color: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.permission-badge.permission-none {
    background-color: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* 查看權限按鈕 */
.btn-view-perms {
    background: transparent;
    color: #f5c542;
    border: none;
    padding: 0.25rem;
    margin-left: 0.25rem;
}

.btn-view-perms:hover {
    color: #93c5fd;
    background: rgba(96, 165, 250, 0.1);
}

/* 權限查看 Modal */
.view-permissions-list {
    max-height: 400px;
    overflow-y: auto;
}

.no-permissions-msg {
    text-align: center;
    color: #888;
    padding: 2rem;
}

.perm-view-group {
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

.perm-view-group:last-child {
    margin-bottom: 0;
}

.perm-view-group-title {
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.perm-view-group-items {
    padding: 0.5rem;
}

.perm-view-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
}

.perm-view-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.perm-view-code {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    color: #f5c542;
    min-width: 180px;
}

.perm-view-desc {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* 排序標籤 */
.game-sort-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
}

/* 遊戲備註 */
.game-note {
    margin: 0.5rem 0 0 0;
    font-size: 0.6875rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 空狀態 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #888;
}

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

.empty-state p {
    margin: 0;
    font-size: 1rem;
}

.game-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.03);
    border-top: 1px solid #2a2a2a;
}

.light-theme .game-card-actions {
    background-color: rgba(0, 0, 0, 0.02);
    border-top-color: #e0e0e0;
}

/* ==================== 篩選 Checkbox ==================== */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #b0b0b0;
    user-select: none;
}

.filter-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #d4a520;
}

.filter-checkbox:hover {
    color: #fff;
}

.light-theme .filter-checkbox {
    color: #666;
}

.light-theme .filter-checkbox:hover {
    color: #333;
}

/* ==================== 視圖切換按鈕 ==================== */
.view-toggle {
    display: flex;
    background-color: #2a2a2a;
    border-radius: 0.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.light-theme .view-toggle {
    background-color: #e0e0e0;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.view-btn.active {
    background-color: #d4a520;
    color: #fff;
}

.light-theme .view-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}
