/* ================== 기본 스타일 ================== */
body {
    background-color: #111;
    color: #f0f0f0;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ------------------ 네비게이션 바 ------------------ */
.navbar {
    width: 100%;
    height: 60px;
    background-color: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    border-bottom: 2px solid #ff6a00;
    box-sizing: border-box;
}

/* 왼쪽: 로고 + 메뉴 */
.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-left a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
}

/* 오른쪽: 검색 + 로그인/회원가입 + 닉네임 */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.nav-right a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 4px;
}

/* 검색창 */
.search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    margin-right: 5px;
}

.search-form input,
.search-form button {
    height: 36px;
    line-height: 36px;
    font-size: 14px;
    border-radius: 5px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.search-form input {
    padding: 0 8px;
    background: #222;
    border: 1px solid #444;
    color: white;
    width: 180px;
}

.search-form button {
    padding: 0 12px;
    background: #ff6a00;
    border: none;
    color: white;
    cursor: pointer;
    line-height: 1;
}

.logo-merge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    padding: 6px 12px;
    border-radius: 4px;

    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
    font-size: 20px;
}

.logo-text {
    position: relative;
    top: -1px;   /* 👈 글자만 3px 아래 */
}


/* ================== navbar hover 효과 ================== */
.navbar a:hover,
.navbar button:hover {
    color: #000 !important;           /* 글자 검은색 */
    background-color: #ff6a00;        /* 버튼 범위 테마색 */
}



/* ================== 마이페이지 전용 ================== */
body.my-info-page .content-area {
    max-width: 700px !important;
}

body.my-info-page .content-area h1 {
    text-align: center;
}

body.my-info-page .user-table {
    margin: 20px auto;
}


/* ------------------ 본문 영역 컨테이너 ------------------ */

.content-wrapper {
    padding-top: 40px; /* ⭐ 수정됨: navbar 높이와 동일하게 */
    min-height: 100vh;
    box-sizing: border-box;
    background-color: #111;
}

/* 본문 영역 전체 폰트 크기 증가 */
.content-area {
    max-width: 1200px;
    width: calc(100% - 40px);
    background: #1a1a1a;
    padding: 32px;
    border-radius: 12px;
    border: 2px solid #ff6a00;
    margin: 0 auto;
    box-sizing: border-box;
    font-size: 17px;      /* ⭐ 기본 폰트 크기 증가 */
}

/* 문서 내부 제목 위 여백 조정 */
.content-area h1 {
    color: #ff6a00;
    border-bottom: 2px solid #ff6a00;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 0.8em;
}

.content-area h2,
.content-area h3,
.content-area h4 {
    color: #ff8833;
    border-bottom: 1px dashed #333;
    padding-bottom: 3px;
    margin-top: -20px;      /* ⭐ 위 여백 추가 */
    margin-bottom: 0.5em;
}

.toc-container h3 {
    color: #ff6a00;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px dashed #333;
    padding-bottom: 5px;
    font-size: 18px;
}

.toc-container ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.toc-container li {
    line-height: 1.6;
}

.official-tag {
    color: #ffb37a;
    font-weight: bold;
    margin-bottom: 20px;
    margin-top: -15px;
}

/* 인물 문서 태그 스타일 */
.person-tag {
    color: #ffeb39;
    font-weight: bold;
    margin-bottom: 20px;
    margin-top: -10px;
}

/* 문서 액션 (편집, 삭제, 역사 버튼) 스타일 */
.document-actions {
    margin-top: -12px; 
    margin-bottom: 10px; 
    display: flex;
    gap: 10px; 
    align-items: center;
}

.document-actions button {
    padding: 4px 15px; 
    background-color: #343434;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.document-actions button:hover {
    background-color: #ff8833;
}

.document-actions form {
    display: inline-block;
    margin: 0;
}


/* ------------------ 목차 스타일 ------------------ */
.toc-container {
    background: #151515;
    border: 1px solid #ff6a00;
    padding: 15px 20px;
    margin-top: 20px; /* ⭐ 위 여백 10px로 축소 */
    margin-bottom: 40px;
    border-radius: 8px;
}

