/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    max-width: 100%;
    margin: 0 auto;
}

.nav-logo {
    color: black;
    font-size: 1.25rem;
    font-weight: bold;
    text-decoration: none;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.nav-logo:hover {
    transform: scale(1.05);
}

.logo-text {
    font-size: 1.3rem; 
    font-weight: bold;
    background: linear-gradient(to right, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    left: 2px;
    transition: all 0.3s ease;
}

.logo-text:hover {
    text-shadow: 0 0 10px rgba(79, 70, 229, 0.4);
}

.logo-text2 {
    font-size: 1.3rem; 
    font-weight: bold;
    background: linear-gradient(to right, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Navigation menu styles */
.nav-menu {
    display: flex;
    justify-content:space-evenly;
    align-items: center;
    list-style: none;
    transition: transform 0.3s ease-in-out;
}

@media screen and (min-width: 1080px) {
    .nav-menu {
        display: none;
    }

}

@media screen and (max-width: 1080px) {
    .nav-menu {
        display: flex;
        justify-content: center;
        align-items: center;
        list-style: none;
        transition: transform 0.3s ease-in-out;
    }
    

}


@media (max-width: 1080px) {
    .nav-link {
        padding: 2rem 1.5rem;
        border-radius: 8px;
        opacity: 0.9;
        color: #f4f4f4;
        display: flex;
        font-size: 3.5rem;
        align-items: center;
        gap: 0.75rem;
        margin: 0 1rem;
        width: 85%;
        max-width: 320px;
        transition: all 0.2s ease;
    }
}

.nav-item {
    position: relative;
}



.nav-link:hover, 
.nav-link:active,
.nav-link.active-link {
    background-color: rgba(255, 255, 255, 0.1);
    color: #4F46E5;
    opacity: 1;
}

.nav-link.active-link::after {
    content: '';
    position: absolute;
    bottom: 0.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 30%;
    height: 3px;
    background: linear-gradient(to right, #4f46e5, #9333ea);
    border-radius: 3px;
}

.nav-icon {
    display: none;
}

/* Accessibility button styles */
.accessibility-btn {
    display: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.5rem;
    background: none;
    border: none;
    color: black;
    transition: transform 0.3s ease;
}

.accessibility-btn:hover {
    /* transform: scale(1.05); */
}

.accessibility-icon {
    width: 24px;
    height: 24px;
    /* transition: all 0.3s ease; */
}

.accessibility-btn:hover .accessibility-icon {
    /* stroke: #4f46e5; */
}

/* Mobile styles */
@media (max-width: 1080px) {
    /* Prevent mobile UI stretching */
    html {
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }
    
    body {
        height: 100vh;
        max-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
    }

    .accessibility-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0.5rem;
    }

    .mobile-navbar .accessibility-btn {
        width: 100%;
        height: 100%;
    }

    .mobile-navbar .accessibility-btn .accessibility-icon {
        width: 1.5rem;
        height: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .mobile-navbar .accessibility-btn span {
        font-size: 0.75rem;
        line-height: 1;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        gap: 0;
        flex-direction: column;
        background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        text-align: center;
        transition: all 0.3s ease-in-out;
        padding: 5rem 0 7rem 0;
        padding-top: max(5rem, env(safe-area-inset-top, 5rem));
        z-index: 9999;
        box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        overflow-x: hidden;
        /* Prevent mobile UI stretching */
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
        /* Removed smooth scrolling */
    }

    .nav-menu.active {
        left: 0;
        transform: translateX(0);
    }

    .close-menu-btn {
        position: absolute;
        top: 1rem;
        right: 1rem;
        z-index: 10000;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        width: 2.5rem;
        height: 2.5rem;
        background-color: rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }

    .close-menu-btn:hover {
        background-color: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }

    .close-icon {
        width: 1.5rem;
        height: 1.5rem;
        color: #f4f4f4;
    }

    .close-menu-btn.hidden {
        display: none;
    }

    .nav-menu.active .close-menu-btn.hidden {
        display: flex;
    }

    .nav-item {
        width: 100%;
        margin: 0.5rem 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        border-radius: 8px;
        opacity: 0.9;
        color: #f4f4f4;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin: 0 1rem;
        width: 85%;
        max-width: 320px;
        transition: all 0.2s ease;
        touch-action: manipulation; /* Improve touch response */
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    }

    .nav-link:hover, 
    .nav-link:active,
    .nav-link.active-link {
        background-color: rgba(255, 255, 255, 0.15);
        color: white;
        transform: scale(1.02);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .nav-link:focus {
        outline: 2px solid rgba(255, 255, 255, 0.5);
        outline-offset: 2px;
    }

    .nav-link:focus:not(:focus-visible) {
        outline: none;
    }

    .nav-link:focus-visible {
        outline: 2px solid rgba(255, 255, 255, 0.5);
        outline-offset: 2px;
    }

    .nav-icon {
        display: inline-block;
        width: 1.25rem;
        height: 1.25rem;
    }

    .nav-link:hover .nav-icon {
        transform: scale(1.1);
    }

    .nav-menu::-webkit-scrollbar {
        width: 8px;
    }

    .nav-menu::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 4px;
    }

    .nav-menu::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

    .nav-menu::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

.refresh-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

.refresh-button svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Responsive button padding for smaller devices */
@media (max-width: 768px) {
    .refresh-button {
        padding: 0.375rem;
    }
}

@media (max-width: 480px) {
    .refresh-button {
        padding: 0.25rem;
    }
}

/* Add notification styles at the end of the file */

/* Notification Icon Styles */
.notification-item {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Notification Modal Styles */
.notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.notification-modal-content {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.notification-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.notification-modal-body {
    padding: 1rem;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.notification-item.unread {
    background-color: #F3F4F6;
}

.notification-item:hover {
    background-color: #F9FAFB;
}

.notification-item.unread:hover {
    background-color: #EFF6FF;
}

.unread-indicator {
    position: absolute;
    top: 1rem;
    left: 0.5rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}

.notification-title {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.notification-message {
    margin: 0;
    color: #4B5563;
    font-size: 0.875rem;
}

.notification-time {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6B7280;
}

.empty-notifications {
    text-align: center;
    padding: 2rem 1rem;
    color: #6B7280;
}

/* Pulse Animation */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* History Button Styles */
.history-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.history-button:hover {
    background-color: rgba(79, 70, 229, 0.1);
    transform: scale(1.05);
}

.history-button svg {
    width: 1.5rem;
    height: 1.5rem;
    transition: all 0.3s ease;
}

/* Responsive button padding for smaller devices */
@media (max-width: 768px) {
    .history-button {
        padding: 0.375rem;
    }
}

@media (max-width: 480px) {
    .history-button {
        padding: 0.25rem;
    }
}

/* History Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* Enhanced mobile responsiveness for history modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }
    
    /* History cards mobile optimization */
    #modalHistoryBody {
        max-height: 60vh;
    }
    
    #modalHistoryBody .bg-white {
        padding: 1rem;
    }
    
    #modalHistoryBody .flex-col {
        gap: 0.75rem;
    }
    
    #modalHistoryBody .text-sm {
        font-size: 0.875rem;
    }
    
    #modalHistoryBody .text-xs {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        padding: 1rem;
        max-height: 90vh;
    }
    
    #modalHistoryBody {
        max-height: 65vh;
    }
    
    #modalHistoryBody .bg-white {
        padding: 0.75rem;
    }
    
    #modalHistoryBody .flex-col {
        gap: 0.5rem;
    }
    
    #modalHistoryBody .text-sm {
        font-size: 0.8rem;
    }
    
    #modalHistoryBody .text-xs {
        font-size: 0.7rem;
    }
    
    /* Optimize button sizes for mobile */
    #modalHistoryBody button {
        padding: 0.5rem 0.75rem;
        font-size: 0.7rem;
    }
}

