/* (기존 스타일 그대로 유지) */

.bg_ex25 {
    background-color: #fdf5f5 !important;
    /* 광고 배경색 완화 */
}

.board-list {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 상단 게시판 정보 영역 (RSS, 전체 건수, 관심게시판, 전체선택) */
.board-info {
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.board-info .text-gray {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    color: #64748b !important;
}

.board-info .text-gray a.text-gray:hover {
    color: #860836 !important;
}

.board-info .text-gray u {
    text-decoration: none;
    font-weight: 700;
    color: #1e293b;
}

.favorite-setup {
    display: inline-flex;
    align-items: center;
}

.favorite-setup .toggle {
    margin-bottom: 0;
}

/* 체크박스 및 토글 정렬 보정 */
.board-info .eyoom-form {
    display: inline-flex;
    align-items: center;
}

.board-info .eyoom-form label {
    margin-bottom: 0;
    cursor: pointer;
}

/* 관리자 설정 영역 스타일 복원 */
.board-list .board-setup {
    position: relative;
    border: 1px solid #d5d5d5;
    height: 38px;
    margin-bottom: 20px
}

.board-list .board-setup .select {
    position: absolute;
    top: -1px;
    left: -1px;
    display: inline-block;
    width: 200px
}

.board-list .board-setup-btn-box {
    position: absolute;
    top: -1px;
    right: -1px;
    display: inline-block;
    width: 420px
}

.board-list .board-setup-btn {
    float: left;
    width: 25%;
    height: 38px;
    line-height: 38px;
    color: #fff;
    text-align: center;
    font-size: .8125rem
}

.board-list .board-setup-btn:nth-child(odd) {
    background-color: #000
}

.board-list .board-setup-btn:nth-child(even) {
    background-color: #3c3c3e
}

.board-list .board-setup-btn:hover {
    opacity: 0.8
}

.board-list .favorite-setup {
    display: inline-block;
    width: 125px;
    margin-left: 15px
}

.board-list .favorite-setup .toggle {
    padding-right: 45px
}

/* 카드 컨테이너 */
.contest-list-b {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

/* 개별 카드 스타일 */
.contest-card-b {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    position: relative;
    padding: 15px;
}

.contest-card-b:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

/* 왼쪽: 체크박스 + 썸네일 */
.card-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.card-checkbox {
    padding-left: 5px;
}

.card-thumb {
    width: 100px;
    height: 130px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.card-thumb .thumb-box {
    width: 100%;
    height: 100%;
    position: relative;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 중앙: 메인 정보 */
.card-main {
    flex-grow: 1;
    padding: 0 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    /* Flex item truncation fix */
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
    /* Flex item truncation fix */
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    transition: color 0.2s;
    flex-basis: 100%;
}

.card-title:hover {
    color: #810834;
}

.d-day-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.badge-notice {
    background: #ef4444;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.new-icon {
    font-size: 0.7rem;
    color: #ef4444;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: top;
}

.mobile-show {
    display: none !important;
}

.card-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 20px;
    font-size: 0.8rem;
    color: #444;
    /* 조금 더 검은색톤 */
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-item i {
    width: 14px;
    color: #94a3b8;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #333;
    /* 글자색 조금 더 진하게 */
    background: #fff;
    /* 하얀 배경 */
    border: 1px solid #d1d5db;
    /* 검은회색톤 라인 */
    padding: 0px 5px;
    border-radius: 4px;
    margin-right: 2px;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
}

/* 오른쪽: 마감일 + 관리도구 */
.card-right {
    flex-shrink: 0;
    width: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    padding-left: 20px;
    border-left: 1px solid #f1f5f9;
}

.deadline-date {
    text-align: right;
    margin-bottom: 10px;
}

.deadline-date .label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

.deadline-date .date {
    font-size: 0.72rem;
    font-weight: 700;
    color: #1e293b;
}

.modal-view-btn {
    margin-top: 5px;
    width: 100%;
}

.modal-view-btn .btn-e {
    padding: 3px 0;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 65px;
    /* D-Day 배지와 동일한 너비 고정 */
    background: #fff !important;
    color: #111 !important;
    /* 확실히 보이도록 검은색 계열 적용 */
    border: 1px solid #d1d5db;
    border-radius: 4px;
    /* D-Day 배지와 동일한 라운드 */
    margin-left: auto;
}

.card-admin-tools {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.75rem;
}

.admin-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.clickable-text {
    cursor: pointer;
    text-decoration: underline;
}

.clickable-text.blue {
    color: #3b82f6;
}

.clickable-text.red {
    color: #ef4444;
}

/* 상단 버튼 및 상세검색 스타일 복원 */
/* 상단 버튼 및 상세검색 스타일 Redesign */
.center-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    /* 간격 균일화 */
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn-custom {
    background-color: #fff;
    color: #555;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 5px;
    /* 라운드 줄이기 */
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-custom:hover {
    background-color: #f8fafc;
    border-color: #b0b0b0;
    color: #333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-custom.active {
    background-color: #860836 !important;
    border-color: #860836 !important;
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(134, 8, 54, 0.3);
}

/* 마감달력, 검색초기화 등 기능성 버튼은 약간 다르게 */
.btn-calendar {
    color: #444;
}

#searchPanel {
    font-size: 13px;
}

.search-table {
    width: 100%;
    border: 1px solid #ddd;
    border-collapse: collapse;
    table-layout: fixed;
}

.search-table th,
.search-table td {
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
    padding: 5px;
}

.search-table th {
    width: 150px;
    background: #f2f2f2;
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
}

.toggle-label {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f9f9f9;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    min-width: 38px;
    min-height: 25px;
    text-align: center;
}

.toggle-label input[type="checkbox"]:checked+span {
    background: #860836;
    color: #fff;
    border-color: #860836;
}

.btn-search {
    padding: 3px 6px;
    font-size: 11px;
    cursor: pointer;
    margin-left: 5px;
}

/* 광고 말풍선 스타일 */
.contest-list-b .contest-card-b .card-header .ad-comment-bubble {
    position: relative !important;
    background: #fff !important;
    border: 1px solid #bc7b8e !important;
    /* #860836 계열 약간 옅게 */
    color: #333 !important;
    /* 검은색톤 */
    padding: 2px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
    margin-top: 5px !important;
    /* 간격 늘림 (현재 5px) */
    margin-bottom: 10px !important;
    /* 하단 간격 늘림 */
    display: inline-block !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: visible !important;
    /* 말꼬리 보이게 필히 visible */
}

.contest-list-b .contest-card-b .card-header .ad-comment-bubble::after {
    content: '' !important;
    position: absolute !important;
    top: -5px !important;
    left: 15px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
    border-bottom: 5px solid #bc7b8e !important;
}

.contest-list-b .contest-card-b .card-header .ad-comment-bubble::before {
    content: '' !important;
    position: absolute !important;
    top: -4px !important;
    left: 15px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
    border-bottom: 5px solid #fff !important;
    z-index: 1 !important;
}

.contest-list-b .contest-card-b .card-header .ad-comment-bubble .bubble-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .contest-card-b {
        display: grid;
        grid-template-columns: 85px 1fr;
        grid-template-areas:
            "thumb main"
            "thumb right";
        padding: 10px;
        gap: 8px 15px;
        align-items: start;
    }

    .card-left {
        grid-area: thumb;
        width: 85px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .card-checkbox {
        padding-left: 0;
    }

    .card-thumb {
        width: 85px;
        height: 115px;
        border-radius: 6px;
    }

    .card-main {
        grid-area: main;
        padding: 0;
        gap: 5px;
        min-width: 0;
    }

    .card-header {
        gap: 4px;
        flex-wrap: wrap;
    }

    .card-title {
        font-size: 0.95rem;
        flex-basis: 100%;
        margin-bottom: 2px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-all;
    }

    .d-day-text {
        font-size: 1rem;
        font-weight: 800;
    }

    .card-info {
        grid-template-columns: 1fr;
        gap: 2px;
        font-size: 0.78rem;
    }

    .card-right {
        grid-area: right;
        display: flex;
        width: 100%;
        border-left: none;
        border-top: 1px solid #f1f5f9;
        padding: 8px 0 0 0;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0;
    }

    .deadline-date {
        margin-bottom: 0;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        justify-content: space-between;
    }

    .deadline-date .m-b-5 {
        margin-bottom: 0 !important;
    }

    .card-admin-tools {
        flex-direction: row;
        gap: 10px;
        margin-top: 5px;
        font-size: 0.7rem;
    }

    .admin-item {
        justify-content: flex-start;
    }

    .center-buttons {
        flex-wrap: wrap;
        gap: 2px;
    }

    .btn-custom {
        font-size: 13px;
        padding: 10px 4px;
        width: auto;
        flex: 1;
    }

    .search-table th {
        width: 25%;
    }

    .mobile-hide {
        display: none !important;
    }

    .mobile-show {
        display: block !important;
    }

    .organizer.mobile-show {
        font-size: 0.8rem;
        font-weight: 600;
        color: #475569;
        text-align: right;
        word-break: break-all;
    }

    /* 모바일에서 말풍선 말줄임 처리 */
    .contest-list-b .contest-card-b .card-header .ad-comment-bubble {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .contest-list-b .contest-card-b .card-header .ad-comment-bubble .bubble-text {
        display: block !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        width: 100% !important;
    }
}

/* 모달 스타일 */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.custom-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 15px;
    border: 1px solid #888;
    width: 90%;
    height: 85%;
    max-width: 800px;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* 닫기 버튼 */
.close-modal {
    color: #fff;
    background: #333;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    position: absolute;
    top: -15px;
    right: -15px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.close-modal:hover,
.close-modal:focus {
    background: #000;
    text-decoration: none;
    cursor: pointer;
}

#modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}


/* 연관 광고 게시물 섹션 */
.related-contests-section {
    margin: 40px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.related-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-title i {
    color: #3b82f6;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.related-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.related-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.related-link {
    text-decoration: none !important;
    color: inherit;
    display: block;
}

.related-thumb {
    width: 100%;
    aspect-ratio: 10/13;
    overflow: hidden;
    background: #f1f5f9;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-thumb .no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #94a3b8;
}

.related-info {
    padding: 10px;
}

.related-subject {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.related-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.related-organizer {
    color: #64748b;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .related-contests-section {
        padding: 15px;
        margin: 30px 0;
    }

    .related-subject {
        font-size: 0.8rem;
    }
}