/* Personal Center Styles */

/* 1. Layout & Container */
.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px; /* Optimized for personal center content */
    margin: 0 auto;
    gap: 20px;
    padding: 24px 20px 80px 20px; /* Space for bottom nav */
}

/* PC端增强样式 */
@media (min-width: 769px) {
    .profile-container {
        max-width: 440px;
        padding: 40px 24px 80px 24px;
        gap: 24px;
    }
}

/* For mobile devices, keep it narrower */
@media (max-width: 768px) {
    .profile-container {
        max-width: 100%;
        padding: 16px 16px 80px 16px;
    }
}

/* 2. Profile Header / Avatar */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
    padding: 20px 0;
}

.profile-avatar-wrapper {
    position: relative;
    width: 88px;
    height: 88px;
}

@media (min-width: 769px) {
    .profile-avatar-wrapper {
        width: 96px;
        height: 96px;
    }
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #2adb5c;
    background-color: #1a1a1a;
    box-shadow: 0 4px 20px rgba(42, 219, 92, 0.2);
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px dashed #333;
    background-color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 13px;
}

.profile-name {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
}

@media (min-width: 769px) {
    .profile-name {
        font-size: 24px;
    }
}

.profile-role-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    background-color: #111;
    border: 1px solid #2a2a2a;
    color: #888;
    margin-top: 2px;
}

.profile-role-badge.admin {
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
    background-color: rgba(245, 158, 11, 0.1);
}

/* 3. Info Cards */
.profile-card {
    width: 100%;
    background-color: #0a0a0a;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 20px 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 0.2s;
}

.profile-card:hover {
    border-color: #333;
}

@media (min-width: 769px) {
    .profile-card {
        padding: 24px 28px;
        gap: 16px;
    }
}

.profile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

@media (min-width: 769px) {
    .profile-card-row {
        font-size: 14px;
        padding: 6px 0;
    }
}

.profile-card-label {
    color: #666;
}

.profile-card-value {
    color: #e0e0e0;
    font-weight: 500;
}

.profile-card-value.highlight {
    color: #2adb5c;
}

/* 4. Action Buttons */
.profile-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 769px) {
    .profile-actions {
        gap: 14px;
    }
}

.profile-btn {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background-color: #111;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.profile-btn:hover {
    background-color: #1a1a1a;
    border-color: #444;
    transform: translateY(-1px);
}

.profile-btn.primary {
    background-color: #2adb5c;
    border-color: #2adb5c;
    color: #fff;
}

.profile-btn.primary:hover {
    background-color: #1e9e43;
    border-color: #1e9e43;
}

.profile-btn.danger {
    background-color: rgba(239, 68, 68, 0.08);
    border-color: rgba(220, 38, 38, 0.5);
    color: #ef4444;
}

.profile-btn.danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: #dc2626;
    transform: translateY(-1px);
}

/* 5. Management System Style Card */
.mgmt-card {
    background-color: #000000 !important;
    border: 1px solid #333 !important;
    border-radius: 8px !important;
    margin-bottom: 20px !important;
    padding: 0 !important; /* Internal padding handled by children */
    box-shadow: none !important;
    color: #fff !important;
    transition: border-color 0.2s;
    overflow: hidden; /* For rounded corners */
}

.mgmt-card:hover {
    border-color: #555 !important;
}

/* Header */
.mgmt-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap; /* Prevent wrapping to keep horizontal layout */
    gap: 12px;
}

.mgmt-header-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1; /* Allow it to take available space */
}

.mgmt-meta {
    font-size: 13px; /* Slightly larger for better readability */
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px; /* Reduce gap slightly for inline layout */
}

/* ... existing styles ... */

.mgmt-header-right {
    display: flex;
    gap: 16px;
    margin-left: auto;
    flex-shrink: 0; /* Prevent shrinking */
    align-items: center;
}

.mgmt-action-link {
    color: #888;
    font-size: 13px;
    text-decoration: none;
    display: flex;
    flex-direction: column; /* Icon top, text bottom if needed, or row */
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
    white-space: nowrap; /* Prevent text wrapping */
}

.mgmt-action-link i {
    font-size: 16px;
    margin-bottom: 2px;
}

/* Action link colors */
.mgmt-action-link.activate {
    color: #10b981;
}
.mgmt-action-link.activate:hover {
    color: #059669;
}

.mgmt-action-link.logs {
    color: #3b82f6;
}
.mgmt-action-link.logs:hover {
    color: #2563eb;
}

.mgmt-action-link.details {
    color: #8b5cf6;
}
.mgmt-action-link.details:hover {
    color: #7c3aed;
}

