/* ==========================================
   실시간 알림 시스템 스타일
   ========================================== */

/* 벨 애니메이션 */
@keyframes bellRing {
    0% { transform: rotate(0); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

.bell-ring {
    animation: bellRing 1s ease-in-out;
    transform-origin: 50% 0;
}

/* 토스트 알림 */
.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    min-width: 350px;
    max-width: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    padding: 16px;
    z-index: 10000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toast-notification:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.toast-notification.slide-in {
    animation: slideInRight 0.3s ease-out;
}

.toast-notification.slide-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(110%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(110%);
        opacity: 0;
    }
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
    font-size: 18px;
}

.toast-icon.info {
    background: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
}

.toast-icon.success {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.toast-icon.warning {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.toast-icon.error {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.toast-icon.quote {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.toast-icon.customer {
    background: rgba(118, 75, 162, 0.15);
    color: #764ba2;
}

.toast-icon.template {
    background: rgba(32, 201, 151, 0.15);
    color: #20c997;
}

.toast-icon.system {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

.toast-content {
    flex: 1;
    margin-right: 12px;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* 연결 상태 표시기 */
.connection-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 9999;
    transition: all 0.3s ease;
}

.connection-indicator.connected {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
}

.connection-indicator.disconnected {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.connection-indicator.connecting {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 스택된 토스트 알림 */
.toast-notification:nth-child(2) {
    top: 160px;
}

.toast-notification:nth-child(3) {
    top: 240px;
}

.toast-notification:nth-child(4) {
    top: 320px;
}

/* 다크 모드 토스트 */
body.dark-mode .toast-notification {
    background: #1e293b;
    color: #f1f5f9;
}

body.dark-mode .toast-title {
    color: #f1f5f9;
}

body.dark-mode .toast-message {
    color: #cbd5e1;
}

body.dark-mode .toast-close {
    color: #64748b;
}

body.dark-mode .toast-close:hover {
    background: #334155;
    color: #f1f5f9;
}

/* 브라우저 알림 권한 요청 배너 */
.notification-permission-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.notification-permission-banner.show {
    transform: translateY(0);
}

.notification-permission-banner button {
    background: white;
    color: #667eea;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    margin-left: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-permission-banner button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 알림 사운드 컨트롤 */
.sound-control {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #6b7280;
}

.sound-control input[type="checkbox"] {
    margin-right: 6px;
}

/* 알림 뱃지 애니메이션 */
.notification-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 실시간 업데이트 인디케이터 */
.realtime-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: #10b981;
    margin-left: 8px;
}

.realtime-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 4px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* 타이핑 인디케이터 */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 20px;
    margin-left: 8px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #6b7280;
    border-radius: 50%;
    margin: 0 2px;
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* 실시간 카운터 업데이트 효과 */
.counter-update {
    animation: counterFlash 0.5s ease;
}

@keyframes counterFlash {
    0% {
        background: rgba(102, 126, 234, 0.2);
        transform: scale(1);
    }
    50% {
        background: rgba(102, 126, 234, 0.4);
        transform: scale(1.2);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}