/* styles/common.css

   ═══════════════════════════════════════════════════════
   반응형 기준점 (사이트 전체 공용 - 다른 CSS 파일도 전부 이 값을 따름)

     폰      : max-width  600px 이하
     태블릿   : max-width 1024px 이하 (601px ~ 1024px)
     데스크탑 : 1024px 초과 (별도 미디어쿼리 없이 기본 스타일)

   예외: .navbar-menu(상단 메뉴, 항목 9개)만 1450px을 기준으로 씀
   (아이패드 프로 가로모드 등 태블릿 상한선보다 넓은 화면에서도 다 안 들어가서).
   그 외 모든 요소는 위 3단계(600 / 1024)만 사용합니다.
   ═══════════════════════════════════════════════════════
*/

/* 글꼴: 성도용 사이트(생명의말씀선교회)와 같은 Google Fonts 를 쓴다.
   - Noto Sans KR : 본문·제목 (한국어/스페인어 공통)
   - Gowun Batang : 장식용 명조 (로그인 화면 소개 문구 등)
   폰트 링크는 각 HTML 의 <head> 에 있다. */

/* 색상은 ../../shared/theme.css 의 브랜드 토큰을 쓴다 (성도용 사이트와 공통) */
:root {
    --primary-color: var(--brand-600);
    --secondary-color: var(--brand-600);
    --accent-color: var(--brand-400);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: var(--ink);
    --text-secondary: var(--ink-muted);
    --border-color: var(--line);
    --bg-light: var(--brand-50);
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
}

/* 제목도 본문과 같은 Noto Sans KR (성도용 사이트처럼 굵고 또렷하게) - 스페인어도 동일 */
h1, h2, h3 {
    font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* 장식용 명조 - 성도용 홈의 큰 문구와 같은 글꼴 */
.font-serif {
    font-family: 'Gowun Batang', 'Nanum Myeongjo', serif;
}

/* 네비게이션 바 */
.navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    border-top: 4px solid transparent;
    border-image: var(--brand-gradient) 1;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    row-gap: 8px;
    min-height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.navbar-brand .logo-image {
    height: 45px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* 로고 이미지가 없거나 로드 실패 시 JS(i18n.js의 setupLogoFallback)가
   <img>를 이 span으로 교체한다. (이미지에 대한 ::after 컨텐츠는 브라우저마다
   지원이 일관되지 않아 JS 방식으로 처리한다.) */
.logo-fallback {
    font-size: 32px;
    line-height: 1;
    display: inline-block;
}

.navbar-brand h1 {
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.navbar-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    list-style: none;
}

.navbar-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s;
    white-space: nowrap;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: var(--secondary-color);
}

/* 다른 사이트로 이동하는 링크 (관리자 사이트 ↔ 신학원 ↔ 성도용) */
.navbar-menu a.nav-site-link {
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: 999px;
    padding: 3px 12px;
    font-weight: 700;
}

.navbar-menu a.nav-site-link:hover {
    background: var(--brand-100);
}

/* 컴퓨터 크기(1450px 초과)에서만: 위 줄엔 로고(왼쪽) + 언어전환/유저정보(오른쪽),
   그 아래 여백을 두고 탭 메뉴를 한 줄 통째로. 모바일/태블릿(1450px 이하)은 기존 햄버거
   드롭다운 방식 그대로 안 건드린다. */
@media (min-width: 1451px) {
    .navbar-brand { order: 1; }
    .lang-switcher { order: 2; margin-left: auto; }
    .navbar-user { order: 3; }
    .navbar-menu {
        order: 4;
        flex: 1 1 100%;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--border-color);
    }
}


/* 공통 버튼 스타일 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(21, 112, 204, 0.3);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.btn-submit {
    width: 100%;
    padding: 14px 24px;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(21, 112, 204, 0.4);
}

.btn-cancel {
    padding: 12px 24px;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel:hover {
    border-color: var(--text-secondary);
}

/* 네비게이션 사용자 정보 */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.navbar-user {
    position: relative;
}