.mgmt-action-link.delete {
    color: #ef4444;
}
.mgmt-action-link.delete:hover {
    color: #dc2626;
}

/* Body */
.mgmt-body {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap; /* Prevent wrapping */
    gap: 20px;
}

.mgmt-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mgmt-metrics-row {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.mgmt-metric-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1;
}

.mgmt-metric-inline .script-toggle {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.mgmt-metric-label {
    color: #888;
}

.mgmt-metric-value {
    font-weight: 500;
}

/* Status colors */
.mgmt-metric-value.status-valid {
    color: #10b981;
}

.mgmt-metric-value.status-invalid {
    color: #ef4444;
}

/* 角色失效标签 */
.invalid-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    animation: blink-badge 1.5s ease-in-out infinite;
}

@keyframes blink-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Expiration colors */
.mgmt-metric-value.expire-green {
    color: #10b981;
}

.mgmt-metric-value.expire-orange {
    color: #f59e0b;
}

.mgmt-metric-value.expire-red {
    color: #ef4444;
}

/* Days left display */
.mgmt-days-left {
    font-size: 12px;
    font-weight: 500;
    margin-left: 4px;
}

.mgmt-days-left.expire-green {
    color: #10b981;
}

.mgmt-days-left.expire-orange {
    color: #f59e0b;
}

.mgmt-days-left.expire-red {
    color: #ef4444;
}

/* Permanent special effect - 永久卡金色流光特效 */
.mgmt-metric-value.expire-permanent {
    background: linear-gradient(90deg, #fbbf24, #fcd34d, #fbbf24, #f59e0b, #fbbf24);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 2s ease-in-out infinite;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
    position: relative;
}

.mgmt-metric-value.expire-permanent::before {
    content: '✨';
    margin-right: 3px;
    -webkit-text-fill-color: initial;
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    50% { background-position: 0 0; }
    100% { background-position: 100% 0; }
}

.mgmt-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 80px; /* Ensure minimum width for columns */
}

.mgmt-main-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0; /* Prevent buttons from squishing */
}

.mgmt-btn {
    height: 32px;
    padding: 0 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center; /* Center content */
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap; /* Prevent text wrapping */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mgmt-header { flex-wrap: wrap; }
    .mgmt-body { flex-wrap: wrap; }
    /* ... keep existing mobile styles ... */
}