/* Enhanced delete button styles */
.delete-btn {
    position: relative;
    overflow: hidden;
}

/* User stats modal button styles */
.leaderboard-username-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-username-btn:hover {
    color: #4F46E5;
    text-decoration: underline;
    transform: translateY(-1px);
}

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

/* Enhanced user stats modal styles */
#userStatsModal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#userStatsModal .modal-content::-webkit-scrollbar {
    width: 6px;
}

#userStatsModal .modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#userStatsModal .modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#userStatsModal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Fullscreen modal styles */
.modal-content-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.modal-content-fullscreen::-webkit-scrollbar {
    width: 6px;
}

.modal-content-fullscreen::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.modal-content-fullscreen::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.modal-content-fullscreen::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Fullscreen modal header */
.modal-content-fullscreen .sticky {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
    margin-bottom: 0;
}

/* Fullscreen modal body */
.modal-content-fullscreen #userStatsModalBody {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Mobile optimizations for fullscreen */
@media (max-width: 640px) {
    .modal-content-fullscreen {
        padding: 0;
    }
    
    .modal-content-fullscreen .sticky {
        padding: 0.75rem 0;
    }
    
    .modal-content-fullscreen #userStatsModalBody {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .modal-content-fullscreen .sticky {
        padding: 0.5rem 0;
    }
    
    .modal-content-fullscreen #userStatsModalBody {
        padding: 0.5rem;
    }
}