.toc-container h3 {
    color: #ff6a00;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px dashed #333;
    padding-bottom: 5px;
    font-size: 18px;
}

.toc-container ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.toc-container li {
    line-height: 1.6;
}

/* 링크에만 경계선 */
.toc-container li a {
    color: #ccc;
    text-decoration: none;
    font-size: 15px;
    display: block; 
    border-top: 1px dashed #282828;
    padding: 5px 0 2px 0;
}

.toc-container li:first-child a {
    border-top: none;
    padding-top: 2px;
}

.toc-container li a:hover {
    color: #fff;
    text-decoration: underline;
}

.toc-level-1 { padding-left: 5px; font-weight: bold; }
.toc-level-2 { padding-left: 20px; font-size: 0.95em; }
.toc-level-3 { padding-left: 35px; font-size: 0.9em; }
.toc-level-4 { padding-left: 50px; font-size: 0.85em; }

/* ------------------ 로그인/회원가입 폼 ------------------ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px);
    padding-top: 0;
    background-color: transparent;
    box-sizing: border-box;
}

.auth-form {
    width: 360px;
    background: #1a1a1a;
    padding: 28px;
    border-radius: 10px;
    border: 2px solid #ff6a00;
    box-sizing: border-box;
}

.auth-form h2 {
    color: #ff6a00;
    text-align: center;
    margin-bottom: 18px;
}

.auth-form .form-group { margin-bottom: 12px; }

.auth-form input {
    width: 100%;
    padding: 12px;
    background: #222;
    border: 1px solid #444;
    border-radius: 5px;
    color: white;
    box-sizing: border-box;
}

.auth-form button {
    width: 100%;
    height: 40px;
    margin-top: 12px;
    background: #ff6a00;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-form button:hover { background: #ff7f22; }

.auth-subtext {
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    color: #ccc;
}

.auth-subtext a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
}

.auth-subtext a:hover {
    text-decoration: underline;
}

/* ------------------ 테이블 및 리스트 ------------------ */

.user-table {
    border-collapse: collapse;
    margin-top: 20px;
    color: white;
    margin-left: 0;
    margin-right: auto;
}

.user-table th, .user-table td {
    border: 1px solid #ff6a00;
    padding: 10px;
    text-align: center; 
    background: #222;
    font-weight: normal; 
}

.user-table th {
    background: #222; 
    color: #f0f0f0; 
}

/* 검색/역사 결과 리스트 */
.search-results-list, .history-list {
    list-style: none;
    padding: 0;
}
.search-results-list li, .history-list li {
    background: #222; 
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #ff6a00;
}
.search-results-list li a, .history-list li a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
}

.history-list li {
    font-size: 0.9em;
}

/* 최근 변경 리스트 */
.recent-changes-list {
    list-style: none;
    padding: 0;
}
.recent-changes-list li {
    background: #222; 
    margin-bottom: 10px;
    padding: 10px 0 5px 0;
    border-bottom: 1px dashed #333;
}
.recent-changes-list li a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
}
.recent-changes-list li a:hover {
    text-decoration: underline;
}
.muted {
    color: #aaa;
    font-size: 0.9em;
}

/* 위키 기본 테이블 */
.doc-content .wikitable, .doc-content table {
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid #4b4b4b;
    margin-left: 0;
    margin-right: auto;
}

.doc-content .wikitable td, 
.doc-content .wikitable th,
.doc-content table td,
.doc-content table th {
    border: 1px solid #4b4b4b;
    padding: 8px 12px;
    text-align: center; 
    vertical-align: middle !important;
    background-color: #222; 
    font-weight: normal; 
}

.doc-content .wikitable th,
.doc-content table th {
    background: #222; 
    color: #f0f0f0; 
}

/* ================== 편집기 ================== */

.editor-area-wrapper {
    margin-bottom: 10px;
}

