/**
 * Qi System Dark Mode Styles
 * Ensures all Qi currency features work perfectly in dark mode
 */

/* ============================================
   QI DONATION BARS (Novel Page)
   ============================================ */

.dark-mode .qi-donation-section {
    background: #1e1e1e !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
}

.dark-mode .qi-section-header h2 {
    color: #e0e0e0 !important;
}

.dark-mode .qi-section-header p {
    color: #999 !important;
}

.dark-mode .user-qi-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.dark-mode .qi-bar-item {
    background: #2a2a2a !important;
    border-color: #404040 !important;
}

.dark-mode .qi-bar-item h3 {
    color: #e0e0e0 !important;
}

.dark-mode .qi-bar-item p {
    color: #999 !important;
}

.dark-mode .qi-progress-container {
    background: #1a1a1a !important;
}

.dark-mode .qi-progress-stats {
    color: #999 !important;
}

.dark-mode .qi-progress-stats strong {
    color: #e0e0e0 !important;
}

/* ============================================
   QI DONATION MODAL
   ============================================ */

.dark-mode .qi-modal-overlay {
    background: rgba(0,0,0,0.85) !important;
}

.dark-mode .qi-modal-content {
    background: #1e1e1e !important;
}

.dark-mode .qi-modal-header {
    border-bottom-color: #404040 !important;
}

.dark-mode .qi-modal-header h3 {
    color: #e0e0e0 !important;
}

.dark-mode .qi-modal-close {
    color: #999 !important;
}

.dark-mode .qi-modal-close:hover {
    color: #e0e0e0 !important;
}

.dark-mode #modal-qi-balance {
    color: #e0e0e0 !important;
}

.dark-mode #donation-amount {
    background: #2a2a2a !important;
    border-color: #404040 !important;
    color: #e0e0e0 !important;
}

.dark-mode .quick-amount {
    background: #2a2a2a !important;
    border-color: #404040 !important;
    color: #e0e0e0 !important;
}

.dark-mode .quick-amount:hover {
    border-color: #667eea !important;
    background: #2a2a3a !important;
}

/* ============================================
   TOP SUPPORTERS RANKING
   ============================================ */

.dark-mode .supporters-ranking-section {
    background: #1e1e1e !important;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}

.dark-mode .supporters-ranking-section .section-header h2 {
    color: #e0e0e0 !important;
    margin: 0 0 5px 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-mode .supporters-ranking-section .section-subtitle {
    color: #999 !important;
    margin: 0;
    font-size: 14px;
}

.dark-mode .supporter-rank-card {
    background: #2a2a2a !important;
    border: 2px solid #404040 !important;
}

.dark-mode .supporter-rank-card.top-rank {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%) !important;
}

.dark-mode .supporter-rank-card:hover {
    background: #323232 !important;
    border-color: #667eea !important;
}

.dark-mode .supporter-name {
    color: #e0e0e0 !important;
}

.dark-mode .supporter-stats {
    color: #999 !important;
}

.dark-mode .ranking-footer {
    border-top-color: #404040 !important;
    color: #999 !important;
}

/* ============================================
   SUPPORTED NOVELS TAB (Profile Page)
   ============================================ */

.dark-mode .supported-novel-card {
    background: #2a2a2a !important;
    border: 1px solid #404040 !important;
    transition: all 0.3s ease;
}

.dark-mode .supported-novel-card:hover {
    border-color: #667eea !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.dark-mode .novel-title a {
    color: #e0e0e0 !important;
}

.dark-mode .novel-title a:hover {
    color: #667eea !important;
}

.dark-mode .donation-stats {
    color: #999 !important;
}

.dark-mode .stat-value {
    color: #e0e0e0 !important;
}

.dark-mode .last-donation-time {
    color: #999 !important;
}

.dark-mode .novel-thumb-placeholder {
    background: #1a1a1a !important;
    color: #666 !important;
}

/* ============================================
   QI REDEMPTION PAGE
   ============================================ */

.dark-mode .redemption-container {
    background: #1e1e1e !important;
}

.dark-mode .redemption-form input {
    background: #2a2a2a !important;
    border-color: #404040 !important;
    color: #e0e0e0 !important;
}

.dark-mode .redemption-success {
    background: #1a2e1a !important;
    border-color: #2d5f2d !important;
    color: #8fd18f !important;
}

.dark-mode .redemption-error {
    background: #2e1a1a !important;
    border-color: #5f2d2d !important;
    color: #f18f8f !important;
}

/* ============================================
   QI TRANSACTIONS PAGE
   ============================================ */

.dark-mode .transaction-item {
    background: #2a2a2a !important;
    border: 1px solid #404040 !important;
}

.dark-mode .transaction-item:hover {
    background: #323232 !important;
}

.dark-mode .transaction-type {
    color: #e0e0e0 !important;
}

.dark-mode .transaction-amount.positive {
    color: #8fd18f !important;
}

.dark-mode .transaction-amount.negative {
    color: #f18f8f !important;
}

.dark-mode .transaction-time {
    color: #999 !important;
}

/* ============================================
   QI BALANCE WIDGET (Header)
   ============================================ */

.dark-mode .qi-balance-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4) !important;
}

