/* 에듀플렉스 숙제관리 프론트엔드 커스텀 스타일 */

.eduplex-hw-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

/* 모달 애니메이션 */
#eduplex-hw-modal {
    transition: opacity 0.3s ease-out;
}

#eduplex-modal-container {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 과목 선택 라디오 UI */
#subject-selector-grid label input[type="radio"]:checked + span {
    color: #1d4ed8;
}
#subject-selector-grid label:has(input[type="radio"]:checked) {
    background-color: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#subject-selector-grid label.selected-subject {
    background-color: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* 단계 표시 바 */
.step-indicator-item span,
.step-indicator-item.active span,
#eduplex-step-indicator span,
#eduplex-step-indicator .step-indicator-item span,
#eduplex-step-indicator .step-indicator-item.active span {
    transition: all 0.3s ease !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    outline: none !important;
    border: none !important;
}

/* 테이블 스크롤바 감춤 */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ============================================================
   [신규] Pull-to-Refresh Indicator
   ============================================================ */
.eduplex-pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: transparent;
    z-index: 10;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.eduplex-pull-to-refresh.eduplex-pull-ready,
.eduplex-pull-to-refresh.eduplex-pull-refreshing {
    opacity: 1;
}

.eduplex-pull-spinner {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    color: #3b82f6;
    font-size: 14px;
    transition: all 0.2s ease;
}

.eduplex-pull-ready .eduplex-pull-spinner {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.eduplex-pull-refreshing .eduplex-pull-spinner {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.eduplex-pull-text {
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    margin-top: 4px;
    letter-spacing: -0.3px;
}

.eduplex-pull-ready .eduplex-pull-text {
    color: #22c55e;
}

.eduplex-pull-refreshing .eduplex-pull-text {
    color: #3b82f6;
}

/* 컨테이너 위치 기준 */
.eduplex-hw-container {
    position: relative !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* ============================================================
   [신규] 촬영 이미지 썸네일 그리드
   ============================================================ */
.eduplex-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.eduplex-photo-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.15s ease;
}

.eduplex-photo-item:hover {
    transform: scale(1.03);
}

.eduplex-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.eduplex-remove-photo-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    border: 2px solid white;
    transition: background-color 0.15s ease;
    z-index: 5;
}

.eduplex-remove-photo-btn:hover {
    background-color: #dc2626;
}

/* 촬영 사진 영역 */
.eduplex-captured-photos-area {
    transition: all 0.3s ease;
}

/* ============================================================
   [신규] 촬영 이미지 확대 모달
   ============================================================ */
#eduplex-captured-preview-modal {
    transition: opacity 0.2s ease;
    z-index: 100001 !important;
}

/* ============================================================
   [신규] 슬라이드 이미지 뷰어 모달
   ============================================================ */
#eduplex-slide-viewer-modal {
    transition: opacity 0.2s ease;
    z-index: 100001 !important;
}

#eduplex-slide-image {
    user-select: none;
    -webkit-user-drag: none;
}

.slide-thumb-item {
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.slide-thumb-item:hover {
    opacity: 1 !important;
    transform: scale(1.05);
}

/* 하단 썸네일 스트립 스크롤 */
#eduplex-slide-thumbnails {
    scroll-behavior: smooth;
}

/* ============================================================
   이미지 뷰어 모달 스타일 (기존)
   ============================================================ */
#eduplex-image-viewer-modal {
    transition: opacity 0.2s ease;
}

#eduplex-viewer-image {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
}

/* 이미지 미리보기 모달 (업로드 전) */
#eduplex-image-preview-modal {
    transition: opacity 0.2s ease;
}

/* 이미지 미리보기 미니 (매니저 목록용) */
.eduplex-image-thumb-mini {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.eduplex-image-thumb-mini:hover {
    transform: scale(1.15);
}

/* ============================================================
   알림 영역 스타일
   ============================================================ */
.eduplex-notif-item {
    transition: background-color 0.15s ease;
}

.eduplex-notif-item:hover {
    background-color: #fefce8 !important;
}

.eduplex-notif-read-btn {
    transition: color 0.15s ease;
}

.eduplex-notif-read-btn:hover {
    color: #16a34a !important;
}

/* ============================================================
   iOS PWA 가이드
   ============================================================ */
#eduplex-ios-guide-modal {
    transition: opacity 0.3s ease-out;
}
.ios-safari-guide-container {
    animation: slideUpPopup 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpPopup {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ============================================================
   독립 포털 스타일링
   ============================================================ */
body.eduplex-portal-active {
    background-color: #f3f4f6 !important;
    overflow: hidden !important;
}

body.eduplex-portal-active header,
body.eduplex-portal-active footer,
body.eduplex-portal-active .header,
body.eduplex-portal-active .footer,
body.eduplex-portal-active #header,
body.eduplex-portal-active #footer,
body.eduplex-portal-active .navigation,
body.eduplex-portal-active .sidebar,
body.eduplex-portal-active #sidebar,
body.eduplex-portal-active .site-header,
body.eduplex-portal-active .site-footer,
body.eduplex-portal-active .site-navigation,
body.eduplex-portal-active .main-navigation {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body.eduplex-portal-active .eduplex-hw-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    background-color: #f3f4f6 !important;
    z-index: 10000000 !important;
    overflow-y: auto !important;
    padding-top: 1.5rem !important;
    padding-bottom: 5rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

/* 모달 포인터 이벤트 */
#eduplex-hw-modal,
#eduplex-self-pw-modal,
#eduplex-student-detail-modal,
#eduplex-ios-guide-modal,
#eduplex-image-viewer-modal,
#eduplex-image-preview-modal,
#eduplex-slide-viewer-modal,
#eduplex-captured-preview-modal {
    z-index: 10000001 !important;
    pointer-events: none !important;
}

#eduplex-modal-container,
#eduplex-self-pw-modal > div,
#eduplex-detail-modal-container,
.ios-safari-guide-container,
#eduplex-image-viewer-modal > div,
#eduplex-image-preview-modal > div,
#eduplex-slide-viewer-modal > div,
#eduplex-captured-preview-modal > div {
    pointer-events: auto !important;
}

#eduplex-hw-modal.active-portal-modal,
#eduplex-self-pw-modal.active-portal-modal,
#eduplex-student-detail-modal.active-portal-modal,
#eduplex-ios-guide-modal.active-portal-modal,
#eduplex-image-viewer-modal:not(.hidden),
#eduplex-image-preview-modal:not(.hidden),
#eduplex-slide-viewer-modal:not(.hidden),
#eduplex-captured-preview-modal:not(.hidden) {
    pointer-events: auto !important;
}

/* 커스텀 알림/컨펌 모달 최상위 레이어 */
#eduplex-custom-alert,
#eduplex-custom-confirm {
    z-index: 20000000 !important;
}

/* ============================================================
   최종 제출하기 버튼 비활성화 스타일
   ============================================================ */
.eduplex-submit-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #9ca3af !important;
}

.eduplex-submit-all-btn:disabled:hover {
    background-color: #9ca3af !important;
}