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

body {
    font-family: Arial, "Noto Sans KR", sans-serif;
    color: #222;
    background: #f5f6f8;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    width: 1200px;
    max-width: 94%;
    margin: auto;
}

/* HEADER */
header {
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.top {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    color: #1769aa;
}

.logo span {
    color: #222;
}

.user-menu {
    font-size: 14px;
    color: #666;
}

.user-menu a {
    margin-left: 18px;
}

/* NAV */
nav {
    background: #1769aa;
}

.nav-menu {
    display: flex;
    height: 50px;
    align-items: center;
}

.nav-menu a {
    color: white;
    padding: 0 25px;
    font-size: 16px;
    font-weight: bold;
}

.nav-menu a:hover {
    background: #0d4f82;
}

/* BREAKING NEWS */
.breaking {
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.breaking-inner {
    height: 45px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.breaking-title {
    color: #e53935;
    font-weight: bold;
}

.breaking-text {
    color: #444;
}

/* MAIN */
main {
    padding: 30px 0;
}

.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

/* NEWS */
.section-title {
    font-size: 21px;
    font-weight: bold;
    margin-bottom: 15px;
    border-left: 5px solid #1769aa;
    padding-left: 10px;
}

.feature-news {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.feature-image {
    height: 280px;
    background: linear-gradient(135deg,#1769aa,#55a9e6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    font-weight: bold;
}

.feature-content {
    padding: 22px;
}

.category {
    color: #1769aa;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
}

.feature-content h2 {
    font-size: 25px;
    margin-bottom: 10px;
}

.feature-content p {
    color: #666;
    line-height: 1.6;
}

/* NEWS LIST */
.news-list {
    background: white;
    margin-top: 25px;
    border-radius: 8px;
    padding: 20px;
}

.news-item {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item h3 {
    font-size: 17px;
    margin-bottom: 7px;
}

.news-item p {
    color: #777;
    font-size: 13px;
}

.news-date {
    color: #999;
    font-size: 12px;
    white-space: nowrap;
}

/* SIDE */
.side-box {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.side-title {
    font-size: 19px;
    font-weight: bold;
    padding-bottom: 12px;
    border-bottom: 2px solid #333;
    margin-bottom: 10px;
}

.rank-item {
    display: flex;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid #eee;
}

.rank {
    color: #1769aa;
    font-weight: bold;
    width: 20px;
}

.rank-item:last-child {
    border-bottom: none;
}

/* BOARD */
.board {
    margin-top: 30px;
    background: white;
    border-radius: 8px;
    padding: 25px;
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.more {
    color: #1769aa;
    font-size: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f1f3f5;
    padding: 13px;
    font-size: 14px;
}

td {
    padding: 13px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

td.title {
    text-align: left;
}

td.title:hover {
    color: #1769aa;
}

.number,
.date,
.views {
    text-align: center;
    color: #777;
}

/* CATEGORY */
.categories {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.categories a {
    background: white;
    border: 1px solid #ddd;
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 14px;
}

.categories a:hover {
    background: #1769aa;
    color: white;
}

/* SEARCH */
.search-box {
    margin-top: 30px;
    background: white;
    padding: 25px;
    text-align: center;
    border-radius: 8px;
}

.search-box input {
    width: 60%;
    padding: 13px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
}

.search-box button {
    padding: 13px 25px;
    border: none;
    background: #1769aa;
    color: white;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

/* FOOTER */
footer {
    margin-top: 50px;
    background: #222;
    color: #aaa;
    padding: 35px 0;
}

.footer-logo {
    color: white;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
}

footer p {
    font-size: 13px;
    line-height: 1.7;
}

/* MOBILE */
@media(max-width: 768px) {

    .top {
        height: 65px;
    }

    .logo {
        font-size: 22px;
    }

    .user-menu {
        display: none;
    }

    .nav-menu {
        overflow-x: auto;
        white-space: nowrap;
    }

    .nav-menu a {
        padding: 0 15px;
        font-size: 14px;
    }

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

    .feature-image {
        height: 200px;
        font-size: 23px;
    }

    .feature-content h2 {
        font-size: 20px;
    }

    .news-item {
        display: block;
    }

    .news-date {
        display: block;
        margin-top: 6px;
    }

    table th:nth-child(1),
    table td:nth-child(1),
    table th:nth-child(4),
    table td:nth-child(4) {
        display: none;
    }

    .search-box input {
        width: 70%;
    }
}

/* ===================================================
   PHP 버전에서 추가된 스타일
   =================================================== */

.feature-news a.feature-link { display: block; }

.user-menu strong { color: #1769aa; }

/* 알림 메시지 */
.flash {
    padding: 13px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}
.flash.ok  { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.flash.err { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* 카테고리 활성 상태 */
.categories a.active { background: #1769aa; color: #fff; border-color: #1769aa; }
.nav-menu a.active   { background: #0d4f82; }

/* 속보 링크 */
.breaking-text a:hover { color: #1769aa; text-decoration: underline; }

/* 목록 링크 */
.news-item h3 a:hover,
.rank-item a:hover { color: #1769aa; }
.rank-item { align-items: baseline; }
.empty { padding: 30px 0; text-align: center; color: #999; }

/* 본문 보기 */
.view-box {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.view-box h1 { font-size: 26px; line-height: 1.4; margin-bottom: 12px; }
.view-meta {
    color: #888;
    font-size: 13px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 25px;
}
.view-meta span { margin-right: 14px; }
.view-content { line-height: 1.9; font-size: 16px; color: #333; word-break: break-word; }

/* 버튼 */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border: 1px solid #1769aa;
    background: #1769aa;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { background: #0d4f82; }
.btn.line  { background: #fff; color: #1769aa; }
.btn.line:hover { background: #f1f7fc; }
.btn.danger { background: #e53935; border-color: #e53935; }
.btn-row { margin-top: 25px; display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .right { margin-left: auto; }
.btn-row form { display: inline; }

/* 폼 */
.form-box {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 560px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.form-box.wide { max-width: 100%; }
.form-box h1 { font-size: 22px; margin-bottom: 22px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 14px; font-weight: bold; margin-bottom: 6px; }
.form-row input[type=text],
.form-row input[type=password],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
}
.form-row textarea { min-height: 260px; resize: vertical; line-height: 1.6; }
.form-row .hint { font-size: 12px; color: #999; margin-top: 4px; }
.form-row.check label { font-weight: normal; display: flex; gap: 8px; align-items: center; }

/* 페이지네이션 */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 25px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #ddd; border-radius: 4px; background: #fff; font-size: 14px;
}
.pagination a:hover { background: #f1f7fc; }
.pagination .current { background: #1769aa; color: #fff; border-color: #1769aa; }

/* 검색 결과 */
.result-count { color: #888; font-size: 14px; margin-bottom: 15px; }
.search-box form { display: block; }

/* 관리자 표 */
td.left, th.left { text-align: left; }
.inline-form { display: inline; }
.link-btn { background: none; border: none; color: #e53935; cursor: pointer; font-size: 13px; }

@media(max-width: 768px) {
    .view-box, .form-box { padding: 20px; }
    .view-box h1 { font-size: 21px; }
}

/* ===== 이미지 업로드 ===== */
.feature-image { overflow: hidden; }
.feature-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.view-image { margin: 0 0 25px; text-align: center; }
.view-image img { max-width: 100%; height: auto; border-radius: 6px; }

.news-item .thumb {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.img-mark { font-size: 12px; margin-left: 4px; }

.form-row input[type=file] { font-size: 14px; }
.current-image { margin-bottom: 10px; }
.current-image img {
    display: block;
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-bottom: 6px;
}
.current-image label { display: flex; gap: 6px; align-items: center; font-weight: normal; }

@media(max-width: 768px) {
    .news-item .thumb { width: 100%; height: auto; max-height: 200px; margin-top: 8px; }
}
