/* RA0 Edition - 다이아 핀 연표 스킨 (historydia_up) */
/* 인포그래픽형 + 기울어진 사진 액자 */

/* ========== 컨테이너 ========== */
.history-container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    min-height: 100vh;
	background: linear-gradient(90deg, transparent, var(--container-bg-color) 35%, 80%, transparent);
}

/* ========== 헤더 ========== */
/* .timeline-header {
    text-align: center;
    margin-bottom: 20px;
}

.timeline-title {
    font-family: var(--title-font-family);
    font-size: 3rem;
    color: var(--accent-color);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.timeline-meta {
    color: var(--text-muted);
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 20px;
} */

.timeline-admin-controls {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin-bottom: 10px;
}

.btn-add-event, .btn-edit-mode, .btn-edit-order {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-add-event {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
}

.btn-add-event:hover {
    filter: brightness(1.1);
}

.btn-edit-mode, .btn-edit-order {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--border-light);
}

.btn-edit-mode:hover, .btn-edit-order:hover {
    background: var(--card-bg-color);
}

.btn-edit-mode.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

.btn-edit-order.active {
    background: var(--warning-color);
    color: #000;
    border-color: var(--warning-color);
}

/* 하단 글쓰기 버튼 */
.timeline-footer {
    display: flex;
    justify-content: center;
    margin-top: 60px;
}

.btn-add-event-bottom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-event-bottom:hover {
    filter: brightness(1.1);
}

/* ========== 타임라인 구조 (인포그래픽형) ========== */
.timeline-wrapper {
    position: relative;
}

/* 중앙 타임라인 축 */
.timeline-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--accent-color);
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0.3;
}

.timeline-events {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 10;
}

/* ========== 이벤트 아이템 (인포그래픽형) ========== */
.timeline-event {
    position: relative;
    display: flex;
    align-items: stretch;
    margin-bottom: 0;
    transition: opacity 0.3s;
    margin-bottom: 30px;
}

.timeline-event.left {
    flex-direction: row;
}

.timeline-event.right {
    flex-direction: row-reverse;
}

/* ========== 마커 (마름모꼴, 글자 없음) ========== */
.event-marker {
    position: absolute;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) rotate(45deg);
    z-index: 10;
    background: var(--accent-color);
    width: 20px;
    height: 20px;
    font-size: 0;
    color: transparent;
    box-shadow: 5px 5px 0px rgb(from var(--gray-500) r g b / 20%), 0 0 8px rgb(from var(--gray-200) r g b / 70%);
    overflow: hidden;
}

/* ========== 이벤트 카드 (콘텐츠 영역) ========== */
.event-card {
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 40px;
    position: relative;
    background: transparent;
    border: none;
}

.timeline-event.left .event-card {
    text-align: right;
    align-items: flex-end;
}

.timeline-event.right .event-card {
    text-align: left;
    align-items: flex-start;
}

/* 드래그 핸들 - 편집 모드에서만 표시 */
.drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--text-muted);
    padding: 5px;
    display: none;
}

.edit-mode .drag-handle {
    display: block;
}

.edit-mode .event-card:hover .drag-handle,
.edit-mode.editing-order .drag-handle {
    opacity: 1;
}

/* 날짜 - 큰 연도 숫자 */
.event-date {
    display: block;
    font-family: var(--title-font-family);
    font-size: 3.5rem;
    /* font-weight: 700; */
    color: var(--accent-color);
    line-height: 1;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
	/*	text-shadow: 0 0 3px rgb(from var(--gray-900) r g b / 70%), 0 0 8px rgb(from var(--gray-200) r g b / 70%); */
}

/* 제목 - 굵은 대문자 */
.event-title {
    font-family: var(--title-font-family);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--content-font-color);
    margin: 0 0 5px 0;
    line-height: 1.4;
}

/* 부제목 - 하이라이트 */
.event-subtitle {
    font-family: var(--title-font-family);
    font-size: var(--title-font-size);
    font-weight: 600;
    color: var(--title-font-color);
    margin: 0 0 15px 0;
    line-height: 1.4;
}

/* 내용 */
.event-content {
    font-family: var(--content-font-family);
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 450px;
}

.event-content p {
    margin: 0 0 1em 0;
}

.event-content p:last-child {
    margin-bottom: 0;
}

/* 도장 효과 - 숨김 (E안에서는 사용 안 함) */
.event-stamp {
    display: none;
}

/* 관리자 액션 버튼 */
.event-admin-actions {
    display: none;
    gap: 8px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
    opacity: 0;
    transition: opacity 0.2s;
}

.edit-mode .event-admin-actions {
    display: flex;
}

.edit-mode .event-card:hover .event-admin-actions {
    opacity: 1;
}

.event-admin-actions button,
.event-admin-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--card-bg-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.event-admin-actions button:hover,
.event-admin-actions a:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

.btn-delete:hover {
    background: var(--error-color) !important;
    border-color: var(--error-color) !important;
    color: #fff !important;
}

/* ========== 이미지 영역 ========== */
.event-image-zone {
    flex: 0 0 50%;
    position: relative;
    display: flex;
}

.event-image-zone:has(.photo-frame) {
    min-height: 350px;
}

.timeline-event.left .event-image-zone {
    justify-content: flex-start;
    padding-left: 48px;
}

.timeline-event.right .event-image-zone {
    justify-content: flex-end;
    padding-right: 48px;
}

/* 프레임 외곽 - 회전 & 프레임 보더 (overflow 밖) */
.photo-frame {
    --rot: 0deg;
    position: relative;
    display: inline-block;
    transform: rotate(var(--rot));
    transition: transform 0.4s ease;
}


