/* static/css/notifications.css */

.btn-notification {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger-color);
    color: white;
    font-size: 8px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 13px;
    height: 13px;
    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-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    visibility: hidden;
    opacity: 0;
    transition: all var(--transition-medium);
}

.notification-panel.active {
    visibility: visible;
    opacity: 1;
}

.notification-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.notification-panel-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-light);
    transform: translateX(100%);
    transition: transform var(--transition-medium) cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

.notification-panel.active .notification-panel-content {
    transform: translateX(0);
}

/* GSAP 제어 시 CSS 전환 비활성화 */
.notification-panel-content.gsap-controlled {
    transition: none !important;
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.notification-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.notification-panel-title ion-icon {
    font-size: 20px;
    color: var(--primary-color);
}

.notification-panel-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--radius-small);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.btn-icon ion-icon {
    font-size: 18px;
}

.notification-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.notification-panel-body::-webkit-scrollbar {
    width: 4px;
}

.notification-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.notification-panel-body::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-small);
}

.notification-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    gap: 12px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.notification-empty h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.notification-empty p {
    font-size: 14px;
    line-height: 1.5;
}

.notification-list {
    padding: 0 20px;
}

.notification-item {
    display: flex;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    position: relative;
    transition: background-color var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-secondary);
    margin: 0 -20px;
    padding: 16px 20px;
    border-radius: var(--radius-medium);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(255, 154, 154, 0.05);
}

.notification-item.unread::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 0 2px 2px 0;
}

.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.notification-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notification-avatar ion-icon {
    font-size: 20px;
    color: var(--text-light);
}

.notification-type-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid var(--bg-primary);
}

.notification-content {
    flex: 1;
    min-width: 0;
    margin-right: 40px;
}

.notification-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.notification-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 6px;
}

.notification-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.notification-time {
    font-size: 12px;
    color: var(--text-light);
}

.notification-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.notification-action-btn {
    background: none;
    border: none;
    padding: 4px;
    border-radius: var(--radius-small);
    color: var(--text-light);
    cursor: pointer;
    font-size: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.notification-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.notification-action-btn ion-icon {
    font-size: 14px;
}

.notification-item[data-type="follow_request"] .notification-type-icon {
    background: var(--accent-color);
}

.notification-item[data-type="follow_accepted"] .notification-type-icon {
    background: var(--secondary-color);
}

.notification-item[data-type="emoji_received"] .notification-type-icon {
    background: var(--primary-color);
}

.notification-item[data-type="post_liked"] .notification-type-icon {
    background: #e74c3c;
}

.notification-item[data-type="post_commented"] .notification-type-icon {
    background: #3498db;
}

.notification-item[data-type="routine_reminder"] .notification-type-icon {
    background: #f39c12;
}

.notification-item[data-type="achievement_unlocked"] .notification-type-icon {
    background: #9b59b6;
}

.notification-item[data-type="system_notification"] .notification-type-icon {
    background: #95a5a6;
}

.notification-panel-footer {
    display: flex;
    padding: 0;
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: relative;
}

.notification-panel-footer .btn {
    flex: 1;
    margin: 0;
    border-radius: 0;
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    position: relative;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.notification-panel-footer .btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.notification-panel-footer .btn:active {
    background: var(--active-bg);
}

.notification-panel-footer .btn ion-icon {
    font-size: 14px;
    color: inherit;
    flex-shrink: 0;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    .notification-panel-content {
        width: 100vw;
        max-width: 380px;
    }
}

@media (max-width: 480px) {
    .notification-panel-content {
        width: 100vw;
        max-width: none;
    }
    
    .notification-panel-header {
        padding: 16px;
    }
    
    .notification-list {
        padding: 0 16px;
    }
    
    .notification-item:hover {
        margin: 0 -16px;
        padding: 16px;
    }
    
    .notification-panel-footer {
        padding: 0;
    }
    
    .notification-panel-footer .btn {
        padding: 14px 16px;
        font-size: 12px;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-panel.show .notification-panel-content {
    animation: slideInRight 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.notification-panel.hide .notification-panel-content {
    animation: slideOutRight 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.notification-item.new {
    animation: highlightNew 3s ease-in-out;
}

@keyframes highlightNew {
    0% {
        background: rgba(255, 154, 154, 0.2);
        transform: scale(1.02);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}

.notification-item.removing {
    animation: slideOut 0.3s ease-in-out forwards;
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: translateX(0);
        max-height: 100px;
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

.notification-item.bulk-removing {
    animation: bulkSlideOut 0.4s ease-in-out forwards;
}

@keyframes bulkSlideOut {
    0% {
        opacity: 1;
        transform: translateX(0);
        max-height: 100px;
    }
    50% {
        opacity: 0.5;
        transform: translateX(50%);
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
        max-height: 0;
        padding: 0;
        margin: 0;
        border-bottom-width: 0;
    }
}

@media (prefers-color-scheme: dark) {
    .notification-panel-content {
        background: #1a1a1a;
        border-left-color: #333;
    }
    
    .notification-panel-header,
    .notification-panel-footer {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .notification-item.unread {
        background: rgba(255, 154, 154, 0.1);
    }
    
    .notification-item:hover {
        background: #2a2a2a;
    }
}