/**
 * Modals
 * All modal styles including auth, leaderboard, achievements, profile, and settings
 */

/* ===================================== */
/* BASE MODAL STRUCTURE                  */
/* ===================================== */

.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.modal-content {
    background-color: var(--card-background);
    padding: 35px;
    border-radius: 30px;
    width: 90%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 10px 50px rgba(13, 148, 136, 0.25);
    border: 1px solid rgba(13, 148, 136, 0.15);
}

/* Wider modal for leaderboards */
.modal-content-wide {
    max-width: 520px;
    padding: 25px;
    border: 2px solid rgba(13, 148, 136, 0.25);
    box-shadow: 0 15px 60px rgba(13, 148, 136, 0.35);
}

/* Modal Close Button (X button) - 44px minimum touch target */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(13, 148, 136, 0.1);
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1) rotate(90deg);
}

.modal-close-btn:active {
    transform: scale(0.95);
}

/* ===================================== */
/* AUTH MODAL                            */
/* ===================================== */

.auth-form h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--input-border);
    border-radius: 20px;
    background-color: var(--input-background);
    color: var(--text-color);
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px var(--shadow-color);
    transform: translateY(-2px);
    background-color: var(--card-hover-background);
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin: 10px 0;
    min-height: 20px;
}

.auth-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: var(--button-text-color);
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px var(--shadow-color);
}

.auth-submit-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(78, 168, 222, 0.4);
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    color: var(--text-color);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.auth-switch a:hover {
    text-decoration: underline;
}

#auth-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    height: 45px;
    background: var(--primary-color);
    color: var(--button-text-color);
    border: none;
    border-radius: 22.5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
    flex-shrink: 0;
}

.auth-btn i {
    font-size: 15px;
    flex-shrink: 0;
}

.auth-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 22px var(--shadow-color);
}

#user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

#username-display {
    color: var(--text-color);
    font-weight: bold;
}

/* ===================================== */
/* LEADERBOARD MODAL                     */
/* ===================================== */

#modal-leaderboard-container {
    width: 100%;
    max-height: 500px;
    overflow-y: auto;
}

#modal-leaderboard-loading,
#leaderboard-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-color);
    font-style: italic;
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 10px;
}

.leaderboard-table thead {
    background: var(--primary-color);
    color: var(--button-text-color);
}

.leaderboard-table th {
    padding: 15px;
    text-align: left;
    font-weight: 700;
    font-size: 14px;
}

.leaderboard-table th:first-child {
    border-radius: 15px 0 0 15px;
}

.leaderboard-table th:last-child {
    border-radius: 0 15px 15px 0;
}

.leaderboard-table td {
    padding: 12px 15px;
    background-color: var(--input-background);
    color: var(--text-color);
}

.leaderboard-table tbody tr {
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.15);
}

.leaderboard-table tbody tr td:first-child {
    border-radius: 15px 0 0 15px;
}

.leaderboard-table tbody tr td:last-child {
    border-radius: 0 15px 15px 0;
}

.leaderboard-table tr.rank-1 td {
    background: rgba(255, 215, 0, 0.3);
    font-weight: 700;
}

.leaderboard-table tr.rank-2 td {
    background: rgba(192, 192, 192, 0.3);
    font-weight: 700;
}

.leaderboard-table tr.rank-3 td {
    background: rgba(205, 127, 50, 0.3);
    font-weight: 700;
}

.rank-cell {
    width: 80px;
    font-weight: bold;
    font-size: 16px;
}

.username-cell {
    font-weight: 700;
    color: var(--primary-color);
}

.score-cell {
    text-align: center;
    font-weight: 700;
    color: var(--accent-color);
}

.winrate-cell {
    text-align: center;
}

.games-cell {
    text-align: center;
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.8;
}

/* ===================================== */
/* ACHIEVEMENTS MODAL                    */
/* ===================================== */

.achievements-modal-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px 35px;
}

.achievements-title {
    text-align: center;
    color: var(--primary-color);
    margin: 0 0 25px 0;
    font-size: 28px;
    background: var(--primary-color);
}

.achievements-stats {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin-bottom: 20px;
}

/* Base styling for ALL stat-box (difficulty and achievements) */
.stat-box {
    flex: 1;
    background: rgba(13, 148, 136, 0.1);
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    border: 2px solid rgba(13, 148, 136, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.2);
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}

/* Stat label for ALL stat-box (achievements, difficulty, etc) */
.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.9;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Stat-box stat-label styling */
.stat-box .stat-label {
    font-size: 13px;
    margin-bottom: 8px;
}

.achievements-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}

.achievement-tab {
    padding: 8px 20px;
    border: 2px solid rgba(13, 148, 136, 0.3);
    background: transparent;
    color: var(--text-color);
    border-radius: 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.achievement-tab:hover {
    background: rgba(13, 148, 136, 0.1);
    border-color: var(--primary-color);
}

.achievement-tab.active {
    background: var(--primary-color);
    color: var(--button-text-color);
    border-color: var(--primary-color);
}

.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom scrollbar for achievements list */
.achievements-list::-webkit-scrollbar {
    width: 6px;
}

.achievements-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.achievements-list::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-color-rgb), 0.4);
    border-radius: 3px;
}

