/* ========================================
   아침마다 (Morning) 게시판
   엠마오교회 홈페이지
   ======================================== */

/* Hero */
.hero-morning {
    background: var(--white);
    padding: 120px 0 60px;
    text-align: center;
}

.hero-morning .hero-content h1 {
    font-size: 3rem;
    font-weight: 400;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.hero-morning .hero-content p {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-light);
}

/* Section */
.morning-section {
    padding: 60px 0 80px;
    background: var(--white);
}

.morning-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 30px;
}

.morning-count {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 300;
}

.morning-count strong {
    color: var(--primary-color);
    font-weight: 500;
}

/* Admin controls */
.admin-controls {
    text-align: right;
    margin-bottom: 30px;
}

.morning-head .admin-controls {
    margin-bottom: 0;
    flex: none;
}

.btn-write {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 400;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(92, 143, 220, 0.3);
}

.btn-write:hover {
    background: #4a7ac4;
    box-shadow: 0 6px 20px rgba(92, 143, 220, 0.4);
}

/* Grid */
.morning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 32px 26px;
}

/* Card */
.morning-card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    min-width: 0;
}

.morning-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 210 / 297;
    background: var(--bg-light);
    border: 1px solid #eceff4;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.morning-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.morning-thumb .pdf-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #c7d4e6;
    background: linear-gradient(160deg, #f7f9fc 0%, #eef3fa 100%);
}

.morning-thumb .pdf-fallback i {
    font-size: 3rem;
}

.morning-thumb .pdf-fallback span {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: #a8b8cd;
}

.morning-card:hover .morning-thumb {
    box-shadow: 0 8px 24px rgba(92, 143, 220, 0.22);
    border-color: #d5e2f5;
}

.morning-card-body {
    padding: 14px 2px 0;
}

.morning-card-title {
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: keep-all;
}

.morning-card:hover .morning-card-title {
    color: var(--primary-color);
}

.morning-card-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 300;
}

/* Private badge */
.badge-private {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 400;
    color: #b06a00;
    background: #fff5e6;
    border: 1px solid #ffe0b2;
    border-radius: 10px;
    flex: none;
}

.thumb-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Empty / error state */
.morning-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.morning-empty i {
    font-size: 3rem;
    color: #d4e0f0;
    margin-bottom: 18px;
    display: block;
}

.morning-empty p {
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.8;
}

.morning-error {
    text-align: center;
    padding: 60px 20px;
    color: #c0392b;
    font-size: 0.95rem;
}

/* Skeleton */
.morning-skeleton {
    pointer-events: none;
}

.sk-thumb {
    width: 100%;
    aspect-ratio: 210 / 297;
    border-radius: 8px;
    background: #eef2f7;
    animation: morningPulse 1.4s ease-in-out infinite;
}

.sk-line {
    height: 14px;
    margin-top: 12px;
    border-radius: 4px;
    background: #eef2f7;
    animation: morningPulse 1.4s ease-in-out infinite;
}

.sk-line.short {
    width: 55%;
    margin-top: 8px;
}

@keyframes morningPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   상세 (PDF 뷰어)
   ======================================== */

.detail-morning {
    padding: 110px 0 90px;
    background: #f4f6fa;
    min-height: 70vh;
}

.detail-head {
    max-width: 900px;
    margin: 0 auto 24px;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 16px;
}

.detail-back:hover {
    color: var(--primary-color);
}

.detail-title {
    font-size: 1.9rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.45;
    word-break: keep-all;
}

.detail-desc {
    margin-top: 12px;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-light);
    line-height: 1.7;
    white-space: pre-wrap;
}

.detail-meta {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    font-size: 0.88rem;
    color: #8a93a0;
    font-weight: 300;
}

.detail-actions {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(92, 143, 220, 0.3);
}

.btn-download:hover {
    background: #4a7ac4;
}

.btn-sub {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid #dde5ef;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 300;
    text-decoration: none;
    cursor: pointer;
}

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

/* PDF pages */
.pdf-stage {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.pdf-page {
    width: 100%;
    background: var(--white);
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.09);
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.pdf-page canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* 썸네일 선표시 (PDF 준비 전 임시 미리보기)
   목록에서 이미 받은 1페이지 이미지를 먼저 보여줘 체감 로딩을 줄입니다. */
.pdf-page.pdf-thumb-preview {
    min-height: 0;
    position: relative;
}

.pdf-page.pdf-thumb-preview img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.9;   /* 실제 렌더 전 임시 이미지임을 살짝 구분 */
}

.pdf-status {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 300;
}

.pdf-status .spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto 16px;
    border: 3px solid #dde5ef;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: morningSpin 0.9s linear infinite;
}

@keyframes morningSpin {
    to { transform: rotate(360deg); }
}

.pdf-progress {
    position: sticky;
    top: 78px;
    z-index: 5;
    max-width: 900px;
    margin: 0 auto 16px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e6ecf4;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 300;
    text-align: center;
    backdrop-filter: blur(6px);
}

/* ========================================
   관리자 작성/수정
   ======================================== */

.write-morning {
    padding: 110px 0 90px;
    background: var(--white);
    min-height: 70vh;
}

.write-box {
    max-width: 720px;
    margin: 0 auto;
}