/* 이미지 래퍼 */
.photo-wrapper {
    position: relative;
    display: block;
    height: 300px;
    width: auto;
    overflow: hidden;
    box-shadow: 0 10px 8px -3px rgb(0 0 0 / 30%);
}


/* 이미지 - 세로 300px 고정, 가로 auto */
.event-img {
    height: 300px;
    width: auto;
    object-fit: cover;
}

/* 플레어 효과 */
.photo-flare {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 40%, rgba(255,255,255,.9), transparent 40%),
        radial-gradient(circle at 35% 45%, rgba(255,200,100,.7), transparent 30%),
        radial-gradient(circle at 60% 55%, rgba(255,255,255,.4), transparent 30%);
    opacity: 0;
    transition: opacity 0.5s ease;
    mix-blend-mode: lighten;
    pointer-events: none;
    z-index: 5;
}

.timeline-event:hover .photo-flare {
    opacity: 0.85;
}



/* 이미지 없음 - 편집 모드에서만 표시 */
.no-image {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: var(--card-bg-color);
    color: var(--text-muted);
}

.edit-mode .no-image {
    display: flex;
}

.btn-add-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: transparent;
    border: 2px dashed var(--border-light);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.btn-add-image:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* ========== 편집 가능한 필드 ========== */
.editable {
    border-radius: 4px;
    transition: background 0.2s, box-shadow 0.2s;
    outline: none;
}

.edit-mode .editable {
    cursor: text;
}

.edit-mode .editable:hover {
    background: rgba(var(--accent-color), 0.1);
}

.edit-mode .editable:focus,
.edit-mode .editable.editing {
    background: rgba(var(--accent-color), 0.15);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.edit-mode .editable.saving {
    opacity: 0.6;
}

.edit-mode .editable.saved {
    animation: savedPulse 0.5s ease;
}

@keyframes savedPulse {
    0% { box-shadow: 0 0 0 2px var(--success-color); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* ========== 정렬 모드 ========== */
.editing-order .timeline-event {
    cursor: move;
}

.editing-order .event-card {
    box-shadow: 0 0 0 2px var(--warning-color);
}

.editing-order .drag-handle {
    opacity: 1;
    color: var(--warning-color);
}

.ui-sortable-helper {
    opacity: 0.9;
}

.ui-sortable-placeholder {
    visibility: visible !important;
    background: rgba(var(--accent-color), 0.1);
    border: 2px dashed var(--accent-color);
    min-height: 200px;
}

.btn-add-first {
    display: inline-block;
    padding: 15px 30px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-add-first:hover {
    filter: brightness(1.1);
}

/* ========== 모달 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--content-font-color);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--container-bg-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-light);
}

/* 탭 */
.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

/* 업로드 영역 */
.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-color);
    background: rgba(var(--accent-color), 0.05);
}

.upload-area i {
    margin-bottom: 10px;
    color: var(--accent-color);
    font-size: 2rem;
    pointer-events: none;
}

.upload-area p {
    margin: 0;
    font-size: 0.9rem;
    pointer-events: none;
}

/* URL 입력 */
#image-url-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--container-bg-color);
    color: var(--content-font-color);
    font-size: 0.95rem;
}

#image-url-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* 이미지 미리보기 */
.image-preview {
    margin-top: 20px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.btn-remove-preview {
    padding: 8px 16px;
    background: var(--error-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* 모달 버튼 */
.btn-cancel {
    padding: 10px 20px;
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
}

.btn-save-image {
    padding: 10px 20px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-save-image:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 반응형 ========== */
@media screen and (max-width: 900px) {
    .timeline-line {
        left: 20px;
        width: 4px;
    }

    .event-marker {
        left: 20px;
        top: 46px;
        width: 14px;
        height: 14px;
    }

    .timeline-event,
    .timeline-event.left,
    .timeline-event.right {
        flex-direction: column;
    }

    .event-image-zone,
    .timeline-event.left .event-image-zone,
    .timeline-event.right .event-image-zone {
        flex: 0 0 auto;
        min-height: auto;
        justify-content: flex-start;
        padding: 14px 0 10px 50px;
    }

    .photo-frame {
        max-width: 100%;
    }

    .photo-wrapper {
        height: 200px;
        max-width: 100%;
    }

    .event-img {
        height: 200px;
        max-width: 100%;
    }

    /* 사진이 있으면 마름모를 사진 위에 핀처럼 꽂는다 */
    .timeline-event:has(.photo-frame) .event-marker {
        display: none;
    }

    .photo-frame::before {
        content: '';
        position: absolute;
        top: -7px;
        left: 50%;
        width: 14px;
        height: 14px;
        background: var(--accent-color);
        transform: translateX(-50%) rotate(45deg);
        box-shadow: 3px 3px 0px rgb(from var(--gray-500) r g b / 20%), 0 0 8px rgb(from var(--gray-200) r g b / 70%);
        z-index: 6;
    }

    .event-card {
        flex: 1;
        padding: 20px;
        padding-left: 50px;
    }

    .timeline-event.left .event-card,
    .timeline-event.right .event-card {
        text-align: left;
        align-items: flex-start;
    }

    .event-date {
        font-size: 2.5rem;
    }

    .event-content {
        max-width: 100%;
    }

    .timeline-title {
        font-size: 2rem;
    }

}

@media screen and (max-width: 480px) {
    .history-container {
        padding: 20px 10px 40px;
    }

    .event-card {
        padding: 15px;
        padding-left: 40px;
    }

    .event-image-zone,
    .timeline-event.left .event-image-zone,
    .timeline-event.right .event-image-zone {
        padding-left: 40px;
    }

    .event-date {
        font-size: 2rem;
    }

    .event-title {
        font-size: 0.9rem;
    }

    .event-subtitle {
        font-size: 1.1rem;
    }

    .event-admin-actions {
        opacity: 1;
    }
}