.achievements-list::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-color-rgb), 0.6);
}

.achievement-item {
    background: var(--input-background);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.3s ease;
    border: 2px solid rgba(13, 148, 136, 0.15);
    position: relative;
    overflow: hidden;
}

.achievement-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-item.unlocked::before {
    opacity: 1;
}

.achievement-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.2);
    border-color: var(--primary-color);
}

.achievement-item.locked {
    opacity: 0.6;
}

.achievement-icon-wrapper {
    min-width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(13, 148, 136, 0.2);
    border: 2px solid rgba(13, 148, 136, 0.3);
}

.achievement-item.unlocked .achievement-icon-wrapper {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.achievement-icon {
    filter: grayscale(0);
}

.achievement-item.locked .achievement-icon {
    filter: grayscale(100%);
    opacity: 0.5;
}

.achievement-info {
    flex: 1;
}

.achievement-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.achievement-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-color);
}

.achievement-badge-unlocked {
    background: var(--success-color);
    color: white;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.achievement-description {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.4;
    margin-bottom: 6px;
}

.achievement-meta {
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: var(--text-color);
    opacity: 0.6;
}

.achievement-type {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===================================== */
/* PROFILE MODAL                         */
/* ===================================== */

.profile-modal-content {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    /* Hide scrollbar but keep scroll functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.profile-modal-content::-webkit-scrollbar {
    display: none;
}

.profile-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Profile Header - More Compact */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(13, 148, 136, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
}

.profile-avatar {
    font-size: 48px;
    color: var(--primary-color);
}

.profile-user-info h3 {
    margin: 0 0 4px 0;
    font-size: 20px;
    color: var(--text-color);
}

.profile-user-info p {
    margin: 2px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-join-date {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Profile Stats Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
}

.profile-stat-card {
    background: var(--card-background);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    padding: 12px 10px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.profile-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.25);
}

/* Icon + Number horizontal container */
.profile-stat-card .stat-icon-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-stat-card i {
    font-size: 22px;
    color: var(--primary-color);
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

.profile-stat-card .stat-label {
    font-size: 12px;
    margin-top: 0;
    line-height: 1.2;
}

/* Profile Sections */
.profile-section {
    margin-bottom: 20px; /* Reduced from 30px */
}

.profile-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.3px; /* Reduced from 1px for tighter spacing */
}

/* Difficulty Breakdown - Uses stat-box styling */
.difficulty-breakdown {
    display: flex;
    justify-content: space-around;
    gap: 12px;
}

/* Stat detail text (used in difficulty boxes) */
.stat-detail {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    opacity: 0.8;
}

/* Achievements Summary */
.profile-achievements-summary {
    margin-top: 10px;
}

.achievement-summary-card {
    background: rgba(13, 148, 136, 0.1);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.achievement-summary-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.achievement-summary-card > i:first-child {
    font-size: 32px;
    color: #FFD700;
}

.achievement-summary-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.achievement-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
}

.achievement-percent {
    font-size: 14px;
    color: var(--text-muted);
}

.achievement-summary-card > i:last-child {
    font-size: 20px;
    color: var(--primary-color);
}

/* Recent Games List */

/* ===================================== */
/* RECENT GAMES - CARD STYLE             */
/* ===================================== */

.recent-games-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 200px; /* Reduced height for more compact look */
    min-height: 200px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    scrollbar-width: thin;
}

.recent-games-list::-webkit-scrollbar {
    width: 6px;
}

.recent-games-list::-webkit-scrollbar-track {
    background: rgba(13, 148, 136, 0.1);
    border-radius: 3px;
}

.recent-games-list::-webkit-scrollbar-thumb {
    background: rgba(13, 148, 136, 0.4);
    border-radius: 3px;
}

.recent-games-list::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 148, 136, 0.6);
}

.recent-game-item {
    background: var(--card-background);
    border: 2px solid rgba(13, 148, 136, 0.15);
    border-radius: 8px;
    padding: 8px 10px; /* More compact padding */
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced gap */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    min-height: 50px; /* Reduced minimum height */
}

.recent-game-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    transition: all 0.3s ease;
}

.recent-game-item.won::before {
    background: var(--success-color);
}

.recent-game-item.lost::before {
    background: #F44336;
}

.recent-game-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
    border-color: var(--primary-color);
}

/* Result Icon - Compact */
.game-result-icon {
    font-size: 20px; /* More compact */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; /* More compact */
    height: 30px;
}

.game-result-icon.won {
    color: var(--success-color);
}

.game-result-icon.lost {
    color: #F44336;
    opacity: 0.7;
}

/* Game details */
.game-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px; /* More compact */
}