/* Enhanced card hover effects */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Mobile optimizations for fullscreen modal */
@media (max-width: 640px) {
    .modal-content-fullscreen h3 {
        font-size: 1.25rem;
    }
    
    .modal-content-fullscreen .stat-card {
        padding: 0.75rem;
    }
    
    .modal-content-fullscreen .grid {
        gap: 0.5rem;
    }
    
    /* History modal specific optimizations */
    #historyModal .modal-content-fullscreen .sticky {
        padding: 0.75rem 0;
    }
    
    #historyModal .modal-content-fullscreen #modalHistoryBody {
        padding: 0.75rem;
    }
    
    #historyModal .modal-content-fullscreen .flex-col {
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .modal-content-fullscreen h3 {
        font-size: 1.125rem;
    }
    
    .modal-content-fullscreen .grid {
        gap: 0.25rem;
    }
    
    /* History modal specific optimizations */
    #historyModal .modal-content-fullscreen .sticky {
        padding: 0.5rem 0;
    }
    
    #historyModal .modal-content-fullscreen #modalHistoryBody {
        padding: 0.5rem;
    }
    
    #historyModal .modal-content-fullscreen .flex-col {
        gap: 0.5rem;
    }
    
    #historyModal .modal-content-fullscreen input {
        font-size: 0.875rem;
    }
    
    #historyModal .modal-content-fullscreen button {
        padding: 0.5rem;
    }
}

.delete-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.delete-btn:hover::before {
    left: 100%;
}

/* Custom alert container styles */
#custom-alert-container {
    backdrop-filter: blur(4px);
}

.custom-alert-box {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Button hover effects */
.group:hover .group-hover\:rotate-12 {
    transform: rotate(12deg);
}

.group:hover .group-hover\:scale-105 {
    transform: scale(1.05);
}

.group:active .active\:scale-95 {
    transform: scale(0.95);
}

/* Notification Button Styles */
.notification-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    margin-right: 0.5rem;
}

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

.notification-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Navbar Buttons Container */
.navbar-buttons {
    display: flex;
    align-items: center;
    gap: 1px; /* or even 1px for ultra-compact */
}

/* Minimal button padding for compact navbar */
.notification-btn,
.history-button,
.refresh-button {
    padding: 0.15rem;
}

/* Remove previous responsive gap/padding rules if present */
@media (max-width: 768px) {
    .navbar-buttons {
        gap: 1px;
    }
    .notification-btn,
    .history-button,
    .refresh-button {
        padding: 0.15rem;
    }
}
@media (max-width: 480px) {
    .navbar-buttons {
        gap: 1px;
    }
    .notification-btn,
    .history-button,
    .refresh-button {
        padding: 0.15rem;
    }
}

.notification-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.notification-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Notification delete button styles */
.notification-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #9CA3AF;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.notification-delete-btn:hover {
    color: #EF4444;
    opacity: 1;
    background-color: rgba(239, 68, 68, 0.1);
}

.notification-delete-btn svg {
    width: 16px;
    height: 16px;
}

/* Delete All button styles */
.delete-all-btn {
    background: none;
    border: none;
    font-size: 0.875rem;
    color: #EF4444;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.delete-all-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Mobile bottom navbar styles */
.mobile-navbar {
    display: none;
}

@media (max-width: 1080px) {
    .mobile-navbar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        /* Prevent mobile UI stretching */
        overscroll-behavior: none;
        touch-action: manipulation;
    }
    
    .mobile-navbar .nav-item {
        color: #6B7280;
        transition: all 0.3s ease;
    }
    
    .mobile-navbar .nav-item.active {
        color: #4F46E5;
    }
    
    .mobile-navbar .nav-item.active svg {
        stroke: url(#refreshGradient);
        fill: none;
    }
    
    .mobile-navbar .nav-item span {
        transition: all 0.3s ease;
    }
    
    .mobile-navbar .nav-item.active span {
        font-weight: 500;
        color: #4F46E5;
    }
}