/* ============================================
   학습자 모달 스타일 (Bootstrap 없음)
   순수 CSS 기반 모달 시스템
   ============================================ */

/* 모달 오버레이 */
.user-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.user-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 모달 컨테이너 */
.user-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.user-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 모달 다이얼로그 */
.user-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    margin: 20px;
}

.user-modal.show .user-modal-dialog {
    transform: scale(1);
}

/* 모달 크기 */
.user-modal-dialog.sm {
    max-width: 400px;
    width: 100%;
}

.user-modal-dialog.md {
    max-width: 600px;
    width: 100%;
}

.user-modal-dialog.lg {
    max-width: 900px;
    width: 100%;
}

.user-modal-dialog.xl {
    max-width: 1200px;
    width: 100%;
}

/* 모달 헤더 */
.user-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.user-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e1e1e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.user-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* 모달 바디 */
.user-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* 모달 푸터 */
.user-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* 버튼 스타일 */
.user-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.user-modal-btn-primary {
    background: #4b5563;
    color: white;
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.25);
}

.user-modal-btn-primary:hover {
    background: #374151;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(75, 85, 99, 0.35);
}

.user-modal-btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.user-modal-btn-secondary:hover {
    background: #e0e0e0;
}

.user-modal-btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.user-modal-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.user-modal-btn-success {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(81, 207, 102, 0.3);
}

.user-modal-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(81, 207, 102, 0.4);
}

/* 알림 모달 스타일 */
.user-modal-alert-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.user-modal-alert-icon.info {
    color: #4dabf7;
}

.user-modal-alert-icon.success {
    color: #51cf66;
}

.user-modal-alert-icon.warning {
    color: #ffd43b;
}

.user-modal-alert-icon.error,
.user-modal-alert-icon.danger {
    color: #ff6b6b;
}

.user-modal-alert-message {
    font-size: 16px;
    color: #495057;
    line-height: 1.6;
    margin: 0;
    text-align: center;
    white-space: pre-line; /* \n 줄바꿈 지원 */
}

/* 스피너 스타일 */
.user-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.user-spinner-overlay.show {
    opacity: 1;
    visibility: visible;
}

.user-spinner-container {
    text-align: center;
}

/* 원형 스피너 */
.user-spinner-circle {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: user-spinner-rotate 1s linear infinite;
    margin: 0 auto 16px;
}

.user-spinner-circle.sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

/* 점 스피너 */
.user-spinner-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 0 auto 16px;
}

.user-spinner-dots .dot {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: user-spinner-pulse 1.4s infinite ease-in-out both;
}

.user-spinner-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.user-spinner-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

/* 펄스 스피너 */
.user-spinner-pulse {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    animation: user-spinner-scale 1.2s infinite ease-in-out;
    margin: 0 auto 16px;
}

.user-spinner-text {
    color: white;
    font-size: 16px;
    font-weight: 500;
    margin-top: 8px;
}

/* 인라인 스피너 */
.user-spinner-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

/* 애니메이션 */
@keyframes user-spinner-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes user-spinner-pulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes user-spinner-scale {
    0%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 반응형: 모바일 */
@media (max-width: 768px) {
    .user-modal-dialog {
        margin: 10px;
        max-height: 95vh;
    }

    .user-modal-dialog.sm,
    .user-modal-dialog.md,
    .user-modal-dialog.lg,
    .user-modal-dialog.xl {
        max-width: 100%;
        width: calc(100% - 20px);
    }

    .user-modal-header {
        padding: 16px 20px;
    }

    .user-modal-title {
        font-size: 18px;
    }

    .user-modal-body {
        padding: 20px;
    }

    .user-modal-footer {
        padding: 12px 20px;
        flex-wrap: wrap;
    }

    .user-modal-btn {
        padding: 8px 16px;
        font-size: 14px;
        flex: 1;
        min-width: 0;
    }

    .user-modal-alert-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }

    .user-modal-alert-message {
        font-size: 14px;
    }
}

/* body에 모달이 열렸을 때 스크롤 방지 */
body.user-modal-open {
    overflow: hidden;
}

/* ============================================
   토스트 메시지 스타일
   ============================================ */

/* 토스트 컨테이너 (위치별) */
.user-toast-container {
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

/* 위치: 상단 */
.user-toast-container.top-left {
    top: 20px;
    left: 20px;
}

.user-toast-container.top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.user-toast-container.top-right {
    top: 20px;
    right: 20px;
}

/* 위치: 하단 */
.user-toast-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

.user-toast-container.bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.user-toast-container.bottom-right {
    bottom: 20px;
    right: 20px;
}

/* 토스트 메시지 */
.user-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid #4a90e2;
}

.user-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* 토스트 타입별 색상 */
.user-toast.info {
    border-left-color: #4a90e2;
}

.user-toast.success {
    border-left-color: #51cf66;
}

.user-toast.warning {
    border-left-color: #ffa94d;
}

.user-toast.error,
.user-toast.danger {
    border-left-color: #ff6b6b;
}

/* 토스트 아이콘 */
.user-toast-icon {
    flex-shrink: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-toast.info .user-toast-icon {
    color: #4a90e2;
}

.user-toast.success .user-toast-icon {
    color: #51cf66;
}

.user-toast.warning .user-toast-icon {
    color: #ffa94d;
}

.user-toast.error .user-toast-icon,
.user-toast.danger .user-toast-icon {
    color: #ff6b6b;
}

/* 토스트 메시지 텍스트 */
.user-toast-message {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    white-space: pre-line; /* \n을 줄바꿈으로 처리 */
}

/* 토스트 닫기 버튼 */
.user-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.user-toast-close:hover {
    color: #333;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .user-toast-container {
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
    }

    .user-toast {
        min-width: 0;
        max-width: 100%;
    }
}