.game-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* Difficulty badges */
.difficulty-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.difficulty-badge.difficulty-easy {
    background: var(--success-color);
    color: white;
}

.difficulty-badge.difficulty-medium {
    background: #FF9800;
    color: white;
}

.difficulty-badge.difficulty-hard {
    background: #F44336;
    color: white;
}

/* Game stats inline */
.game-stats-inline {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.game-stats-inline span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.game-stats-inline i {
    font-size: 10px;
    opacity: 0.7;
}

.game-date {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-date i {
    font-size: 10px;
    opacity: 0.8;
}

/* Profile Logout Section */
.profile-logout-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid rgba(var(--primary-color-rgb), 0.1);
    display: flex;
    justify-content: center;
}

.profile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    background: transparent;
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.3px;
}

.profile-logout-btn i {
    font-size: 14px;
}

.profile-logout-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: #e74c3c;
    color: #c0392b;
    transform: translateY(-1px);
}

.profile-logout-btn:active {
    transform: translateY(0);
}

/* Dark mode */
body.dark-mode .profile-logout-section {
    border-top-color: rgba(13, 148, 136, 0.15);
}

/* ===================================== */
/* SETTINGS MODAL                        */
/* ===================================== */

.settings-modal-content {
    max-width: 600px;
    max-height: 90vh;
    padding: 30px 25px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    border-radius: 25px;
    /* Hide scrollbar but keep scroll functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.settings-modal-content::-webkit-scrollbar {
    display: none;
}

.settings-title {
    text-align: center;
    color: var(--primary-color);
    margin: 0 0 25px 0;
    font-size: 24px;
    font-weight: 700;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Add visual separation between setting groups */
.setting-item:not(:last-child) {
    margin-bottom: 3px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.setting-item:hover {
    border-color: var(--primary-color);
    background: var(--card-hover-background);
    box-shadow: 0 4px 15px var(--shadow-color);
    transform: translateY(-2px);
}

.setting-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.setting-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

.setting-info {
    flex: 1;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 3px;
}

.setting-label i {
    color: var(--primary-color);
    font-size: 17px;
}

.setting-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 6px;
    border-radius: 5px;
    background: var(--primary-color);
    outline: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.volume-slider:hover {
    opacity: 1;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(78, 168, 222, 0.4);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(78, 168, 222, 0.4);
}

.volume-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 45px;
    text-align: right;
}

.toggle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    background: var(--primary-color);
    color: var(--button-text-color);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.toggle-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-color);
}

.toggle-btn-placeholder {
    display: flex;
    align-items: center;
}

.coming-soon-badge {
    padding: 6px 12px;
    background: #ffc107;
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 15px;
    text-transform: uppercase;
}

/* Clickable setting item (How to Play) */
.setting-item.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-item.clickable:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.setting-item.clickable.active {
    border-radius: 12px 12px 0 0;
}

.toggle-arrow {
    font-size: 16px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.setting-item.clickable.active .toggle-arrow {
    transform: rotate(180deg);
}

/* How to Play Content */
.how-to-play-content {
    background: rgba(78, 168, 222, 0.08);
    border-radius: 0 0 12px 12px;
    padding: 18px;
    margin-top: 0;
    border-top: 1px solid rgba(var(--primary-color-rgb), 0.15);
    animation: slideDown 0.3s ease-out;
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for how-to-play */
.how-to-play-content::-webkit-scrollbar {
    width: 6px;
}

.how-to-play-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.how-to-play-content::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-color-rgb), 0.4);
    border-radius: 3px;
}

.how-to-play-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-color-rgb), 0.6);
}

.rules-section {
    margin-bottom: 20px;
}

.rules-section:last-child {
    margin-bottom: 0;
}

.rules-section h4 {
    color: var(--primary-color);
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 700;
}

.rules-section p {
    color: var(--text-color);
    margin: 8px 0;
    line-height: 1.6;
}

.rules-section ul {
    margin: 8px 0;
    padding-left: 20px;
    color: var(--text-color);
}

.rules-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.example-box {
    background: rgba(var(--primary-color-rgb), 0.1);
    border-left: 4px solid var(--primary-color);
    padding: 12px 15px;
    margin-top: 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.7;
}

.example-box code {
    background: rgba(var(--primary-color-rgb), 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
}

/* ===================================== */
/* GAME MODE ITEMS (Collapsible)        */
/* ===================================== */

.mode-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 14px;
}

.game-mode-item {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(var(--primary-color-rgb), 0.15);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.game-mode-item:hover {
    border-color: rgba(var(--primary-color-rgb), 0.3);
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.1);
}

.game-mode-item.active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

.mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    user-select: none;
}

.mode-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.mode-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-color);
}

.mode-arrow {
    color: var(--primary-color);
    font-size: 14px;
    transition: transform 0.3s ease;
}

.game-mode-item.active .mode-arrow {
    transform: rotate(180deg);
}

.mode-content {
    padding: 0 15px 15px 15px;
    animation: slideDown 0.3s ease-out;
}

