Files
gamercomp/frontend/src/components/NotificationBell.css
T
2026-04-30 02:14:25 +00:00

353 lines
5.7 KiB
CSS

.notification-bell {
position: relative;
}
.bell-button {
background: none;
border: none;
padding: 0.5rem;
cursor: pointer;
position: relative;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: background 0.2s;
}
.bell-button:hover {
background: rgba(0, 0, 0, 0.05);
}
.bell-icon {
font-size: 1.25rem;
}
.bell-button.has-unread .bell-icon {
animation: ring 0.5s ease-in-out;
}
@keyframes ring {
0%, 100% { transform: rotate(0); }
25% { transform: rotate(15deg); }
50% { transform: rotate(-15deg); }
75% { transform: rotate(10deg); }
}
.unread-badge {
position: absolute;
top: 0;
right: 0;
background: #ef4444;
color: white;
font-size: 0.65rem;
font-weight: 600;
min-width: 16px;
height: 16px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 4px;
}
.notification-dropdown {
position: absolute;
top: calc(100% + 8px);
right: 0;
width: 320px;
max-height: 420px;
background: white;
border-radius: 0.75rem;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
z-index: 1000;
overflow: hidden;
display: flex;
flex-direction: column;
}
.dropdown-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
border-bottom: 1px solid #e2e8f0;
}
.dropdown-header h3 {
margin: 0;
font-size: 0.95rem;
color: #1e293b;
}
.mark-all-read {
background: none;
border: none;
color: #6366f1;
font-size: 0.8rem;
cursor: pointer;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
}
.mark-all-read:hover {
background: #f0f0ff;
}
.mark-all-read:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.notification-list {
flex: 1;
overflow-y: auto;
}
.empty-notifications {
padding: 2rem;
text-align: center;
color: #64748b;
}
.empty-icon {
font-size: 2.5rem;
display: block;
margin-bottom: 0.5rem;
}
.empty-notifications p {
margin: 0;
}
.notification-item {
display: flex;
gap: 0.75rem;
padding: 0.875rem 1rem;
cursor: pointer;
transition: background 0.2s;
position: relative;
border-bottom: 1px solid #f1f5f9;
}
.notification-item:hover {
background: #f8fafc;
}
.notification-item.unread {
background: #faf5ff;
}
.notification-item.unread:hover {
background: #f5f3ff;
}
.notification-icon {
font-size: 1.5rem;
flex-shrink: 0;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
background: #f1f5f9;
border-radius: 50%;
}
.notification-item.unread .notification-icon {
background: #e9d5ff;
}
.notification-content {
flex: 1;
min-width: 0;
}
.notification-title {
margin: 0 0 0.25rem;
font-size: 0.9rem;
font-weight: 500;
color: #1e293b;
}
.notification-body {
margin: 0 0 0.25rem;
font-size: 0.8rem;
color: #64748b;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.notification-time {
font-size: 0.7rem;
color: #94a3b8;
}
.unread-dot {
position: absolute;
top: 50%;
right: 12px;
transform: translateY(-50%);
width: 8px;
height: 8px;
background: #6366f1;
border-radius: 50%;
}
.dropdown-footer {
padding: 0.75rem 1rem;
text-align: center;
border-top: 1px solid #e2e8f0;
background: #f8fafc;
}
.dropdown-footer a {
color: #6366f1;
font-size: 0.85rem;
text-decoration: none;
}
.dropdown-footer a:hover {
text-decoration: underline;
}
/* Mobile responsive */
@media (max-width: 640px) {
.notification-dropdown {
position: fixed;
top: 60px;
left: 0;
right: 0;
width: 100%;
max-height: calc(100vh - 60px);
border-radius: 0;
}
}
/* Ultra-narrow screens (Galaxy Fold outer, small phones) */
@media (max-width: 360px) {
.bell-button {
min-width: 36px;
min-height: 36px;
width: 36px;
height: 36px;
padding: 0.4rem;
}
.bell-icon {
font-size: 1.1rem;
}
.unread-badge {
min-width: 14px;
height: 14px;
font-size: 0.6rem;
top: -2px;
right: -2px;
}
.notification-dropdown {
top: 52px;
max-height: calc(100vh - 52px);
}
}
/* Touch-friendly styles */
@media (hover: none), (pointer: coarse) {
.bell-button {
min-width: 44px;
min-height: 44px;
padding: 0.625rem;
}
.bell-icon {
font-size: 1.5rem;
}
.mark-all-read {
min-height: 36px;
padding: 0.5rem 0.75rem;
font-size: 0.85rem;
}
.notification-item {
min-height: 60px;
padding: 1rem;
}
.dropdown-footer a {
display: inline-block;
min-height: 44px;
padding: 0.75rem 1rem;
line-height: 1.5;
}
}
/* Active states for touch devices */
@media (hover: none) {
.bell-button:active {
background: rgba(0, 0, 0, 0.1);
transform: scale(0.95);
}
.mark-all-read:active:not(:disabled) {
background: #ddd6fe;
transform: scale(0.98);
}
.notification-item:active {
background: #f1f5f9;
transform: scale(0.99);
}
.notification-item.unread:active {
background: #ede9fe;
}
.dropdown-footer a:active {
color: #4338ca;
background: #f1f5f9;
}
/* Disable iOS tap highlight */
.bell-button,
.mark-all-read,
.notification-item,
.dropdown-footer a {
-webkit-tap-highlight-color: transparent;
}
}
/* Hover-only styles for desktop */
@media (hover: hover) {
.bell-button:hover {
background: rgba(0, 0, 0, 0.05);
}
.mark-all-read:hover {
background: #f0f0ff;
}
.notification-item:hover {
background: #f8fafc;
}
.notification-item.unread:hover {
background: #f5f3ff;
}
.dropdown-footer a:hover {
text-decoration: underline;
}
}
/* Focus states for accessibility */
.bell-button:focus-visible,
.mark-all-read:focus-visible,
.notification-item:focus-visible,
.dropdown-footer a:focus-visible {
outline: 3px solid #6366f1;
outline-offset: 2px;
}