.write-title {
    font-size: 1.7rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.write-sub {
    font-size: 0.92rem;
    color: var(--text-light);
    font-weight: 300;
    margin-bottom: 34px;
}

.field {
    margin-bottom: 24px;
}

.field label {
    display: block;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.field label .req {
    color: #e05a5a;
}

.field input[type="text"],
.field textarea {
    width: 100%;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 300;
    color: var(--text-dark);
    padding: 12px 14px;
    border: 1px solid #dde5ef;
    border-radius: 8px;
    outline: none;
    background: var(--white);
    resize: vertical;
}

.field input[type="text"]:focus,
.field textarea:focus {
    border-color: var(--primary-color);
}

.field textarea {
    min-height: 90px;
    line-height: 1.6;
}

.field .hint {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #9aa4b2;
    font-weight: 300;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed #cfdcee;
    border-radius: 10px;
    padding: 34px 20px;
    text-align: center;
    background: #fafcff;
    cursor: pointer;
}

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: #f2f7fe;
}

.drop-zone i {
    font-size: 2rem;
    color: #b9cbe3;
    display: block;
    margin-bottom: 10px;
}

.drop-zone .dz-main {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 400;
}

.drop-zone .dz-sub {
    margin-top: 6px;
    font-size: 0.82rem;
    color: #9aa4b2;
    font-weight: 300;
}

.drop-zone input[type="file"] {
    display: none;
}

.file-chosen {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid #dde5ef;
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--text-dark);
    font-weight: 300;
    background: #fafcff;
}

.file-chosen i {
    color: var(--primary-color);
}

.file-chosen .sz {
    margin-left: auto;
    color: #9aa4b2;
    font-size: 0.8rem;
    flex: none;
}

/* Publish toggle */
.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid #e6ecf4;
    border-radius: 10px;
    background: #fafcff;
}

.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary-color);
    flex: none;
    cursor: pointer;
}

.toggle-row .tg-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-dark);
}

.toggle-row .tg-desc {
    margin-top: 4px;
    font-size: 0.82rem;
    color: #9aa4b2;
    font-weight: 300;
    line-height: 1.6;
}

/* Progress */
.upload-progress {
    margin-top: 14px;
    height: 8px;
    background: #eef2f7;
    border-radius: 99px;
    overflow: hidden;
}

.upload-progress > div {
    height: 100%;
    width: 0;
    background: var(--primary-color);
    border-radius: 99px;
    transition: width 0.25s ease;
}

.upload-note {
    margin-top: 8px;
    font-size: 0.82rem;
    color: #9aa4b2;
    font-weight: 300;
}

/* Buttons */
.write-actions {
    display: flex;
    gap: 12px;
    margin-top: 34px;
}

.btn-primary,
.btn-ghost {
    flex: 1;
    padding: 14px 20px;
    border-radius: 26px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    border: 1px solid transparent;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(92, 143, 220, 0.3);
}

.btn-primary:hover {
    background: #4a7ac4;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: default;
    box-shadow: none;
}

.btn-ghost {
    background: var(--white);
    color: var(--text-dark);
    border-color: #dde5ef;
    flex: 0 0 auto;
    padding-left: 30px;
    padding-right: 30px;
}

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

.btn-danger {
    background: var(--white);
    color: #d9534f;
    border: 1px solid #f0c8c6;
    flex: 0 0 auto;
    padding: 14px 26px;
    border-radius: 26px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

/* Guard / login prompt */
.morning-guard {
    max-width: 520px;
    margin: 60px auto;
    padding: 50px 30px;
    text-align: center;
    background: var(--white);
    border: 1px solid #e6ecf4;
    border-radius: 14px;
}

.morning-guard i {
    font-size: 2.4rem;
    color: #cfdcee;
    display: block;
    margin-bottom: 18px;
}

.morning-guard h2 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.morning-guard p {
    font-size: 0.92rem;
    color: var(--text-light);
    font-weight: 300;
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Notice */
.form-error {
    margin-top: 14px;
    padding: 12px 16px;
    background: #fdf3f3;
    border: 1px solid #f0c8c6;
    border-radius: 8px;
    color: #c0392b;
    font-size: 0.88rem;
    font-weight: 300;
}

/* ========================================
   반응형
   ======================================== */

@media (max-width: 768px) {
    .hero-morning {
        padding: 90px 0 40px;
    }

    .hero-morning .hero-content h1 {
        font-size: 2rem;
    }

    .hero-morning .hero-content p {
        font-size: 1rem;
    }

    .morning-section {
        padding: 40px 0 60px;
    }

    .morning-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 16px;
    }

    .morning-card-title {
        font-size: 0.92rem;
    }

    .morning-card-meta {
        font-size: 0.78rem;
    }

    .btn-write {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .detail-morning,
    .write-morning {
        padding: 90px 0 60px;
    }

    .detail-title {
        font-size: 1.35rem;
    }

    .pdf-progress {
        top: 66px;
    }

    .write-actions {
        flex-wrap: wrap;
    }

    .btn-ghost,
    .btn-danger {
        flex: 1 1 auto;
    }
}

@media (max-width: 480px) {
    .morning-grid {
        gap: 20px 12px;
    }

    .morning-thumb .pdf-fallback i {
        font-size: 2.2rem;
    }

    .detail-actions {
        gap: 8px;
    }

    .btn-download,
    .btn-sub {
        padding: 11px 18px;
        font-size: 0.88rem;
    }

    .write-actions {
        flex-direction: column;
    }

    .btn-ghost,
    .btn-danger {
        width: 100%;
    }
}