.mode-content p {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
}

.mode-content ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-color);
}

.mode-content li {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 14px;
}

.mode-content .nested-list {
    margin-top: 5px;
    padding-left: 20px;
}

.mode-content .nested-list li {
    margin-bottom: 4px;
    font-size: 13px;
}

/* ===================================== */
/* DARK MODE                             */
/* ===================================== */

body.dark-mode .modal-content {
    background-color: var(--card-background);
}

body.dark-mode .modal-content-wide {
    border: 2px solid rgba(13, 148, 136, 0.35);
    box-shadow: 0 15px 60px rgba(13, 148, 136, 0.45);
}

body.dark-mode .form-group input {
    background-color: var(--input-background);
    border-color: #495057;
    color: var(--text-color);
}

body.dark-mode .form-group input:focus {
    background-color: var(--card-background);
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.35);
}

body.dark-mode .modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-close-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* Leaderboard dark mode */
body.dark-mode .leaderboard-table {
    background-color: var(--card-background);
}

body.dark-mode .leaderboard-table tbody tr:hover {
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.25);
}

body.dark-mode .leaderboard-table tr.rank-1 td {
    background: rgba(255, 215, 0, 0.15);
}

body.dark-mode .leaderboard-table tr.rank-2 td {
    background: rgba(192, 192, 192, 0.15);
}

body.dark-mode .leaderboard-table tr.rank-3 td {
    background: rgba(205, 127, 50, 0.15);
}

body.dark-mode .username-cell {
    color: var(--primary-color);
}

body.dark-mode .score-cell {
    color: var(--accent-color);
}

/* Achievements dark mode */
body.dark-mode .stat-box {
    background: rgba(13, 148, 136, 0.15);
    border-color: rgba(13, 148, 136, 0.3);
}

body.dark-mode .stat-box:hover {
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.25);
}

body.dark-mode .achievement-tab {
    border-color: rgba(13, 148, 136, 0.4);
}

body.dark-mode .achievement-tab:hover {
    background: rgba(13, 148, 136, 0.15);
}

body.dark-mode .achievement-item {
    background-color: #2d2f48;
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .achievement-item:hover {
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.25);
    border-color: var(--secondary-color);
}

body.dark-mode .achievement-icon-wrapper {
    background: rgba(13, 148, 136, 0.2);
    border-color: rgba(13, 148, 136, 0.4);
}

body.dark-mode .achievement-item.unlocked .achievement-icon-wrapper {
    background: var(--secondary-color);
}

/* Dark mode scrollbar for achievements list */
body.dark-mode .achievements-list::-webkit-scrollbar-thumb {
    background: rgba(96, 197, 242, 0.25);
}

body.dark-mode .achievements-list::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 197, 242, 0.4);
}

body.dark-mode .achievements-list {
    scrollbar-color: rgba(96, 197, 242, 0.25) transparent;
}

/* Profile dark mode */
body.dark-mode .profile-header {
    background: rgba(13, 148, 136, 0.2);
}

body.dark-mode .profile-stat-card:hover {
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.5);
}

body.dark-mode .achievement-summary-card {
    background: rgba(13, 148, 136, 0.2);
}

/* Settings dark mode */
body.dark-mode .setting-item {
    background: var(--input-background);
    border-color: var(--border-color);
}

body.dark-mode .setting-item:hover {
    border-color: var(--primary-color);
    background: var(--card-hover-background);
    box-shadow: 0 4px 15px var(--shadow-color);
}

body.dark-mode .volume-slider {
    background: rgba(13, 148, 136, 0.25);
    opacity: 0.7;
}

body.dark-mode .volume-slider:hover {
    opacity: 0.9;
}

body.dark-mode .volume-slider::-webkit-slider-thumb {
    background: rgba(13, 148, 136, 0.8);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

body.dark-mode .volume-slider::-moz-range-thumb {
    background: rgba(13, 148, 136, 0.8);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

body.dark-mode .volume-percentage {
    color: rgba(13, 148, 136, 0.9);
}

body.dark-mode .how-to-play-content {
    background: rgba(96, 197, 242, 0.1);
}

body.dark-mode .rules-section h4 {
    color: var(--secondary-color);
}

body.dark-mode .example-box {
    background: rgba(96, 197, 242, 0.15);
    border-left-color: var(--secondary-color);
}

body.dark-mode .example-box code {
    background: rgba(96, 197, 242, 0.2);
    color: var(--secondary-color);
}

body.dark-mode .game-mode-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .game-mode-item:hover {
    border-color: rgba(13, 148, 136, 0.4);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
}

body.dark-mode .game-mode-item.active {
    border-color: var(--secondary-color);
    background: rgba(96, 197, 242, 0.08);
}

body.dark-mode .mode-name {
    color: var(--text-color);
}

body.dark-mode .mode-arrow {
    color: var(--secondary-color);
}

body.dark-mode .toggle-arrow {
    color: var(--secondary-color);
}

/* Dark mode scrollbars for how-to-play */
body.dark-mode .how-to-play-content::-webkit-scrollbar-track {
    background: transparent;
}

body.dark-mode .how-to-play-content::-webkit-scrollbar-thumb {
    background: rgba(96, 197, 242, 0.25);
}

body.dark-mode .how-to-play-content::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 197, 242, 0.4);
}