#wiki-editor, textarea[name="content"] {
    width: 100%; 
    min-height: 400px;
    padding: 10px;
    background: #111;
    color: white;
    border: 1px solid #ff6a00;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
}

.preview-wrapper {
    min-height: 400px;
    padding: 15px;
    background: #222;
    border: 1px solid #444;
    border-radius: 5px;
    overflow-y: auto;
    box-sizing: border-box;
    margin-top: 20px;
}

.preview-wrapper h3 {
    color: #ff8833;
    border-bottom: 1px dashed #444;
    padding-bottom: 5px;
    margin-top: 0;
}

/* ================== Flash 메시지 ================== */

.flash-messages {
    position: fixed;
    top: 70px; /* navbar 바로 아래 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: none;
}

.flash {
    background: #222;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 8px;
    min-width: 240px;
    text-align: center;
    opacity: 1;
    animation: flashFadeOut 3s ease forwards;
}

.flash.success {
    border-left: 4px solid #4caf50;
}

.flash.error {
    border-left: 4px solid #f44336;
}

.flash.warning {
    border-left: 4px solid #ff9800;
}

/* ================== 최근 변경 리스트 ================== */
.recent-changes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-changes-list li {
    background: #222; 
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 5px; 
    border: none; /* 절대 테두리 없음 */
}

.recent-changes-list li a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
}

.recent-changes-list li a:hover {
    text-decoration: underline;
}

.muted {
    color: #aaa;
    font-size: 0.9em;
}

/* 내 정보 버튼 hover시 글자 검은색 */
.my-info-link:hover {
    color: #000 !important;          /* 글자 검은색 */
    background-color: #ff6a00 !important; /* 배경 주황색 */
}

/* 문서 편집 저장 버튼 스타일 */
form button[type="submit"] {
    background-color: #ff6a00;   /* 주황 배경 */
    color: #fff;                 /* 흰 글자 */
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

form button[type="submit"]:hover {
    background-color: #ff7f22;   /* 호버 시 밝은 주황 */
}

/* 삭제 버튼만 기본 테두리/배경으로 */
.document-actions form button[type="submit"] {
    background-color: #343434;  /* 기존 편집/역사 버튼 배경 */
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 4px 15px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.document-actions form button[type="submit"]:hover {
    background-color: #ff8833; /* 호버 색상 */
}

/* ========================================
   각주 스타일
======================================== */
.footnote-item {
    font-size: 0.9em;
    color: #ccc;
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 2px solid #ff6a00;
}

.footnote-item a {
    color: #ff6a00;
    text-decoration: none;
    margin-left: 5px;
}

.footnote-item a:hover {
    text-decoration: underline;
}

sup a {
    color: #ff6a00;
    text-decoration: none;
    font-weight: bold;
}

sup a:hover {
    text-decoration: underline;
}

/* ================== 각주 팝업 스타일 ================== */
#footnote-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 9998;
    display: none;
}

#footnote-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    /* height 제거 → 세로 제한 없음 */
    background: #1a1a1a;
    color: #f0f0f0;
    border: 2px solid #ff6a00;
    border-radius: 12px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

#footnote-modal-content {
    font-size: 18px; /* 폰트 14px */
    margin-bottom: 20px;
}

#footnote-modal button {
    display: block;
    margin: 0 auto;
    background-color: #ff6a00;
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: bold;
}

/* ========================================
   미리보기 표 스타일
======================================== */
.content-area table,
.doc-content table,
#preview-content-inner table {
    border-collapse: collapse;
    margin: 20px 0;
    width: auto;
    border: 1px solid #4b4b4b;
    background-color: #222;
    color: #f0f0f0;
    font-weight: normal;
    margin-left: 0;
    margin-right: auto;
}

.content-area table th,
.doc-content table th,
#preview-content-inner table thead th {
    border: 1px solid #4b4b4b;
    padding: 8px 12px;
    text-align: center;
    background-color: #222;
    color: #f0f0f0;
    white-space: nowrap;
}

