/* KAICE 신문 빌더 - 관리자 페이지 전용 스타일 */

/* 폰트 정의 - S-CoreDream 폰트 추가 */
@font-face {
    font-family: 'S-CoreDream-3';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-3Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
}

/* 1024px 이하 태블릿에서 기사별 비율 유지 (기존 CSS 오버라이드) */
@media (max-width: 1024px) {
    .kaice-newspaper-content .kaice-article-item:nth-child(1) .kaice-article-image img {
        aspect-ratio: 1/1 !important;
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: auto !important;
    }
    
    .kaice-newspaper-content .kaice-article-item:nth-child(2) .kaice-article-image img,
    .kaice-newspaper-content .kaice-article-item:nth-child(3) .kaice-article-image img {
        aspect-ratio: 16/9 !important;
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: auto !important;
    }
}

@font-face {
    font-family: 'S-CoreDream-4';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-4Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'ChosunBg';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@1.0/ChosunBg.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'ChosunKm';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@1.0/ChosunKm.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'ChosunLo';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@1.0/ChosunLo.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* 관리자 페이지 모든 입력란에 S-CoreDream 폰트 적용 */
.kaice-admin-page input[type="text"],
.kaice-admin-page input[type="email"],
.kaice-admin-page input[type="password"],
.kaice-admin-page input[type="number"],
.kaice-admin-page input[type="date"],
.kaice-admin-page input[type="time"],
.kaice-admin-page input[type="url"],
.kaice-admin-page input[type="search"],
.kaice-admin-page textarea {
    background-color: #ffffff !important;
    border: 1px solid !important;
    border-color: #E5E5E5 !important;
    border-radius: 5px !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* 관리자 페이지 전체에 S-CoreDream 폰트 전역 적용 (폰트어썸 제외) */
#kaice-admin-panel,
#kaice-admin-panel *:not(.fa):not(.fas):not(.far):not(.fab):not(.fal):not(.fad):not([class*="fa-"]) {
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* 폰트어썸 아이콘에는 Font Awesome 폰트 강제 적용 */
#kaice-admin-panel .fa,
#kaice-admin-panel .fas,
#kaice-admin-panel .far,
#kaice-admin-panel .fab,
#kaice-admin-panel .fal,
#kaice-admin-panel .fad,
#kaice-admin-panel [class*="fa-"] {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Pro', 'Font Awesome 5 Free', 'Font Awesome 5 Pro' !important;
}

/* 두꺼게 표시될 요소들에 S-CoreDream-4 적용 */
#kaice-admin-panel h1,
#kaice-admin-panel h2,
#kaice-admin-panel h3,
#kaice-admin-panel h4,
#kaice-admin-panel h5,
#kaice-admin-panel h6,
#kaice-admin-panel .kaice-card-header h3,
#kaice-admin-panel strong,
#kaice-admin-panel b {
    font-family: 'S-CoreDream-4', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* 관리자 페이지 모든 select에 S-CoreDream 폰트 및 화살표 적용 */
.kaice-admin-page select {
    background-color: #ffffff !important;
    border: 1px solid !important;
    border-color: #E5E5E5 !important;
    border-radius: 5px !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="%23666" d="M201.4 374.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 306.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px !important;
    padding-right: 40px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

/* 기본 페이지 레이아웃 - S-CoreDream 폰트 적용 */
body.kaice-admin-page {
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    background: #f1f1f1;
    margin: 0;
    padding: 20px;
}

.kaice-admin-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* 헤더 */
.kaice-admin-header {
    background: #0073aa;
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kaice-admin-header h1 {
    margin: 0;
    font-size: 24px;
    font-family: 'S-CoreDream-4', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.kaice-admin-back-btn {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.kaice-admin-back-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

/* 콘텐츠 영역 */
.kaice-admin-content {
    padding: 30px;
}

/* 컨트롤 영역 */
.kaice-admin-controls {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
}

.kaice-admin-controls select {
    width: 250px !important;
    padding: 12px !important;
    background-color: #ffffff !important;
    border: 1px solid !important;
    border-color: #E5E5E5 !important;
    border-radius: 5px !important;
    margin-right: 15px !important;
    box-sizing: border-box !important;
}

/* 버튼 액션 그룹 스타일 - 제목 우측에 배치 */
.kaice-newspaper-actions {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    margin-left: 15px !important;
}

/* 버튼 기본 스타일 */
.kaice-btn {
    padding: 8px 16px !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    color: white !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.kaice-btn:hover {
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    opacity: 0.9 !important;
}

.kaice-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* 수정 버튼 (#222 - 선 색상이며 배경은 흰색, 글자는 검정) - 최고 우선순위 */
.kaice-btn.kaice-btn-warning,
.kaice-newspaper-actions .kaice-btn-warning,
.kaice-btn-warning {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #222222 !important;
    border-color: #222222 !important;
}

.kaice-btn.kaice-btn-warning:hover,
.kaice-newspaper-actions .kaice-btn-warning:hover,
.kaice-btn-warning:hover {
    background-color: #f8f9fa !important;
    background: #f8f9fa !important;
    color: #000000 !important;
    border: 1px solid #222222 !important;
    border-color: #222222 !important;
}

/* 웹용 버튼 (#408090 - 배경색 기준이며 글자는 흰색) */
.kaice-btn-success {
    background-color: #408090 !important;
    color: white !important;
}

.kaice-btn-success:hover {
    background-color: #2e6370 !important;
    color: white !important;
}

/* 출력용 버튼 (#354550 - 배경색 기준이며 글자는 흰색) */
.kaice-btn-info {
    background-color: #354550 !important;
    color: white !important;
}

.kaice-btn-info:hover {
    background-color: #232a33 !important;
    color: white !important;
}

/* 삭제 버튼 (#6c757d - 배경색 기준이며 글자는 흰색) */
.kaice-btn-danger {
    background-color: #6c757d !important;
    color: white !important;
}

.kaice-btn-danger:hover {
    background-color: #545b62 !important;
    color: white !important;
}

/* 주 버튼 (진한 파란색) */
.kaice-btn-primary {
    background-color: #0073aa !important;
    color: white !important;
}

.kaice-btn-primary:hover {
    background-color: #005a87 !important;
    color: white !important;
}

/* 버튼 내 아이콘 스타일 */
.kaice-btn i {
    font-size: 12px !important;
    margin-right: 4px !important;
}

.kaice-btn .fa-spinner {
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 모바일 반응형 - 버튼 수직 배치 */
@media (max-width: 768px) {
    .kaice-newspaper-actions {
        flex-direction: column !important;
        margin-left: 0 !important;
        margin-top: 10px !important;
        align-items: stretch !important;
    }
    
    .kaice-btn {
        justify-content: center !important;
        width: 100% !important;
        margin-bottom: 5px !important;
    }
    
    .kaice-newspaper-title {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .kaice-newspaper-title h2 {
        margin-bottom: 10px !important;
    }
}

/* 알림 메시지 */
.kaice-admin-alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin: 15px 0;
}

.kaice-admin-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.kaice-admin-alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* 권한 없음 메시지 스타일 */
.permission-content {
    height: 300px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

.permission-center-wrapper {
    width: 100% !important;
    margin: 0 auto !important;
}

.permission-message {
    font-size: 16px !important;
    color: #333 !important;
    margin-bottom: 30px !important;
    line-height: 1.5 !important;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.permission-actions {
    display: flex !important;
    justify-content: center !important;
    gap: 8px !important;
    margin-top: 20px !important;
}

.permission-actions .kaice-btn {
    display: inline-block !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.permission-actions .kaice-btn:hover {
    opacity: 0.9 !important;
    transform: translateY(-1px) !important;
    text-decoration: none !important;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .permission-actions {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .permission-actions .kaice-btn {
        width: 200px !important;
        text-align: center !important;
        margin-right: 0 !important;
    }
}

/* 기존 권한 오류 메시지 (호환성 유지) */
.kaice-admin-error {
    max-width: 600px;
    margin: 40px auto;
    background: #fff3cd;
    color: #856404;
    padding: 30px;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    border-left: 5px solid #dc3545;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.kaice-admin-error h3 {
    margin: 0 0 20px 0;
    color: #dc3545;
    font-size: 20px;
    font-weight: 600;
}

.kaice-admin-error p {
    margin: 0 0 15px 0;
    line-height: 1.6;
}

.kaice-status-info {
    background: rgba(255,255,255,0.7);
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.kaice-status-info p {
    margin: 10px 0;
    font-size: 14px;
}

.kaice-status-info strong {
    color: #495057;
}

.kaice-login-guide {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.kaice-login-guide p {
    font-size: 16px;
    color: #6c757d;
    margin: 0;
}

/* 학생 목록 스타일 */
.kaice-students-list {
    text-align: center;
    padding: 20px;
}

.kaice-students-list.loading {
    color: #666;
}

.kaice-students-list.loading i {
    margin-right: 8px;
    color: #0073aa;
}

.kaice-students-list.empty {
    color: #666;
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px;
}

.kaice-students-list.empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
    color: #6c757d;
    display: block;
}

.kaice-students-list.empty h4 {
    margin: 10px 0;
    color: #495057;
}

.kaice-students-list.empty p {
    margin: 5px 0;
    font-size: 14px;
    color: #6c757d;
}

.kaice-students-list.empty small {
    color: #868e96;
}

/* 신문 목록 스타일 */
.kaice-newspapers-list {
    text-align: center;
    padding: 20px;
}

.kaice-newspapers-list.loading {
    color: #666;
}

.kaice-newspapers-list.loading i {
    margin-right: 8px;
    color: #0073aa;
}

.kaice-newspapers-list.empty {
    color: #666;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 40px;
}

.kaice-newspapers-list.empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
    color: #6c757d;
    display: block;
}

.kaice-newspapers-list.empty h4 {
    margin: 10px 0;
    color: #495057;
}

.kaice-newspapers-list.empty p {
    margin: 5px 0;
    font-size: 14px;
    color: #6c757d;
}

.kaice-newspapers-list.empty small {
    color: #868e96;
}

/* 디버깅 도구 스타일 */
.kaice-debug-container {
    font-family: Arial, sans-serif;
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
}

.kaice-debug-section {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border-left: 4px solid #0073aa;
}

.kaice-debug-section h3 {
    margin-top: 0;
}

.kaice-debug-success {
    color: green;
    font-weight: bold;
}

.kaice-debug-error {
    color: red;
    font-weight: bold;
}

.kaice-debug-warning {
    color: orange;
    font-weight: bold;
}

.kaice-debug-data {
    background: #f6f7f7;
    padding: 10px;
    margin: 10px 0;
}

.kaice-debug-data pre {
    background: #fff;
    padding: 10px;
    overflow-x: auto;
    margin: 0;
}

.kaice-debug-list {
    margin: 0;
    padding-left: 20px;
}

.kaice-debug-list li {
    margin: 5px 0;
}

.kaice-debug-highlight {
    color: blue;
    font-weight: bold;
}

.kaice-debug-temp-role {
    color: red;
    font-weight: bold;
}

.kaice-debug-guide {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border-left: 4px solid #dc3545;
}

.kaice-debug-guide h3 {
    margin-top: 0;
}

.kaice-debug-guide ul {
    margin: 0;
    padding-left: 20px;
}

.kaice-debug-guide li {
    margin: 5px 0;
}

.kaice-debug-guide code {
    background: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

/* 학생 그리드 스타일 - 최고 우선순위 */
body .kaice-newspaper-builder #kaice-admin-panel .kaice-students-grid,
body .kaice-newspaper-builder .kaice-students-grid,
body #students-list .kaice-students-grid,
.kaice-students-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 20px !important;
    padding: 20px 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 학생 카드 스타일 - 최고 우선순위 */
body .kaice-newspaper-builder #kaice-admin-panel .kaice-student-card,
body .kaice-newspaper-builder .kaice-student-card,
body #students-list .kaice-student-card,
.kaice-student-card {
    display: block !important;
    background: #fff !important;
    border-radius: 5px !important;
    padding: 20px !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    float: none !important;
    width: auto !important;
    margin-bottom: 0 !important;
    clear: none !important;
    position: relative !important;
    flex: none !important;
}

#kaice-admin-panel .kaice-student-card:hover,
.kaice-newspaper-builder .kaice-student-card:hover,
#students-list .kaice-student-card:hover {
    border-color: #408090!important;
    transform: translateY(-2px) !important;
}

#kaice-admin-panel .kaice-student-card.selected,
.kaice-newspaper-builder .kaice-student-card.selected,
#students-list .kaice-student-card.selected {
    border-color: #408090;
}

#kaice-admin-panel .kaice-student-card i,
.kaice-newspaper-builder .kaice-student-card i,
#students-list .kaice-student-card i {
    color: #408090 !important;
    margin-bottom: 10px !important;
    display: block !important;
}

#kaice-admin-panel .kaice-student-card strong,
.kaice-newspaper-builder .kaice-student-card strong,
#students-list .kaice-student-card strong {
    display: block !important;
    font-size: 16px !important;
    color: #333 !important;
    margin: 8px 0 !important;
    font-family: 'S-CoreDream-4', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

#kaice-admin-panel .kaice-student-card small,
.kaice-newspaper-builder .kaice-student-card small,
#students-list .kaice-student-card small {
    display: block !important;
    font-size: 14px !important;
    color: #666 !important;
    margin-top: 5px !important;
}

/* '전체' 학생 카드 특별 스타일 */
#kaice-admin-panel .kaice-student-card-all,
.kaice-newspaper-builder .kaice-student-card-all,
#students-list .kaice-student-card-all {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

#kaice-admin-panel .kaice-student-card-all:hover,
.kaice-newspaper-builder .kaice-student-card-all:hover,
#students-list .kaice-student-card-all:hover {
    transform: translateY(-3px) !important;
}

#kaice-admin-panel .kaice-student-card-all strong,
.kaice-newspaper-builder .kaice-student-card-all strong,
#students-list .kaice-student-card-all strong {
    font-weight: bold !important;
}

/* 신문 카드 스타일 */
.kaice-newspaper-card {
    background: #fff;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: block;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* 제목과 액션 버튼을 가로로 배치 */
.kaice-newspaper-title {
    display: flex!important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kaice-newspaper-title h2 {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    margin: 0;
    font-family: 'S-CoreDream-4', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    line-height: 1.3;
    flex: 1;
}

.kaice-newspaper-info {
    width: 100%;
}

.kaice-newspaper-meta {
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

.kaice-newspaper-meta p {
    font-size: 14px;
    color: #666;
    margin: 4px 0;
    line-height: 1.5;
}

.kaice-newspaper-content {
    padding: 12px 0;
    border-top: 1px solid #f0f0f0;
}

/* 기사 아이템 레이아웃 - 이미지 왼쪽, 텍스트 오른쪽 */
.kaice-newspaper-content .kaice-article-item {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f5;
    display: grid;
    grid-template-columns: 280px 1fr; /* 이미지 120px에서 180px로 증가, 텍스트 나머지 */
    gap: 20px; /* 간격도 15px에서 20px로 증가 */
    align-items: start;
}

.kaice-newspaper-content .kaice-article-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 기사 이미지 - 왼쪽 열 */
.kaice-newspaper-content .kaice-article-image {
    grid-column: 1;
    margin: 0;
    width: 100%;
}

/* 기사 1 이미지 - 1:1 비율 */
.kaice-newspaper-content .kaice-article-item:nth-child(1) .kaice-article-image {
    aspect-ratio: 1/1;
}

.kaice-newspaper-content .kaice-article-item:nth-child(1) .kaice-article-image img {
    aspect-ratio: 1/1 !important;
    object-fit: cover !important;
    object-position: center !important;
    width: 100% !important;
    height: auto !important;
}

.kaice-newspaper-content .kaice-article-item:nth-child(1) .kaice-image-placeholder {
    aspect-ratio: 1/1;
    height: auto; /* 자동 높이로 변경하여 1:1 비율 유지 */
}

/* 기사 2, 3 이미지 - 16:9 비율 (더 구체적인 선택자로 우선순위 강화) */
.kaice-newspaper-content .kaice-article-item:nth-child(2) .kaice-article-image,
.kaice-newspaper-content .kaice-article-item:nth-child(3) .kaice-article-image {
    aspect-ratio: 16/9;
}

.kaice-newspaper-content .kaice-article-item:nth-child(2) .kaice-article-image img,
.kaice-newspaper-content .kaice-article-item:nth-child(3) .kaice-article-image img {
    aspect-ratio: 16/9 !important;
    object-fit: cover !important;
    object-position: center !important;
    width: 100% !important;
    height: auto !important;
}

.kaice-newspaper-content .kaice-article-item:nth-child(2) .kaice-image-placeholder,
.kaice-newspaper-content .kaice-article-item:nth-child(3) .kaice-image-placeholder {
    aspect-ratio: 16/9;
    height: auto; /* 자동 높이로 변경하여 16:9 비율 유지 */
}

/* 텍스트 내용 - 오른쪽 열 */
.kaice-newspaper-content .kaice-article-text {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 제목과 내용이 기존처럼 직접 배치되어 있는 경우 처리 */
.kaice-newspaper-content .kaice-article-item h3 {
    font-size: 20px;
    color: #333;
    margin: 0 0 6px 0;
    font-weight: normal!important;
    line-height: 1.6;
    grid-column: 2; /* h3도 오른쪽 열에 배치 */
}

.kaice-newspaper-content .kaice-article-item p {
    font-size: 16px;
    color: #555;
    margin: 0;
    line-height: 1.8;
    grid-column: 2; /* p도 오른쪽 열에 배치 */
}

/* 모바일 반응형 - 세로 배치 */
@media (max-width: 768px) {
    .kaice-newspaper-content .kaice-article-item {
        display: flex;
        flex-direction: column;
        gap: 8px;
        grid-template-columns: none; /* 그리드 비활성화 */
    }
    
    .kaice-newspaper-content .kaice-article-image {
        order: 1; /* 이미지 첫 번째 */
        width: 100%;
        grid-column: auto; /* 그리드 컴럼 비활성화 */
    }
    
    /* 모바일에서도 비율 유지 (강화된 우선순위) */
    .kaice-newspaper-content .kaice-article-item:nth-child(1) .kaice-article-image {
        aspect-ratio: 1/1 !important;
    }
    
    .kaice-newspaper-content .kaice-article-item:nth-child(1) .kaice-article-image img {
        aspect-ratio: 1/1 !important;
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: auto !important;
    }
    
    .kaice-newspaper-content .kaice-article-item:nth-child(2) .kaice-article-image,
    .kaice-newspaper-content .kaice-article-item:nth-child(3) .kaice-article-image {
        aspect-ratio: 16/9 !important;
    }
    
    .kaice-newspaper-content .kaice-article-item:nth-child(2) .kaice-article-image img,
    .kaice-newspaper-content .kaice-article-item:nth-child(3) .kaice-article-image img {
        aspect-ratio: 16/9 !important;
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: auto !important;
    }
    
    .kaice-newspaper-content .kaice-article-text {
        order: 2; /* 텍스트 두 번째 */
        grid-column: auto; /* 그리드 컴럼 비활성화 */
    }
    
    .kaice-newspaper-content .kaice-article-item h3 {
        order: 1; /* 텍스트 내에서 제목 첫 번째 */
        margin-bottom: 4px;
        grid-column: auto; /* 그리드 컴럼 비활성화 */
    }
    
    .kaice-newspaper-content .kaice-article-item p {
        order: 2; /* 텍스트 내에서 내용 두 번째 */
        grid-column: auto; /* 그리드 컴럼 비활성화 */
    }
}

.kaice-newspaper-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: 15px;
}

.kaice-newspaper-actions .kaice-btn {
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
}

/* 관리자 검색 행 스타일 */
.kaice-admin-search-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.kaice-admin-search-row .kaice-form-control {
    flex: 1;
    min-width: 200px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .kaice-students-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .kaice-student-card {
        padding: 15px;
    }
    
    /* 모바일에서는 제목과 버튼을 세로로 배치 */
    .kaice-newspaper-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .kaice-newspaper-title h2 {
        margin-bottom: 0;
    }
    
    .kaice-newspaper-actions {
        margin-left: 0;
        justify-content: flex-start;
        width: 100%;
    }
    
    .kaice-newspaper-actions .kaice-btn {
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .kaice-admin-search-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* 추가 버튼 스타일 */
.kaice-btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.kaice-btn:hover {
    text-decoration: none;
}

.kaice-btn-primary {
    background-color: #0073aa;
    color: white;
}

.kaice-btn-primary:hover {
    background-color: #005a87;
    color: white;
}

.kaice-btn-admin {
    background-color: #6c757d;
    color: white;
}

.kaice-btn-admin:hover {
    background-color: #5a6268;
    color: white;
}

.kaice-admin-mode .empty h4 {
    font-size: 16px;
}

.kaice-admin-mode .empty p {
    font-size: 14px;
}

.kaice-admin-mode .empty small {
    font-size: 12px;
}

/* 신문 목록 헤더 스타일 */
.article-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.article-form-header h3 {
    margin: 0;
    font-family: 'S-CoreDream-4', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.article-status-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 기사 이미지 스타일 */
.kaice-article-image {
    margin: 8px 0;
    width: 100%;
}

.kaice-article-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.kaice-image-placeholder {
    width: 100%;
    height: 120px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    font-family: 'S-CoreDream-3', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* 이미지 비율에 따른 스타일 */
.kaice-article-image[data-ratio="16:9"] .kaice-image-placeholder {
    height: 100px;
}

.kaice-article-image[data-ratio="1:1"] .kaice-image-placeholder {
    height: 120px;
}

/* =================================================================== */
/* 버튼 색상 최종 오버라이드 - 가장 강력한 우선순위 적용 */
/* =================================================================== */

/* 수정 버튼 강제 적용 - 모든 가능한 선택자 조합 */
body .kaice-newspaper-builder .kaice-btn.kaice-btn-warning,
body .kaice-newspaper-builder .kaice-newspaper-actions .kaice-btn-warning,
body .kaice-newspaper-builder .edit-newspaper,
body #kaice-admin-panel .kaice-btn-warning,
body #kaice-admin-panel .edit-newspaper,
.kaice-btn.kaice-btn-warning,
.edit-newspaper {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #222222 !important;
    border-color: #222222 !important;
}

body .kaice-newspaper-builder .kaice-btn.kaice-btn-warning:hover,
body .kaice-newspaper-builder .kaice-newspaper-actions .kaice-btn-warning:hover,
body .kaice-newspaper-builder .edit-newspaper:hover,
body #kaice-admin-panel .kaice-btn-warning:hover,
body #kaice-admin-panel .edit-newspaper:hover,
.kaice-btn.kaice-btn-warning:hover,
.edit-newspaper:hover {
    background-color: #f8f9fa !important;
    background: #f8f9fa !important;
    color: #000000 !important;
    border: 1px solid #222222 !important;
    border-color: #222222 !important;
}