/**
 * Advanced Features CSS
 * Theme Toggle, Gaming Stats, Notifications, Game Comparison
 * FBG Tech Games 2025
 */

/* ==========================================================================
   THEME TOGGLE SYSTEM
   ========================================================================== */

.theme-toggle-container {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.toggle-track {
    width: 50px;
    height: 24px;
    background: var(--accent-bg);
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--primary-bg);
}

.theme-toggle-btn[data-theme="light"] .toggle-thumb {
    transform: translateX(26px);
    background: #ffa502;
}

.sun-icon {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.moon-icon {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.theme-toggle-btn[data-theme="light"] .sun-icon {
    opacity: 1;
}

.theme-toggle-btn[data-theme="light"] .moon-icon {
    opacity: 0;
}

/* Light Theme Variables */
.theme-light {
    --primary-bg: #ffffff;
    --secondary-bg: #f8f9fa;
    --accent-bg: #e9ecef;
    --primary-text: #212529;
    --secondary-text: #6c757d;
    --accent-text: #adb5bd;
    --border-color: #dee2e6;
}

.theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* ==========================================================================
   GAMING STATISTICS DASHBOARD
   ========================================================================== */

.gaming-stats-widget,
.floating-stats .gaming-stats-widget {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.floating-stats {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 320px;
    z-index: 999;
    transition: transform 0.3s ease;
}

.floating-stats.collapsed {
    transform: translateY(calc(100% - 60px));
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    cursor: pointer;
}

.stats-header h3 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-refresh {
    background: none;
    border: none;
    color: var(--accent-text);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.stats-refresh:hover {
    color: var(--primary-color);
    background: var(--accent-bg);
}

.stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--accent-bg);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-bg);
    font-size: 0.9rem;
}

.stat-info {
    flex: 1;
}

.stat-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--accent-text);
    margin-top: 2px;
}

.top-genres,
.recent-activity {
    margin-bottom: 20px;
}

.top-genres h4,
.recent-activity h4 {
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.genre-bar {
    margin-bottom: 12px;
}

.genre-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.genre-name {
    font-size: 0.8rem;
    color: var(--primary-text);
    font-weight: 500;
}

.genre-count {
    font-size: 0.8rem;
    color: var(--accent-text);
}

.genre-progress {
    height: 6px;
    background: var(--accent-bg);
    border-radius: 3px;
    overflow: hidden;
}

.genre-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0;
    transition: width 1s ease;
    border-radius: 3px;
}

.activity-feed {
    max-height: 200px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 0.8rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.8rem;
    color: var(--primary-text);
    line-height: 1.3;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--accent-text);
    margin-top: 2px;
}

/* ==========================================================================
   NOTIFICATION SYSTEM
   ========================================================================== */

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.notification-bell {
    position: relative;
}

.bell-button {
    background: var(--accent-bg);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-text);
    transition: all 0.3s ease;
    position: relative;
}

.bell-button:hover {
    background: var(--primary-color);
    color: var(--primary-bg);
    transform: scale(1.05);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.notification-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 350px;
    max-height: 400px;
    background: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-dark);
    border: 1px solid var(--border-color);
    display: none;
    overflow: hidden;
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1rem;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--accent-text);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mark-all-read:hover {
    color: var(--primary-color);
    background: var(--accent-bg);
}

.notification-list {
    max-height: 250px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.notification-item:hover {
    background: var(--accent-bg);
}

.notification-item.read {
    opacity: 0.7;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-bg);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 0.8rem;
    color: var(--secondary-text);
    line-height: 1.3;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--accent-text);
}

.notification-dot {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
}

.notification-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.view-all-notifications {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
}

.no-notifications {
    padding: 40px 20px;
    text-align: center;
    color: var(--accent-text);
    font-size: 0.9rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    width: 320px;
}

.toast {
    background: var(--secondary-bg);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-dark);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-priority {
    border-left: 4px solid var(--danger-color);
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.toast-new_review .toast-icon,
.toast-success .toast-icon {
    background: var(--primary-color);
}

.toast-error .toast-icon {
    background: var(--danger-color);
}

.toast-info .toast-icon {
    background: #17a2b8;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.toast-message {
    color: var(--secondary-text);
    font-size: 0.8rem;
    line-height: 1.3;
}

.toast-close {
    background: none;
    border: none;
    color: var(--accent-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: absolute;
    top: 8px;
    right: 8px;
}

.toast-close:hover {
    color: var(--primary-text);
    background: var(--accent-bg);
}

/* ==========================================================================
   GAME COMPARISON SYSTEM
   ========================================================================== */

.game-comparison-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.comparison-toggle {
    position: relative;
}

.comparison-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: var(--primary-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-dark);
    transition: all 0.3s ease;
    position: relative;
}

.comparison-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.comparison-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
}