.content-area table td,
.doc-content table td,
#preview-content-inner table tbody td {
    border: 1px solid #4b4b4b;
    padding: 8px 12px;
    text-align: center;
    vertical-align: top;
    background-color: #222;
    color: #f0f0f0;
    white-space: nowrap;
}


@keyframes flashFadeOut {
    0%   { opacity: 1; transform: translateY(0); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10px); }
}

#preview-content-rendered {
    font-size: 1em;
    line-height: 1.6;
}

/* ========================================
   면책 조항 스타일
======================================== */
.wiki-disclaimer {
    max-width: 100%;
    width: calc(100% - 40px);
    margin: 30px auto;
    padding: 20px;
    background: #1a1a1a;
    border: 2px solid #ff6a00;
    border-radius: 8px;
    text-align: center;
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.wiki-disclaimer p {
    margin: 0;
    padding: 0;
    text-align: center;
}

.wiki-disclaimer p:first-child {
    margin-bottom: 2px;
}

.footer-info {
    margin: 20px auto 0 auto;
    margin-bottom: 1px;
    padding: 15px;
    max-width: 100%;
    border-radius: 8px;
    background-color: #1a1a1a;
    color: #fff;
    font-size: 16px;
    text-align: center;
}

.person-tag {
    color: #9400ce;
    font-weight: bold;
    margin-bottom: 20px;
    margin-top: -15px;
}

.admin-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

.admin-btn {
    padding: 16px 30px;
    background-color: #222;
    border: 2px solid #ff6a00;
    border-radius: 6px;
    color: #ff6a00;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 17px;  /* 글씨 크기 추가 */
}

.admin-btn:hover {
    background-color: #ff6a00;
    color: #000;
}

.admin-title {
    margin-bottom: 8px;
    font-size: 14px;
    color: #ff6a00;
    font-weight: bold;
}

.admin-divider {
    border: none;              /* 기본 테두리 제거 */
    height: 1.5px;               /* 두께 */
    background-color: #ff6a00; /* 원하는 색 */
    margin: 10px 0;            /* 위아래 여백 */
}

.buttons-bottom-hr {
    border: none;              /* 기본 테두리 제거 */
    height: 1.5px;               /* 두께 */
    background-color: #292929; /* 원하는 색 */
    margin: 10px 0;            /* 위아래 여백 */
}

.doc-content {
    line-height: 1.35;   /* 줄바꿈 체감 약 1.2배 */
}

/* 문단 */
.doc-content p {
    margin: 0.35em 0;    /* 기본 문단 간격 줄임 */
}

/* 제목 */
.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
    margin-top: 1.0em;  /* 제목 위 간격 */
    margin-bottom: 0.3em; /* 제목 아래 간격 */
}

/* 제목 바로 다음 문단 */
.doc-content h1 + p,
.doc-content h2 + p,
.doc-content h3 + p,
.doc-content h4 + p {
    margin-top: 0.15em;
}

/* <br> 줄바꿈 미세 조정 */
.doc-content br {
    content: "";
    display: block;
    margin-bottom: 0.15em;
}

.document-actions form {
    display: inline;
}

blockquote {
    border-left: 4px solid #ff6a00;
    margin: 5px 0;
    padding: 8px 30px;
    background: #313131;
    border-radius: 0 8px 8px 0;
    color: #ccc;
    font-style: italic;
}

blockquote + * {
    margin-top: 0 !important;
}

.wikitable td {
    vertical-align: middle;
}

.doc-content ul,
.doc-content ol,
#preview-content-inner ul,
#preview-content-inner ol {
    margin: 0;
    padding-left: 20px;
}
.doc-content ul li,
.doc-content ol li,
#preview-content-inner ul li,
#preview-content-inner ol li {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.6;
}

.doc-content ul li p,
.doc-content ol li p,
#preview-content-inner ul li p,
#preview-content-inner ol li p {
    margin: 0;
    padding: 0;
}