/* Firefox scrollbar for how-to-play in dark mode */
body.dark-mode .how-to-play-content {
    scrollbar-color: rgba(96, 197, 242, 0.25) transparent;
}

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

/* Leaderboard responsive */
@media (max-width: 600px) {
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .rank-cell {
        width: 60px;
        font-size: 14px;
    }

    .games-cell {
        font-size: 11px;
    }
}

/* Achievements responsive */
@media (max-width: 768px) {
    .achievements-modal-content {
        max-width: 95%;
        padding: 25px 20px;
    }

    .achievements-list {
        grid-template-columns: 1fr;
    }

    /* Keep achievements horizontal like difficulty breakdown */
    .achievements-stats {
        gap: 10px;
    }

    .achievements-title {
        font-size: 22px;
    }

    .achievement-tab {
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* Profile responsive */
@media (max-width: 768px) {
    .profile-modal-content {
        max-width: 95%;
        padding: 15px 12px;
        margin: 10px auto;
    }

    .profile-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 12px;
        gap: 12px;
        margin-bottom: 15px;
    }

    .profile-avatar {
        font-size: 40px;
    }

    .profile-user-info h3 {
        font-size: 18px;
    }

    .profile-user-info p {
        font-size: 12px;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .profile-stat-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 24px;
    }

    .profile-section h3 {
        font-size: 18px;
    }

    /* Keep stat-box (achievements & difficulty) compact on mobile */
    .achievements-stats,
    .difficulty-breakdown {
        gap: 10px;
    }

    .stat-box {
        padding: 12px 8px;
    }

    .stat-box .stat-number {
        font-size: 28px;
    }

    .stat-box .stat-label {
        font-size: 12px;
    }

    /* Compact achievement items on tablets */
    .achievements-list {
        max-height: 300px;
        gap: 12px;
    }

    .achievement-item {
        padding: 14px;
    }

    .achievement-icon-wrapper {
        min-width: 42px;
        height: 42px;
        font-size: 21px;
    }

    .achievement-name {
        font-size: 14px;
    }

    .achievement-description {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr); /* Keep 2 columns for better space usage */
        gap: 10px;
    }

    .profile-stat-card {
        padding: 10px 6px; /* Reduce padding on very small screens */
        gap: 6px;
    }

    .profile-stat-card .stat-icon-value {
        gap: 6px;
    }

    .profile-stat-card i {
        font-size: 18px; /* Slightly smaller icons */
    }

    .stat-value {
        font-size: 20px; /* Slightly smaller values */
    }

    .profile-stat-card .stat-label {
        font-size: 11px; /* Slightly smaller labels */
    }

    /* Keep stat-box sections (difficulty & achievements) as 3 in a row on mobile */
    .difficulty-breakdown,
    .achievements-stats {
        gap: 8px;
    }

    .stat-box {
        flex: 1;
        min-width: 0; /* Allow boxes to shrink */
        padding: 10px 5px;
    }

    .stat-box .stat-label {
        font-size: 11px;
    }

    .stat-box .stat-number {
        font-size: 24px;
    }

    .stat-detail {
        font-size: 11px;
    }

    .difficulty-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    /* More compact recent games on mobile */
    .recent-games-list {
        height: 180px;
        min-height: 180px;
        max-height: 180px;
        gap: 5px;
    }

    .recent-game-item {
        padding: 6px 8px;
        gap: 8px;
        min-height: 45px;
    }

    .game-result-icon {
        font-size: 18px;
        width: 26px;
        height: 26px;
    }

    .difficulty-badge {
        font-size: 9px;
        padding: 2px 8px;
    }

    .game-stats-inline {
        font-size: 10px;
        gap: 8px;
    }

    /* Show only 5 recent games on mobile to reduce scrolling */
    .recent-games-list .recent-game-item:nth-child(n+6) {
        display: none;
    }

    .game-date {
        text-align: left;
    }

    /* Compact achievements on mobile - keep horizontal */
    .achievements-tabs {
        gap: 6px;
        flex-wrap: nowrap;
    }

    .achievement-tab {
        padding: 6px 15px;
        font-size: 12px;
    }

    .achievements-list {
        max-height: 280px;
        gap: 10px;
    }

    .achievement-item {
        padding: 12px;
        gap: 10px;
    }

    .achievement-icon-wrapper {
        min-width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .achievement-name {
        font-size: 14px;
    }

    .achievement-description {
        font-size: 11px;
    }

    .achievement-progress-bar {
        height: 5px;
    }

    .achievement-progress-text {
        font-size: 10px;
    }

    /* Compact profile header on very small screens */
    .profile-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .profile-header {
        padding: 10px;
        gap: 10px;
        margin-bottom: 12px;
    }

    .profile-avatar {
        font-size: 36px;
    }

    .profile-user-info h3 {
        font-size: 16px;
    }

    .profile-user-info p {
        font-size: 11px;
    }

    .profile-section h3 {
        font-size: 16px;
    }
}

/* Settings responsive */
@media (max-width: 768px) {
    .settings-modal-content {
        max-width: 95%;
        padding: 25px 20px;
        border-radius: 20px;
    }

    .settings-title {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .settings-section {
        gap: 8px;
    }

    .setting-item {
        padding: 15px 16px;
    }

    .setting-label {
        font-size: 14px;
        gap: 7px;
    }

    .setting-label i {
        font-size: 16px;
    }

    .setting-description {
        font-size: 11px;
    }

    .how-to-play-content {
        padding: 16px;
        max-height: 50vh;
    }

    .volume-slider {
        width: 130px;
    }
}

@media (max-width: 480px) {
    .settings-modal-content {
        padding: 20px 15px;
        border-radius: 18px;
    }

    .settings-title {
        font-size: 20px;
        margin-bottom: 18px;
    }

    .setting-item {
        padding: 12px 14px;
    }

    .setting-label {
        font-size: 13px;
    }

    .setting-label i {
        font-size: 15px;
    }

    .setting-description {
        font-size: 11px;
    }

    .toggle-btn {
        width: 44px;
        height: 44px;
        font-size: 17px;
    }

    .volume-control {
        gap: 8px;
    }

    .volume-slider {
        width: 110px;
    }

    .volume-percentage {
        font-size: 12px;
        min-width: 38px;
    }

    .how-to-play-content {
        padding: 14px;
        max-height: 45vh;
    }

    .coming-soon-badge {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* ==========================================
   NOTIFICATIONS SECTION
   ========================================== */

/* Notifications Content Container */
.notifications-content {
    background: rgba(78, 168, 222, 0.08);
    border-radius: 0 0 12px 12px;
    padding: 20px;
    margin-top: 0;
    border-top: 1px solid rgba(var(--primary-color-rgb), 0.15);
    animation: slideDown 0.3s ease-out;
}

/* Notification Item (Collapsible) */
.notification-item {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(var(--primary-color-rgb), 0.15);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.notification-item:last-child {
    margin-bottom: 0;
}

.notification-item:hover {
    border-color: rgba(var(--primary-color-rgb), 0.3);
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.1);
}

.notification-item.active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

/* Notification Header */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.notification-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-name {
    font-weight: 700;
    color: var(--text-color);
    font-size: 15px;
}

.notification-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.75em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.notification-arrow {
    color: var(--primary-color);
    transition: transform 0.3s ease;
    font-size: 14px;
}

.notification-item.active .notification-arrow {
    transform: rotate(180deg);
}

/* Notification List Container (Scrollable) */
.notification-list-container {
    border-top: 1px solid rgba(var(--primary-color-rgb), 0.1);
    background: rgba(255, 255, 255, 0.3);
    padding: 0 15px 12px 15px;
    animation: slideDown 0.3s ease-out;
}

.notification-list {
    max-height: 280px;
    overflow-y: auto;
}

/* Custom Scrollbar for Notification List */
.notification-list::-webkit-scrollbar {
    width: 8px;
}

.notification-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.notification-list::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-color-rgb), 0.3);
    border-radius: 4px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-color-rgb), 0.5);
}

