/**
 * AI 요약 팝업 스타일
 * 경희대학교 브랜딩 기반 모던 디자인
 */

/* 경희대학교 브랜드 컬러 변수 */
:root {
    --khu-primary: #8B5092;
    --khu-primary-light: #B87BC0;
    --khu-primary-lighter: #E8D5ED;
    --khu-primary-dark: #6D3A74;
    --khu-secondary: #4A90E2;
    --khu-accent: #FF6B35;
    --khu-success: #52C41A;
    --khu-warning: #FAAD14;
    --khu-error: #FF4D4F;
    --khu-text-primary: #2C2C2C;
    --khu-text-secondary: #666666;
    --khu-text-light: #999999;
    --khu-background: #FFFFFF;
    --khu-background-light: #FAFBFC;
    --khu-surface: #F8F9FA;
    --khu-surface-light: #FFFFFF;
    --khu-border: #E8E8E8;
    --khu-border-light: #F0F0F0;
    --khu-shadow: 0 4px 20px rgba(139, 80, 146, 0.1);
    --khu-shadow-light: 0 2px 12px rgba(139, 80, 146, 0.05);
    --khu-shadow-hover: 0 6px 24px rgba(139, 80, 146, 0.15);
}

/* 팝업 오버레이 */
.ai-summary-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ai-summary-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 팝업 컨테이너 */
.ai-summary-popup {
    background: var(--khu-background);
    border-radius: 20px;
    box-shadow: var(--khu-shadow);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.ai-summary-overlay.show .ai-summary-popup {
    transform: translateY(0);
}

/* 팝업 헤더 */
.ai-summary-header {
    background: linear-gradient(135deg, var(--khu-primary) 0%, var(--khu-primary-light) 100%);
    color: white;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
    position: relative;
}

.ai-summary-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

.ai-summary-title {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.ai-summary-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.ai-summary-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.ai-summary-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.ai-summary-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* 팝업 바디 */
.ai-summary-body {
    padding: 28px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

/* 로딩 상태 */
.ai-summary-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.ai-summary-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--khu-border-light);
    border-top: 4px solid var(--khu-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-summary-loading-text {
    color: var(--khu-text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.ai-summary-loading-subtext {
    color: var(--khu-text-light);
    font-size: 12px;
}

/* 요약 콘텐츠 */
.ai-summary-content {
    animation: fadeInUp 0.5s ease-out;
}

.ai-summary-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--khu-surface);
    border-radius: 12px;
    border-left: 4px solid var(--khu-primary);
}

.ai-summary-badge {
    background: var(--khu-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-summary-date {
    color: var(--khu-text-secondary);
    font-size: 13px;
}

.ai-summary-text {
    line-height: 1.7;
    color: var(--khu-text-primary);
    font-size: 15px;
    white-space: pre-wrap;
    word-break: keep-all;
    margin-bottom: 24px;
}

/* 에러 상태 */
.ai-summary-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.ai-summary-error-icon {
    width: 64px;
    height: 64px;
    background: var(--khu-error);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.ai-summary-error-title {
    color: var(--khu-error);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ai-summary-error-message {
    color: var(--khu-text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

/* 액션 버튼 */
.ai-summary-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--khu-border-light);
}

.ai-summary-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-summary-btn-secondary {
    background: var(--khu-surface);
    color: var(--khu-text-secondary);
    border: 1px solid var(--khu-border);
}

.ai-summary-btn-secondary:hover {
    background: var(--khu-border-light);
    color: var(--khu-text-primary);
}

.ai-summary-btn-primary {
    background: var(--khu-primary);
    color: white;
}

.ai-summary-btn-primary:hover {
    background: var(--khu-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--khu-shadow-light);
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .ai-summary-popup {
        width: 95%;
        max-width: none;
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .ai-summary-header {
        padding: 20px 24px;
    }
    
    .ai-summary-title h3 {
        font-size: 16px;
    }
    
    .ai-summary-body {
        padding: 24px 20px;
    }
    
    .ai-summary-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ai-summary-actions {
        flex-direction: column-reverse;
    }
    
    .ai-summary-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .ai-summary-popup {
        width: calc(100% - 20px);
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 16px;
    }
    
    .ai-summary-header {
        padding: 16px 20px;
        border-radius: 16px 16px 0 0;
    }
    
    .ai-summary-body {
        padding: 20px 16px;
    }
    
    .ai-summary-text {
        font-size: 14px;
    }
}

/* 스크롤바 스타일 */
.ai-summary-body::-webkit-scrollbar {
    width: 6px;
}

.ai-summary-body::-webkit-scrollbar-track {
    background: var(--khu-surface);
    border-radius: 3px;
}

.ai-summary-body::-webkit-scrollbar-thumb {
    background: var(--khu-border);
    border-radius: 3px;
}

.ai-summary-body::-webkit-scrollbar-thumb:hover {
    background: var(--khu-text-light);
}

/* 접근성 개선 */
.ai-summary-overlay[aria-hidden="true"] {
    display: none;
}

.ai-summary-popup {
    outline: none;
}

.ai-summary-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* 다크모드 대응 (필요시) */
@media (prefers-color-scheme: dark) {
    .ai-summary-popup {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .ai-summary-body {
        background: #1a1a1a;
    }
    
    .ai-summary-text {
        color: #e0e0e0;
    }
}