.user-info:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(21, 112, 204, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
}

.user-church {
    font-size: 12px;
    color: var(--text-secondary);
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
    white-space: nowrap;
}

.btn-logout {
    padding: 8px 20px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.btn-logout:hover {
    border-color: var(--error-color);
    color: var(--error-color);
    background: #fee2e2;
}

/* 알림 메시지 */
.alert {
    display: none;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
    border-left: 4px solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-color: var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: var(--error-color);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: var(--warning-color);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: var(--primary-color);
}

/* 로딩 스피너 */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 폼 요소 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background: var(--bg-white);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(21, 112, 204, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ══════════════════════════════════════════════
   강의 카드 (main.html 대시보드 + 신학과정/전도인/교재실/자료공유 페이지 공용)
   전에는 main.css와 course.css에 각각 조금씩 다른 값으로 따로 있어서
   페이지마다 카드 크기가 미묘하게 달라 보였다. 여기 하나로 통합한다.
   ══════════════════════════════════════════════ */
.lectures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 강의 목록 아래 이전/다음 페이지 버튼 (course.js가 필요할 때만 만들어 넣음) */
.lectures-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.lectures-pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.lecture-card {
    background: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    cursor: pointer;
}

.lecture-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.lecture-icon {
    width: 100%;
    height: 150px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    overflow: hidden;
}

.lecture-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ══════════════════════════════════════════════
   전도인 명단 (대학교 교수진 페이지 스타일)
   ══════════════════════════════════════════════ */
.evangelist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.evangelist-card {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.evangelist-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.evangelist-photo {
    width: 100%;
    height: 180px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}

.evangelist-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.evangelist-photo-fallback {
    font-size: 48px;
    font-weight: 700;
    color: #fff;
}

.evangelist-info {
    padding: 16px;
}

.evangelist-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.evangelist-church,
.evangelist-contact {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    word-break: break-word;
}

/* ══════════════════════════════════════════════
   교회 목록 (위치 지도 + 담임목사/부목사/전도인 + 연락처)
   ══════════════════════════════════════════════ */
.church-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.church-card {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.church-map {
    width: 100%;
    height: 200px;
    border: 0;
    display: block;
}

.church-info {
    padding: 16px 20px;
}

.church-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.church-address,
.church-staff {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    word-break: break-word;
}

.lecture-content {
    padding: 20px;
}

.lecture-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lecture-instructor {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.lecture-church {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-bottom: 12px;
}

.lecture-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 강의 카드 수강 상태 배지 (수강완료/수강중/미수강) */
.lecture-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.lecture-status-badge.completed {
    background: #dcfce7;
    color: #16a34a;
}
.lecture-status-badge.in-progress {
    background: #fef9c3;
    color: #a16207;
}
.lecture-status-badge.not-started {
    background: var(--bg-light);
    color: var(--text-secondary);
}

/* 강의 카드 안 "✏️ 수정" 버튼 (관리자/강사에게만 노출) - 카드 클릭(상세보기)과 겹치지 않게
   별도 버튼으로 분리하고, 클릭 시 이벤트 위임에서 카드 클릭보다 우선 처리한다. */
.btn-edit-lecture {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-lecture:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* 빈 상태 (강의목록, 자료목록 등 공용) */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 12px;
}

/* 반응형 */
@media (max-width: 1024px) {
    .user-church {
        display: none;
    }
}

/* ══════════════════════════════════════════════
   모달 (팝업창) - main.html의 강의시청/쪽지/프로필 모달과
   게시판 페이지(materials.html 등)의 글쓰기/상세보기 모달이 공용으로 쓴다.
   전에는 main.css에만 있어서 게시판 페이지들에서 안 먹혔었음.
   ══════════════════════════════════════════════ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 32px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 반응형 (768px 이하 - 원래 있던 것 하나로 통합) */
/* ── 폰 전용 (≤600px) ── 원래 768px/480px 두 단계였던 걸 하나로 통일 (폰/태블릿/데스크탑 3단계 체계) */
@media (max-width: 600px) {
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .user-info {
        padding: 6px 12px;
        gap: 8px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .user-name {
        font-size: 13px;
        display: none; /* 아바타만 남기고 이름은 숨김 - 눌러서 드롭다운 열면 어차피 이름 나옴 */
    }

    .lectures-grid {
        grid-template-columns: 1fr;
    }

    /* 사이트 이름 텍스트는 좁은 화면에서 굳이 필요 없음 - 로고 아이콘만 남김 */
    .navbar-brand h1 {
        display: none;
    }

    .navbar-container {
        padding: 0 12px;
        height: 60px;
    }

    .navbar-brand .logo-image {
        height: 34px;
    }

    .lang-switcher .lang-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .btn-logout {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ══════════════════════════════════════════════
   사이드바 드롭다운 (프로필/성경찾기/빠른링크) - 전에는 main.css에만 있어서
   main.html에서만 쓸 수 있었는데, 이제 상단 유저 아바타를 누르면 모든 페이지에서
   동일하게 뜨게 만들면서 여기(common.css)로 옮겼다.
   ══════════════════════════════════════════════ */
.sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
}

.sidebar-section {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.bible-section {
    padding: 0;
    /* 버튼이 접혀있을 때, 버튼의 각진 아래 모서리가 카드의 둥근 경계 밖으로 삐져나오지
       않게 여기서 잘라낸다. 버튼 쪽 border-radius를 JS로 매번 바꾸는 것보다 안정적이다
       (전환 애니메이션 중 미세하게 어긋나 보이던 문제가 이 방식으로 사라진다). */
    overflow: hidden;
    border-radius: 16px;
}

.bible-search-content {
    padding: 0 24px 24px 24px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.bible-search-content.show {
    display: block !important;
}

.user-profile {
    text-align: center;
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 32px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-profile p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.user-role {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary-color);
    margin-top: 8px;
}

.btn-edit-profile {
    width: 100%;
    padding: 10px 16px;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 16px;
}

.btn-edit-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21, 112, 204, 0.3);
}

.btn-sidebar {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
    text-align: left;
}

/* 접혀있을 땐 카드(.bible-section) 전체와 동일하게 네 모서리 다 둥글게 -
   이전엔 항상 위쪽만 둥글어서, 접혔을 때 버튼 아래 모서리가 각지고 뒤에
   카드의 둥근 흰 배경이 살짝 비쳐 보이는 문제가 있었다. */
.bible-section .btn-sidebar {
    margin-bottom: 0;
    border-radius: 16px;
}

.bible-section .btn-sidebar:last-child {
    border-radius: 0 0 16px 16px;
}

.bible-search-content .btn-sidebar {
    border-radius: 8px;
}

.btn-logout-sidebar {
    background: var(--error-color);
    color: white;
}

.btn-logout-sidebar:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-bible {
    background: var(--brand-gradient);
    color: white;
}

.btn-bible:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21, 112, 204, 0.3);
}

.quick-links h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.quick-links ul {
    list-style: none;
}

.quick-links li {
    margin-bottom: 8px;
}

.quick-links a {
    display: block;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.quick-links a:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateX(4px);
}

/* 성경 찾기 결과 (사이드바 공용) */
.bible-verse {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--secondary-color);
}

.verse-reference {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 16px;
    margin-bottom: 12px;
}

.verse-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 16px;
    white-space: pre-wrap; /* 여러 절 조회 시 절마다 줄바꿈되어 보이도록 */
}

.bible-verse button {
    padding: 8px 16px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.bible-verse button:hover {
    background: var(--accent-color);
}

.bible-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* 사이드바 드롭다운(프로필/성경찾기/쪽지함 등) - 기본은 항상 숨김, 상단 아바타를 눌러야 열림.
   화면 너비와 무관하게 모든 페이지에서 동일하게 토글로만 동작한다.
   예외: 홈 화면(main.html)은 넓은 화면(1024px 초과)에서 상시 노출되는데, 그 오버라이드는
   main.css의 `.sidebar .sidebar-collapsible` 규칙에서 처리한다 (아래가 아님). */
.sidebar-collapsible {
    display: none;
}

.sidebar-collapsible.open {
    display: block;
    position: fixed;
    top: 78px;
    right: 16px;
    left: 16px;
    max-width: 360px;
    margin-left: auto;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 2000;
    animation: sidebarDropdownIn 0.15s ease-out;
}

/* 드롭다운 뒤 어둡게 깔리는 배경 - 가독성 확보 + 눌러도 닫힘 */
.sidebar-backdrop.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1999;
    pointer-events: auto;
    animation: sidebarBackdropIn 0.15s ease-out;
}

.sidebar-backdrop {
    display: none;
}

@keyframes sidebarBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sidebarDropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════
   쪽지함 + 프로필 이미지 업로드 (사이드바 드롭다운 공용)
   전에는 main.css에만 있어서 main.html에서만 됐는데, 이제 모든 페이지 공용.
   ══════════════════════════════════════════════ */
.section-header-small {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header-small h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.message-badge {
    background: var(--error-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.message-list {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.message-item {
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.message-item:hover {
    background: var(--border-color);
}

.message-item.unread {
    background: #dbeafe;
    border-left: 3px solid var(--primary-color);
}

.message-sender {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-subject {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-time,
.message-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.empty-message {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.btn-message {
    background: var(--brand-100);
    color: var(--brand-700);
}

.btn-message:hover {
    background: var(--brand-200);
    transform: translateY(-2px);
}

/* 프로필 이미지 업로드 */
.profile-image-section {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.profile-image-upload {
    display: flex;
    gap: 20px;
    align-items: center;
}

.profile-image-preview {
    flex-shrink: 0;
}

.profile-image-preview .user-avatar-large {
    width: 100px;
    height: 100px;
    font-size: 40px;
}

.profile-image-preview img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}

.profile-image-controls {
    flex: 1;
}

.profile-image-controls button {
    margin-right: 8px;
    margin-bottom: 8px;
}

/* ══════════════════════════════════════════════
   게시판 리스트 (자료공유/교재실/공지사항/관리자게시판 공용)
   전에는 main.css에만 있어서, 정작 해당 페이지들(main.css를 안 불러옴)에서는
   하나도 안 먹히고 있었다. 여기(공용)로 옮겨서 실제로 적용되게 한다.
   ══════════════════════════════════════════════ */
.resource-list,
.material-list,
.notice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resource-item,
.material-item,
.notice-item {
    background: var(--bg-light);
    padding: 16px 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s;
    cursor: pointer;
}

.material-item {
    border-left-color: var(--success-color);
}

.notice-item {
    border-left-color: var(--warning-color);
}

.notice-item.important {
    border-left-color: var(--error-color);
    background: #fef3c7;
}

.resource-item:hover,
.material-item:hover,
.notice-item:hover {
    background: var(--border-color);
    transform: translateX(4px);
}

.resource-title,
.material-title,
.notice-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.notice-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--error-color);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
}

.resource-meta,
.material-meta,
.notice-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .resource-item,
    .material-item,
    .notice-item {
        padding: 12px 16px;
    }

    .resource-meta,
    .material-meta,
    .notice-meta {
        gap: 8px 16px;
        font-size: 12px;
    }
}

/* 쪽지 상세보기 모달 */
.message-detail-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.message-detail-subject {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.message-detail-content {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 80px;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* 사이드바 "쪽지함 전체보기" 링크 - a 태그라 버튼처럼 보이게 보정 */
a.btn-sidebar {
    display: block;
    box-sizing: border-box;
    text-decoration: none;
    text-align: center;
}

.btn-message-view {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-message-view:hover {
    background: var(--border-color);
}