/* Friend Request Item */
.friend-request-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(var(--primary-color-rgb), 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.friend-request-item:last-child {
    margin-bottom: 0;
}

.friend-request-item:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(var(--primary-color-rgb), 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(var(--primary-color-rgb), 0.1);
}

.friend-request-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.friend-request-username {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.friend-request-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.friend-request-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.friend-request-btn {
    padding: 6px 10px;
    min-width: 55px;
    min-height: 28px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.friend-request-btn.accept {
    background: var(--success-color);
    color: white;
}

.friend-request-btn.accept:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.friend-request-btn.decline {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.friend-request-btn.decline:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

/* Challenge Notification Item */
.challenge-notification-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(var(--primary-color-rgb), 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.challenge-notification-item:last-child {
    margin-bottom: 0;
}

.challenge-notification-item:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(var(--primary-color-rgb), 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(var(--primary-color-rgb), 0.1);
}

.challenge-notification-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.challenge-notification-username {
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.challenge-notification-details {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 6px;
    align-items: center;
}

.challenge-difficulty-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.challenge-difficulty-badge.easy {
    background: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
}

.challenge-difficulty-badge.medium {
    background: rgba(255, 193, 7, 0.2);
    color: #f57c00;
}

.challenge-difficulty-badge.hard {
    background: rgba(231, 76, 60, 0.2);
    color: #c62828;
}

.challenge-notification-time {
    font-size: 0.7em;
    color: var(--text-secondary);
}

.challenge-notification-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.challenge-notification-btn {
    padding: 6px 10px;
    min-width: 55px;
    min-height: 28px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.challenge-notification-btn.accept {
    background: var(--success-color);
    color: white;
}

.challenge-notification-btn.accept:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.challenge-notification-btn.decline {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.challenge-notification-btn.decline:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

/* Empty State */
.notification-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.notification-empty i {
    font-size: 2em;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Dark Mode Support */
body.dark-mode .notifications-content {
    background: rgba(96, 197, 242, 0.1);
}

body.dark-mode .notification-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .notification-item:hover {
    border-color: rgba(13, 148, 136, 0.4);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
}

body.dark-mode .notification-item.active {
    border-color: var(--primary-color);
    background: rgba(13, 148, 136, 0.08);
}

body.dark-mode .notification-list-container {
    border-top-color: rgba(13, 148, 136, 0.15);
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .notification-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .friend-request-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .friend-request-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(13, 148, 136, 0.4);
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}

body.dark-mode .friend-request-btn.decline {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .challenge-notification-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .challenge-notification-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(13, 148, 136, 0.4);
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}

body.dark-mode .challenge-notification-btn.decline {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .challenge-difficulty-badge.easy {
    background: rgba(76, 175, 80, 0.25);
    color: #66bb6a;
}

body.dark-mode .challenge-difficulty-badge.medium {
    background: rgba(255, 193, 7, 0.25);
    color: #ffb74d;
}

body.dark-mode .challenge-difficulty-badge.hard {
    background: rgba(231, 76, 60, 0.25);
    color: #ef5350;
}

/* Notifications responsive */
@media (max-width: 768px) {
    .notifications-modal-content {
        max-width: 95%;
        padding: 25px 20px;
        border-radius: 20px;
    }

    .notifications-modal-title {
        font-size: 22px;
        margin-bottom: 18px;
    }

    .notifications-modal-section {
        gap: 10px;
    }

    .notification-header {
        padding: 12px 14px;
    }

    .notification-icon {
        font-size: 18px;
    }

    .notification-name {
        font-size: 14px;
    }

    .notification-list {
        max-height: 250px;
    }

    .friend-request-item,
    .challenge-notification-item {
        padding: 10px;
    }

    .friend-request-username,
    .challenge-notification-username {
        font-size: 13px;
    }

    .friend-request-time {
        font-size: 11px;
    }

    .challenge-notification-details {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .notifications-modal-content {
        padding: 20px 15px;
        border-radius: 18px;
    }

    .notifications-modal-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .notifications-modal-section {
        gap: 8px;
    }

    .notification-item {
        margin-bottom: 6px;
    }

    .notification-header {
        padding: 10px 12px;
    }

    .notification-icon {
        font-size: 17px;
    }

    .notification-name {
        font-size: 13px;
    }

    .notification-badge {
        padding: 2px 6px;
        font-size: 11px;
        min-width: 18px;
    }

    .notification-list {
        max-height: 220px;
    }

    .notification-list-container {
        padding: 0 12px 10px 12px;
    }

    .friend-request-item,
    .challenge-notification-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .friend-request-username,
    .challenge-notification-username {
        font-size: 13px;
    }

    .friend-request-time {
        font-size: 10px;
    }

    .challenge-notification-details {
        font-size: 10px;
    }

    .challenge-difficulty-badge {
        padding: 1px 5px;
        font-size: 9px;
    }

    /* Compact buttons on mobile */
    .friend-request-btn,
    .challenge-notification-btn {
        padding: 6px 10px;
        min-width: 52px;
        min-height: 28px;
        font-size: 11px;
    }

    .friend-request-actions,
    .challenge-notification-actions {
        gap: 5px;
    }
}

/* ==========================================
   THEME TOGGLE IN SETTINGS (iOS-style Pill Slider)
   ========================================== */

.theme-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    flex-shrink: 0;
}

.theme-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background: var(--card-background);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.theme-toggle-slider:after {
    content: '☀️';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.theme-toggle-switch input:checked + .theme-toggle-slider {
    background: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 8px rgba(var(--primary-color-rgb), 0.3);
}

.theme-toggle-switch input:checked + .theme-toggle-slider:before {
    transform: translateX(30px);
    background: var(--card-background);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-toggle-switch input:checked + .theme-toggle-slider:after {
    content: '🌙';
    left: auto;
    right: 8px;
    opacity: 1;
}

.theme-toggle-switch input:focus + .theme-toggle-slider {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
}

/* Hover effect */
.theme-toggle-slider:hover {
    opacity: 0.9;
}

/* Dark mode adjustments */
body.dark-mode .theme-toggle-slider {
    background: var(--border-color);
}

body.dark-mode .theme-toggle-switch input:checked + .theme-toggle-slider {
    background: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 12px rgba(var(--primary-color-rgb), 0.4);
}

/* ==========================================
   GAMEPLAY PREFERENCES SECTION
   ========================================== */

.gameplay-setting-item {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.gameplay-setting-item:last-child {
    margin-bottom: 0;
}

.gameplay-setting-item:hover {
    background: var(--card-hover-background);
    border-color: var(--primary-color);
}

.gameplay-setting-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gameplay-setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.gameplay-setting-label i {
    color: var(--primary-color);
    font-size: 16px;
}

.gameplay-setting-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Gameplay Toggle Switch (matches theme toggle) */
.gameplay-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.gameplay-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gameplay-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e0e0e0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gameplay-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.gameplay-toggle-switch input:checked + .gameplay-toggle-slider {
    background: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 8px rgba(var(--primary-color-rgb), 0.3);
}

.gameplay-toggle-switch input:checked + .gameplay-toggle-slider:before {
    transform: translateX(24px);
}

.gameplay-toggle-switch input:focus + .gameplay-toggle-slider {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
}

.gameplay-toggle-slider:hover {
    opacity: 0.9;
}

/* Gameplay Select Dropdown */
.gameplay-select {
    padding: 8px 12px;
    border: 2px solid rgba(var(--primary-color-rgb), 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-width: 150px;
}

.gameplay-select:hover {
    border-color: rgba(var(--primary-color-rgb), 0.4);
    background: white;
}

.gameplay-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.15);
}

/* Dark mode support */
body.dark-mode .gameplay-setting-item {
    background: var(--input-background);
    border-color: var(--border-color);
}

body.dark-mode .gameplay-setting-item:hover {
    background: var(--card-hover-background);
    border-color: var(--primary-color);
}

body.dark-mode .gameplay-toggle-slider {
    background: #424242;
}

body.dark-mode .gameplay-toggle-switch input:checked + .gameplay-toggle-slider {
    background: var(--primary-color);
}

body.dark-mode .gameplay-select {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(13, 148, 136, 0.3);
    color: var(--text-color);
}

body.dark-mode .gameplay-select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(13, 148, 136, 0.5);
}

body.dark-mode .gameplay-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

/* ==========================================
   ACCOUNT MANAGEMENT SECTION
   ========================================== */

.account-setting-item {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.account-setting-item.clickable {
    cursor: pointer;
}

.account-setting-item.clickable:hover {
    background: var(--card-hover-background);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.account-setting-item.clickable:active {
    transform: translateY(0);
}

.account-setting-item.danger-zone {
    border-color: rgba(231, 76, 60, 0.3);
    background: rgba(231, 76, 60, 0.05);
}

.account-setting-item.danger-zone.clickable:hover {
    background: rgba(231, 76, 60, 0.08);
    border-color: rgba(231, 76, 60, 0.4);
}

.account-setting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-color);
}

.account-setting-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-setting-title i {
    color: var(--primary-color);
    font-size: 18px;
}

.danger-zone .account-setting-title i {
    color: var(--danger-color);
}

.account-form-content {
    padding-top: 15px;
    animation: slideDown 0.3s ease-out;
}

.account-form-content.danger-zone-content {
    background: rgba(231, 76, 60, 0.02);
    border-radius: 8px;
    padding: 15px;
    margin-top: 12px;
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-input {
    padding: 12px 15px;
    border: 2px solid rgba(var(--primary-color-rgb), 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
}

.account-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.account-input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.account-error {
    color: var(--danger-color);
    font-size: 13px;
    font-weight: 600;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.account-error:not(:empty)::before {
    content: '⚠️';
}

.account-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.account-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(var(--primary-color-rgb), 0.4);
}

.account-btn:active {
    transform: translateY(0);
}

.account-btn.danger-btn {
    background: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.account-btn.danger-btn:hover {
    background: #c0392b;
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.5);
}

.danger-warning {
    background: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--danger-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
}

/* Dark mode support */
body.dark-mode .account-setting-item {
    background: var(--input-background);
    border-color: var(--border-color);
}

body.dark-mode .account-setting-item.clickable:hover {
    background: var(--card-hover-background);
    border-color: var(--primary-color);
}

body.dark-mode .account-setting-item.danger-zone {
    border-color: rgba(231, 76, 60, 0.4);
    background: rgba(231, 76, 60, 0.08);
}

body.dark-mode .account-setting-item.danger-zone.clickable:hover {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.5);
}

body.dark-mode .account-form-content.danger-zone-content {
    background: rgba(231, 76, 60, 0.05);
}

body.dark-mode .account-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(13, 148, 136, 0.3);
    color: var(--text-color);
}

body.dark-mode .account-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

body.dark-mode .danger-warning {
    background: rgba(231, 76, 60, 0.15);
}

/* ==========================================
   NOTIFICATIONS MODAL
   ========================================== */

.notifications-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px 25px;
    border-radius: 25px;
}

.notifications-modal-title {
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 22px 0;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.notifications-modal-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Dark mode for notifications modal */
body.dark-mode .notifications-modal-title {
    color: var(--primary-color);
}
