/* app/static/css/layout_base.css */
body {
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
}
.container {
    width: 1200px;
    margin: 0 auto;
}

.container-fluid {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

.header {
    background-color: #4a90e2;
    color: white;
    padding: 15px 0;
    border-bottom: 5px solid #357ABD;
}
.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header .left-section {
    font-size: 0.9em;
}
.header .logo {
    font-size: 2em;
    font-weight: 700;
}
.header .title {
    font-size: 1.5em;
    font-weight: 700;
}
.nav {
    background-color: #357ABD;
    color: white;
    padding: 12px 0;
}
.nav .container {
    display: flex;
    justify-content: flex-start;
}
.nav a {
    color: white;
    text-decoration: none;
    margin-right: 25px;
    font-size: 1.1em;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.nav a:hover, .nav a.active {
    background-color: #4a90e2;
}

/* 네비게이션 그룹 스타일 */
.nav-group {
    display: flex;
    flex-direction: column;
    margin-right: 25px;
}

.nav-main {
    color: white;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 4px 4px 0 0;
    transition: background-color 0.2s;
    border-bottom: 2px solid #4a90e2;
}

.nav-sub {
    color: white;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 0 0 4px 4px;
    transition: background-color 0.2s;
    background-color: #4a90e2;
    margin-top: -1px;
}

.nav-main:hover, .nav-main.active {
    background-color: #4a90e2;
}

.nav-sub:hover, .nav-sub.active {
    background-color: #357ABD;
}
.main-content {
    padding: 30px 0;
}
.main-content .container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.flash-messages {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}
.flash-messages .success {
    background-color: #e0f2e9;
    color: #28a745;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
}
h1, h2, h3 {
    color: #357ABD;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
th {
    background-color: #f2f7fc;
    font-weight: 700;
}
.button, button, input[type="submit"] {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
    transition: background-color 0.2s;
}
.button:hover, button:hover, input[type="submit"]:hover {
    background-color: #357ABD;
}
.button-secondary {
    background-color: #6c757d;
}
.button-secondary:hover {
    background-color: #5a6268;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.form-check-group {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-group .label-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* 입력 필드와의 간격 */
}

/* 폼 그룹 내의 라벨 기본 스타일 */
.form-group > label, .form-group .form-label {
    display: block;
    margin-bottom: 0.5rem; /* 라벨과 필드 사이 간격 통일 */
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.input-with-button {
    display: flex;
    align-items: center;
}

.input-with-button .form-control {
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-with-button .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap; /* 버튼 텍스트가 줄바꿈되지 않도록 */
}

.label-with-button > .form-label {
    display: inline;
    margin-bottom: 0;
}

/* --- form_fields.css 에서 가져온 스타일 --- */

/* h1, h2 태그는 layout_base.css 에 이미 정의되어 있으므로, 
   form 내에서만 다르게 보일 필요가 있다면 .form-section h1 같은 방식으로 한정해야 함.
   우선은 layout_base.css의 스타일을 따르도록 중복 선언을 제거. */

.form-section {
    margin-bottom: 30px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    flex: 1; /* 동일한 너비 */
    display: flex;
    flex-direction: column;
    min-width: calc(50% - 0.5rem); /* gap 고려 */
}

.form-group.full-width {
    flex-basis: 100%;
}

/* 라벨 스타일은 layout_base.css의 것을 따르도록 중복 제거 */

.form-control, .form-control-file {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    height: 38px; /* 모든 입력 필드 높이 강제 통일 */
    box-sizing: border-box; /* 패딩, 테두리를 높이에 포함시켜 계산 */
}

.form-control:focus {
    border-color: #4a90e2; /* 테마 색상과 통일 */
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.25);
    outline: none;
}

.form-control[readonly] {
    background-color: #e9ecef;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.checkbox-section {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    background-color: #f8f9fa;
}

.checkbox-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

/* form-check-group은 layout_base.css에 이미 있으므로 li 스타일만 추가 */
.form-check-group li {
    display: inline-block;
}

.form-check-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

/* 이미지 관련 스타일 */
#drop-area {
    border: 2px dashed #4a90e2;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    color: #4a90e2;
    cursor: pointer;
    background-color: #f0f8ff;
    margin-bottom: 20px;
}

#drop-area.highlight {
    background-color: #e0f0ff;
}

#image-preview-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.image-box {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 비율 */
    border-radius: 8px;
    overflow: hidden;
    background-color: #eee;
}

.image-box img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.image-box:hover .delete-btn {
    opacity: 1;
}

.ribbon {
    position: absolute;
    top: 10px;
    left: -15px;
    background-color: #e44d26;
    color: white;
    padding: 5px 20px;
    transform: rotate(-45deg);
    font-size: 12px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    z-index: 5;
}

/* --- 이미지 업로드 (복구) --- */
.image-upload-box {
    border: 2px dashed #4a90e2;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background-color: #f8faff;
    transition: background-color 0.2s;
}

.image-upload-box:hover, .image-upload-box.drag-over {
    background-color: #eaf2ff;
}

#image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.image-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #eee;
    aspect-ratio: 1 / 1;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-preview-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-preview-item:hover .delete-btn {
    opacity: 1;
}

.image-preview-item .representative-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    padding: 5px 8px;
    background-color: #4a90e2;
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-bottom-right-radius: 8px;
}

/* --- 체크박스 그룹 스타일 (수정) --- */
.form-check-group, 
.form-group-checkboxes ul {
    list-style-type: none; /* 점 제거 */
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-check-group li, 
.form-group-checkboxes ul li {
    display: inline-block; /* 가로 정렬 */
    margin-right: 10px;
}

.form-check-group label,
.form-group-checkboxes ul li label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

/* --- 라이트박스 (이미지 크게 보기) 모달 스타일 --- */
.lightbox-modal {
    display: none; /* 기본적으로 숨김 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}
