/* Minimalist Theme v2.1 (Layout Fixed) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    --bg-color: #f5f5f7;
    --surface-color: #ffffff;
    --border-color: #d2d2d7;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent-color: #0066cc;
    --danger-color: #d93025;
    --font-sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- 기본 & 애니메이션 --- */
body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    padding: 40px 20px;
    margin: 0;
    line-height: 1.6;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.container, .login-box {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 30px 40px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.07);
}

/* --- 타이포그래피 & 링크 --- */
h1, h2 {
    color: var(--text-primary);
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 15px;
    margin-top: 0;
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 32px;
}
h1 .fa-solid, h2 .fa-solid {
    color: var(--accent-color);
    margin-right: 15px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}
a:hover {
    filter: brightness(1.1);
}

/* --- 테이블 --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    padding: 18px 15px;
    border-bottom: 1px solid #e5e5e5;
    text-align: center;
    vertical-align: middle;
}
th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}
td.post-title {
    text-align: left;
    font-weight: 500;
}
tr:last-child td {
    border-bottom: none;
}
tr { transition: background-color 0.2s; }
tr:hover {
    background-color: #f9f9f9;
}

/* --- 폼 요소 (입력창, 버튼) --- */
input, textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: 12px;
    background-color: #f5f5f7;
    color: var(--text-primary);
    border: 1px solid transparent;
    box-sizing: border-box;
    font-family: var(--font-sans);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: rgba(0, 102, 204, 0.5);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.button, button {
    background-color: var(--accent-color);
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.button:hover, button:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.2);
}
.button:active, button:active {
    transform: scale(0.98);
}
.button-danger {
    background-color: var(--danger-color);
}
.button-danger:hover {
    box-shadow: 0 4px 15px rgba(217, 48, 37, 0.2);
}
.button-secondary, .guest-login {
    background-color: #e8e8ed;
    color: var(--text-primary);
}
.button-secondary:hover, .guest-login:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* --- 레이아웃 그룹 --- */
.button-group, .board-actions {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}
.board-actions {
    justify-content: space-between;
}

/* --- 페이지별 스타일 --- */

/* main.php */
.main-header {
    text-align: center;
    margin-bottom: 40px;
}
.main-header h1 {
    border: none;
}
.button-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* 화면이 작아지면 자동으로 줄바꿈 */
    justify-content: center;
}
.link-box {
    flex-grow: 0;
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    background-color: var(--surface-color);
    border: 1px solid transparent;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: all 0.2s ease-in-out;
}
.link-box .fa-solid {
    font-size: 28px;
    color: var(--accent-color);
    margin-bottom: 10px;
}
.link-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: rgba(0,102,204,0.3);
}
footer { margin-top: 50px; color: var(--text-secondary); font-size: 12px; text-align: center; }

/* view.php & comments */
.post-meta, .comment-meta { color: var(--text-secondary); font-size: 14px; }
.post-content { padding: 40px 0; font-size: 17px; line-height: 1.8; color: #333; }
.comment-section { margin-top: 40px; border-top: 1px solid var(--border-color); padding-top: 30px; }
.comment-item { padding: 25px 0; border-bottom: 1px solid #e5e5e5; }
.comment-list li:last-child { border-bottom: none; }
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.comment-actions button { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 13px; font-weight: 500; }
.comment-actions button:hover { color: var(--accent-color); }
.comment-form { margin-top: 30px; background-color: var(--bg-color); padding: 25px; border-radius: 12px; }

/* board.php pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 40px; }
.pagination a { color: var(--text-secondary); text-decoration: none; padding: 10px 16px; border-radius: 8px; font-weight: 500; transition: background-color 0.2s; }
.pagination a:hover { background-color: #e8e8ed; }
.pagination .current-page { background-color: var(--accent-color); color: #fff; }
.pagination .disabled { color: #ccc; pointer-events: none; }

/* --- 관리자용 토글 스위치 스타일 --- */
.admin-controls {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}
.control-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px; /* 너무 넓게 벌어지지 않도록 */
    margin: 0 auto 10px; /* 가운데 정렬 및 간격 */
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.control-group:hover {
    background-color: #f9f9f9;
}
.control-group label {
    font-size: 16px;
    font-weight: 500;
}
.switch {
    position: relative;
    display: inline-block;
    width: 51px; /* 애플 스위치 크기 */
    height: 31px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e9e9eb;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .slider {
    background-color: #34c759; /* 애플 그린 */
}
input:focus + .slider {
    box-shadow: 0 0 1px #34c759;
}
input:checked + .slider:before {
    transform: translateX(20px);
}