.dark-mode .qi-balance-widget:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6) !important;
}

/* ============================================
   ADMIN PANEL
   ============================================ */

.dark-mode .qi-codes-table {
    background: #1e1e1e !important;
    border-color: #404040 !important;
}

.dark-mode .qi-codes-table th {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border-color: #404040 !important;
}

.dark-mode .qi-codes-table td {
    border-color: #404040 !important;
    color: #e0e0e0 !important;
}

.dark-mode .qi-codes-table tr:hover {
    background: #252525 !important;
}

.dark-mode .code-status-active {
    background: #1a2e1a !important;
    color: #8fd18f !important;
}

.dark-mode .code-status-used {
    background: #2e2e1a !important;
    color: #d1cf8f !important;
}

.dark-mode .code-status-expired {
    background: #2e1a1a !important;
    color: #f18f8f !important;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {
    .dark-mode .qi-donation-section,
    .dark-mode .supporters-ranking-section {
        padding: 20px !important;
    }
    
    .dark-mode .supporter-rank-card {
        flex-direction: column;
        text-align: center;
    }
}

/* ============================================
   SUPPORTERS RANKING GRID LAYOUT
   ============================================ */

.supporters-ranking-grid {
    display: grid;
    gap: 15px;
}

.supporter-rank-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s ease;
}

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

.supporter-rank-card.top-rank {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.supporter-rank-card[data-rank="1"] {
    border-color: #FFD700;
}

.supporter-rank-card[data-rank="2"] {
    border-color: #C0C0C0;
}

.supporter-rank-card[data-rank="3"] {
    border-color: #CD7F32;
}

.rank-badge {
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
}

.rank-badge i {
    font-size: 24px;
}

.rank-number {
    color: #999;
}

.supporter-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e0e0e0;
    flex-shrink: 0;
}

.dark-mode .supporter-avatar {
    border-color: #404040;
}

.supporter-rank-card[data-rank="1"] .supporter-avatar {
    border-color: #FFD700;
}

.supporter-rank-card[data-rank="2"] .supporter-avatar {
    border-color: #C0C0C0;
}

.supporter-rank-card[data-rank="3"] .supporter-avatar {
    border-color: #CD7F32;
}

.supporter-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.supporter-info {
    flex: 1;
    min-width: 0;
}

.supporter-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.supporter-name:hover {
    color: #667eea;
}

.supporter-stats {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.supporter-stats i {
    color: #667eea;
}

.supporter-amount {
    text-align: right;
}

.amount-value {
    font-size: 20px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.amount-label {
    font-size: 12px;
    color: #999;
}

.ranking-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.ranking-footer p {
    margin: 0;
    color: #999;
    font-size: 14px;
}

/* ============================================
   SUPPORTED NOVELS GRID (Profile)
   ============================================ */

.supported-novels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.supported-novel-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.supported-novel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.supported-novel-thumb {
    position: relative;
    display: block;
    width: 100%;
    padding-top: 140%;
    overflow: hidden;
}

.supported-novel-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.supported-novel-card:hover .supported-novel-thumb img {
    transform: scale(1.05);
}

.supporter-rank-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.supported-novel-info {
    padding: 15px;
}

.novel-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

.novel-title a {
    color: #333;
    text-decoration: none;
}

.novel-title a:hover {
    color: #667eea;
}

.donation-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.stat-icon {
    color: #667eea;
}

.stat-value {
    color: #666;
    font-weight: 600;
}

.last-donation-time {
    font-size: 12px;
    color: #999;
}

@media (max-width: 768px) {
    .supporters-ranking-grid {
        gap: 10px;
    }
    
    .supporter-rank-card {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    
    .supporter-info {
        width: 100%;
        text-align: center;
    }
    
    .supporter-amount {
        width: 100%;
    }
    
    .supported-novels-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .supported-novels-grid {
        grid-template-columns: 1fr;
    }
}