.mgmt-btn-primary {
    background-color: #2adb5c;
    color: #fff;
    border-color: #2adb5c;
}
.mgmt-btn-primary:hover { background-color: #1e9e43; border-color: #1e9e43; }

.mgmt-btn-outline {
    background-color: transparent;
    border-color: #2adb5c;
    color: #2adb5c;
}
.mgmt-btn-outline:hover { background-color: rgba(42, 219, 92, 0.1); }

.mgmt-btn-secondary {
    background-color: transparent;
    border-color: #555;
    color: #ccc;
}
.mgmt-btn-secondary:hover { border-color: #888; color: #fff; }

/* More Section */
.mgmt-more-section {
    padding: 0 20px 20px 20px;
    display: none; /* Hidden by default */
    animation: fadeIn 0.2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.mgmt-more-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding-top: 16px;
    border-top: 1px dashed #333;
}

.mgmt-more-btn {
    height: 36px;
    border-radius: 6px;
    background: #111;
    border: 1px solid #333;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mgmt-more-btn:hover { background: #222; color: #fff; border-color: #555; }
.mgmt-more-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Activation Input */
.mgmt-activate-box {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.mgmt-input {
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 0 10px;
    border-radius: 4px;
    height: 32px;
    font-size: 13px;
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .mgmt-header { flex-direction: column; align-items: flex-start; }
    .mgmt-header-right { margin-left: 0; width: 100%; justify-content: space-between; border-top: 1px solid #222; padding-top: 10px; }
    .mgmt-body { flex-direction: column; align-items: stretch; padding: 12px 16px; }
    .mgmt-metrics { gap: 6px; }
    .mgmt-metrics-row { gap: 10px; flex-wrap: nowrap; }
    .mgmt-metric-inline { font-size: 12px; flex-shrink: 0; }
    .mgmt-main-actions { justify-content: flex-end; }
    
    /* 移动端: ID、状态、上传时间一行显示，空间不足时缩略上传时间，脚本开关保持完整 */
    .mgmt-meta {
        flex-wrap: nowrap;
        overflow: hidden;
    }
    .mgmt-meta > span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mgmt-meta > span:last-child { /* 上传时间 */
        flex: 1;
        min-width: 0;
    }
    .mgmt-meta .divider {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    .mgmt-desktop-toggle { display: none; }
}

/* Desktop: Hide mobile toggle, show body toggle */
@media (min-width: 769px) {
    .mgmt-mobile-toggle { display: none; }
    .mgmt-desktop-toggle { display: flex; }
    /* 桌面端恢复默认显示 */
}

/* 移动端样式 - 放在最后确保优先级 */
@media (max-width: 768px) {
    .mgmt-header { flex-direction: column; align-items: flex-start; }
    .mgmt-header-right { margin-left: 0; width: 100%; justify-content: space-between; border-top: 1px solid #222; padding-top: 10px; }
    .mgmt-body { flex-direction: column; align-items: stretch; padding: 12px 16px; }
    .mgmt-metrics { gap: 8px; }
    .mgmt-main-actions { justify-content: flex-end; }
    
    /* 移动端: ID、状态、上传时间一行显示 */
    .mgmt-meta {
        flex-wrap: nowrap;
        overflow: hidden;
    }
    .mgmt-meta > span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mgmt-meta > span:last-child {
        flex: 1;
        min-width: 0;
    }
    .mgmt-meta .divider {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    /* 移动端：隐藏标题行的脚本开关 */
    .mgmt-mobile-toggle {
        display: none !important;
    }
    
    /* 移动端 metrics 布局：两行居中 */
    .mgmt-metrics-row {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0;
    }
    
    /* 第一行：卡密状态 | 倒计时 */
    .mgmt-metric-inline {
        font-size: 13px;
    }
    
    .mgmt-metric-inline:not(.mgmt-desktop-toggle) {
        order: 1;
    }
    
    /* 卡密状态后面加分隔符 */
    .mgmt-metric-inline:first-child::after {
        content: "|";
        margin: 0 10px;
        color: #444;
    }
    
    /* 第二行：脚本开关 */
    .mgmt-desktop-toggle {
        display: flex !important;
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px dashed #333;
    }
    
    .mgmt-desktop-toggle .mgmt-metric-label {
        color: #888;
    }
    
    .mgmt-desktop-toggle .script-toggle {
        transform: scale(1.05);
    }
}

/* 改名按钮颜色 */
.mgmt-action-link.rename {
    color: #fbbf24;
}
.mgmt-action-link.rename:hover {
    color: #f59e0b;
}

/* Modern Button Glass Styles override for dark theme */
.modern-btn {
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    backdrop-filter: none !important; /* Remove glass effect for cleaner look or keep if desired */
}

/* Specific button colors adapted for dark theme */
.btn-activate-glass {
    background-color: #2adb5c !important;
    color: #fff !important;
    border: none !important;
}

.btn-danger-glass {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.btn-info-glass {
    background-color: rgba(51, 51, 51, 0.5) !important;
    color: #ccc !important;
    border: 1px solid rgba(51, 51, 51, 0.8) !important;
}

.btn-purple-glass {
    background-color: rgba(168, 85, 247, 0.15) !important;
    color: #c084fc !important;
    border: 1px solid rgba(168, 85, 247, 0.3) !important;
}

.btn-primary-glass {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.btn-warning-glass {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.btn-success-glass {
    background-color: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.btn-rose-glass {
    background-color: rgba(244, 63, 94, 0.15) !important;
    color: #fb7185 !important;
    border: 1px solid rgba(244, 63, 94, 0.3) !important;
}

/* Script Toggle Switch */
.script-toggle-track {
    background-color: #333 !important;
    border: 1px solid #444 !important;
}

.script-toggle-input:checked + .script-toggle-track {
    background-color: #2adb5c !important;
    border-color: #2adb5c !important;
}

/* Inputs in account card */
.account-card-input {
    background-color: #000 !important;
    border: 1px solid #333 !important;
    color: #fff !important;
    border-radius: 6px !important;
}

.account-card-input:focus {
    border-color: #2adb5c !important;
}

/* Page Title hidden on manage page too */
.page-title-main, .page-title-sub {
   display: none !important;
}

/* Section Title Style */
.section-title {
    color: #fff !important;
    text-align: center !important;
    font-size: 24px !important;
    margin-bottom: 24px !important;
    font-weight: 700 !important;
}

/* Info boxes */
.status-box.info {
    background-color: rgba(51, 51, 51, 0.4) !important;
    border: 1px solid rgba(51, 51, 51, 0.6) !important;
    color: #ccc !important;
}

/* 6. Global Background Override for Profile & Manage */
body.login-page {
    background-color: #000000 !important;
    background-image: none !important;
    animation: none !important;
}

body.login-page .snow-container {
    display: none !important;
}

/* Modal Styles override for dark theme consistency */
.dark-modal {
    background: #000000 !important;
    border: 1px solid #333 !important;
}