.comparison-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    max-height: 500px;
    background: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-dark);
    border: 1px solid var(--border-color);
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.comparison-panel.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.comparison-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparison-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-close {
    background: none;
    border: none;
    color: var(--accent-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.comparison-close:hover {
    color: var(--primary-text);
    background: var(--accent-bg);
}

.comparison-content {
    padding: 20px;
}

.selected-games {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.empty-comparison {
    text-align: center;
    padding: 40px 20px;
    color: var(--accent-text);
}

.empty-comparison i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.selected-game {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--accent-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.game-thumb img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.game-info {
    flex: 1;
}

.game-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 2px;
}

.game-rating {
    font-size: 0.8rem;
    color: var(--accent-text);
}

.remove-comparison {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.remove-comparison:hover {
    background: var(--danger-color);
    color: white;
}

.comparison-actions {
    display: flex;
    gap: 10px;
}

.comparison-actions .btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
}

/* Compare Buttons on Cards */
.compare-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.compare-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.compare-btn.added {
    background: var(--primary-color);
}

.card {
    position: relative;
}

/* Comparison Modal */
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.comparison-modal.active {
    display: flex;
}

.comparison-modal-content {
    background: var(--secondary-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-dark);
}

.comparison-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparison-modal-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    color: var(--accent-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.modal-close:hover {
    color: var(--primary-text);
    background: var(--accent-bg);
}

.comparison-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.comparison-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--primary-bg);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: var(--accent-bg);
    color: var(--primary-text);
    font-weight: 600;
}

.metric-header {
    width: 150px;
    background: var(--primary-color) !important;
    color: var(--primary-bg) !important;
}

.game-header {
    text-align: center;
    min-width: 150px;
}

.game-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.game-header-image {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.game-header-title {
    font-size: 0.8rem;
    line-height: 1.2;
}

.metric-label {
    font-weight: 600;
    color: var(--primary-text);
}

.metric-value {
    text-align: center;
    color: var(--secondary-text);
}

.metric-value.best-value {
    background: var(--primary-color);
    color: var(--primary-bg);
    font-weight: 600;
    border-radius: 4px;
}

.comparison-actions-modal {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .floating-stats {
        left: 10px;
        width: 280px;
    }
    
    .notification-container {
        top: 10px;
        right: 10px;
    }
    
    .notification-dropdown {
        width: 300px;
        right: -10px;
    }
    
    .toast-container {
        width: 280px;
        right: 10px;
    }
    
    .game-comparison-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .comparison-panel {
        width: 300px;
        right: -10px;
    }
    
    .comparison-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .comparison-table {
        font-size: 0.8rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px;
    }
    
    .stats-content {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .theme-toggle-container {
        margin-left: 10px;
    }
}

@media (max-width: 480px) {
    .notification-dropdown,
    .comparison-panel {
        width: calc(100vw - 20px);
        right: -100px;
    }
    
    .toast-container {
        width: calc(100vw - 20px);
        right: 10px;
    }
    
    .comparison-actions {
        flex-direction: column;
    }
    
    .stats-content {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .toast,
    .comparison-panel,
    .notification-dropdown,
    .toggle-thumb,
    .genre-fill {
        transition: none;
    }
    
    .notification-badge {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .toast,
    .notification-dropdown,
    .comparison-panel,
    .comparison-modal-content {
        border: 2px solid var(--primary-text);
    }
    
    .bell-button,
    .comparison-button {
        border: 2px solid var(--primary-color);
    }
}

/* ==========================================================================
   DARK/LIGHT THEME SPECIFIC ADJUSTMENTS
   ========================================================================== */

.theme-light .toast,
.theme-light .notification-dropdown,
.theme-light .comparison-panel,
.theme-light .gaming-stats-widget {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.theme-light .comparison-button,
.theme-light .bell-button {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-light .toggle-track {
    background: #e9ecef;
}

.theme-light .notification-badge,
.theme-light .comparison-count {
    background: #dc3545;
}
