/*==============================
  1. 폰트
==============================*/
@font-face {
    font-family: 'Pretendard-Regular';
    src: url('https://fastly.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Regular.woff') format('woff');
    font-weight: 400;
}

/*==============================
  2. 기본 바디
==============================*/
body {
    font-family: 'Pretendard-Regular';
    background: #f4f7f6;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/*==============================
  3. 헤더
==============================*/
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 40px;
    background-color: #2d3247;
    color: white;
}

#header-left img {
    height: 40px;
}
#user-info {
    display: flex;
    align-items: center;  /* 수직 가운데 정렬 */
    gap: 10px;            /* 요소 사이 간격 */
    flex-wrap: nowrap;    /* 줄바꿈 방지 */
}

#user-info a {
    color: #fff;
    text-decoration: none;
    margin-left: 15px;
    font-size: 14px;
}

/*==============================
  4. 메뉴 레이아웃
==============================*/
#menu {
    display: flex;
    flex: 1;
    height: calc(100vh - 70px);
}

/* --- 메인 사이드바 --- */
#main-menu {
    background: #333439;
    width: 120px; /* 너비 조정 */
    z-index: 100;
}

#main-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    text-decoration: none;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#main-menu a.active {
    background: #4a516e;
}

#main-menu a i {
    font-size: 24px;
    margin-bottom: 8px;
}

#main-menu a span {
    font-size: 12px;
}

/* --- 서브메뉴 통합 스타일 --- */
#sub-menu {
    width: 0;                   /* 기본값: 접혀 있음 */
    flex-shrink: 0;
    transition: width 0.3s ease; /* 열리고 닫힐 때 부드러운 애니메이션 */
    background: #fff;
    border-right: 0px solid #e0e0e0; /* 접혔을 때 테두리 없음 */
    overflow: hidden;
}

/* 메뉴가 열렸을 때의 상태 */
#sub-menu.open {
    width: 250px;
    border-right: 1px solid #e0e0e0; /* 열렸을 때 테두리 보임 */
}

.sub-menu-header h3 {
    padding: 20px;
    margin: 0;
    background: #edf5fc;
    font-size: 18px;
}

.sub-menu-content ul {
    list-style: none;
    padding: 0;
}

.sub-menu-content li a {
    display: block;
    padding: 15px 20px;
    color: #555;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.sub-menu-content li a.active {
    background: #fff;
    color: #667eea;
    font-weight: bold;
}

/*==============================
  5. 콘텐츠
==============================*/
#content {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background: #fff;
}

#content-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 25px;
}

#page-title {
    margin: 0;
    font-size: 24px;
    display: flex;
    flex-direction: column;
}

#breadcrumb {
    font-size: 14px;
    color: #888;
    margin-top: 5px;
    font-weight: normal;
}

/*==============================
  6. 테이블 헤더 & 검색/버튼
==============================*/
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px;
}

.header-right-controls {
    display: flex;
    align-items: center;
    gap: 10px; /* 검색창과 버튼 사이 간격 */
}

.search-box {
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    padding: 5px 10px;
    border-radius: 20px;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    padding: 5px;
}

.search-box i {
    color: #667eea;
    margin-left: 5px;
    font-size: 16px;
}

.new-entry-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

/*==============================
  7. 테이블
==============================*/
.apartment-table {
    width: 100%;
    border-collapse: collapse;
}

.apartment-table th {
    background: #f8f9fa;
    padding: 12px;
    border-bottom: 2px solid #eee;
    text-align: left;
}

.apartment-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.status-label {
    background: #667eea;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/*==============================
  8. 푸터
==============================*/
footer {
    background: #2d3247;
    color: white;
    padding: 10px 0;
    text-align: center;
    font-size: 13px;
    position: relative;
    bottom: 0;
    width: 100%;
}

/*==============================
  9. 리스트/점 제거
==============================*/
#main-menu ul, 
#sub-menu ul {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

#main-menu li::before,
#sub-menu li::before {
    display: none !important;
}

/*==============================
  10. 페이징 버튼
==============================*/
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 5px;
}

.pagination .page-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
    transition: all 0.2s ease;
}

.pagination .page-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .page-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .page-btn.nav {
    font-weight: bold;
}


/* 모달창 */
#modal-overlay {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

#modal {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#modal label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    align-items: center;
    gap: 10px; /* 라벨 텍스트와 input 사이 간격 */
}

#modal input {
    width: 320px;  /* 원하는 고정 너비 */
    padding: 5px;
    box-sizing: border-box; /* 패딩 포함 너비 계산 */
}


.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#modal-save { background: #667eea; color: #fff; }
#modal-cancel { background: #ccc; color: #333; }

#toggle-btn {
    background: #667eea;        /* 배경색 */
    color: #fff;                /* 아이콘 색상 */
    border: none;
    padding: 8px 10px;          /* 크기 조정 */
    border-radius: 5px;         /* 둥근 모서리 */
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#toggle-btn:hover {
    background: #5563c1;        /* 호버 시 배경 */
}

#menu {
  display: flex;
  height: calc(100vh - 60px - 40px); /* 헤더, 푸터 제외 */
  overflow: hidden;
}




#sub-menu.collapsed {
  width: 0 !important;
  border: none;
}

#content {
  flex-grow: 1; /* 서브메뉴가 사라지면 전체를 채움 */
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
}

/* 활성화 스타일 */
#main-menu ul li a.active {
    background: #4a4e63;
    color: #fff;
}
.sub-link.active {
    color: #3547ff;
    font-weight: bold;
    background: #f0f4ff;
}


/* 전체 폼 그리드 (6열 구조로 세밀하게 분할) */
.table-grid-form {
    display: grid;
    grid-template-columns: 120px 1fr 120px 1fr 120px 1fr;
    border-top: 2px solid #2d3247;
    background-color: #ddd; /* 선 색상 역할을 함 */
    gap: 1px; /* 선 굵기 */
}

.cell {
    background-color: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    min-height: 45px;
}

.cell.label {
    background-color: #f8f9fa;
    font-weight: bold;
    font-size: 13px;
    color: #333;
    justify-content: flex-start;
}

.cell.label.required { color: #d9534f; } /* 필수 항목 빨간색 */

.cell.input input, .cell.input select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

/* 특수 레이아웃 설정 */
.col-span-3 { grid-column: span 3; }
.col-span-5 { grid-column: span 5; }

/* 사진 칸 (우측 상단 4줄 높이 차지) */
.photo-cell {
    grid-column: 5 / 7; /* 5번째 열부터 끝까지 */
    grid-row: 1 / 5;    /* 1행부터 4행까지 */
    flex-direction: column;
    padding: 0;
}

.photo-upload {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
}

/* 버튼 스타일 */
.form-btns {
    margin-top: 25px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn-submit { background: #2d3247; color: #fff; border: none; padding: 12px 60px; cursor: pointer; border-radius: 4px; font-weight: bold; }
.btn-cancel { background: #f1f3f5; color: #333; border: 1px solid #ccc; padding: 12px 60px; cursor: pointer; border-radius: 4px; }

.readonly { background-color: #eceeef; }
.table-grid-form {
    display: grid;
    grid-template-columns: 100px 1fr 100px 1fr 100px 1fr; /* 6열 구조 */
    background-color: #ccc;
    gap: 1px;
    border: 1px solid #ccc;
}

.cell {
    background-color: #fff;
    display: flex;
    align-items: center; /* 수직 가운데 정렬 */
    padding: 8px;
    min-height: 40px;
}

.cell.label {
    background-color: #f8f9fa;
    font-size: 12px;
    font-weight: bold;
    justify-content: center; /* 라벨 텍스트 중앙 */
}

.cell.input input, .cell.input select {
    width: 100%;
    height: 28px;
    border: 1px solid #ddd;
    padding: 0 5px;
    font-size: 12px;
}

/* 수평 그룹 정렬 (주소, 층수 등) */
.horizontal-group {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.btn-addr {
    background: #5c7cfa;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

/* 사진 미리보기 박스 */
.photo-cell {
    flex-direction: column;
    justify-content: center;
    padding: 10px;
}

.photo-preview-container {
    width: 100%;
    height: 150px;
    border: 1px dashed #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fafafa;
    overflow: hidden;
}

.col-span-3 { grid-column: span 3; }
.readonly { background-color: #f1f3f5; }
.table-grid-form {
    display: grid;
    grid-template-columns: 100px 1.5fr 100px 1.5fr 100px 1fr;
    gap: 1px;
    background-color: #ccc;
    border: 1px solid #ccc;
}

.cell {
    background-color: #fff;
    display: flex;
    align-items: center;
    padding: 8px;
    min-height: 42px;
}

.cell.label {
    background-color: #f8f9fa;
    font-weight: bold;
    font-size: 13px;
    justify-content: center;
}

.horizontal-group {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* 상세보기 전용 */
.view-mode .cell.input {
    justify-content: flex-start;
    padding-left: 15px;
    color: #333;
}

.photo-cell {
    flex-direction: column;
    padding: 0;
}

.photo-preview-container {
    flex: 1;
    width: 100%;
    background: #fafafa;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* 리스트 수정/삭제 버튼 */
/* 폼 하단 버튼 컨테이너 */
.form-btns-container {
    margin-top: 40px;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px; /* 버튼 사이 여백 */
    border-top: 1px solid #eee; /* 구분선 추가로 깔끔하게 */
}

/* 버튼 공통 기초 스타일 */
.btn-common {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 15px;
    border: none;
    border-radius: 6px; /* 약간 더 둥글게 */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* [목록] 버튼: 차분한 그레이 */
.btn-list {
    background-color: #ffffff;
    color: #4b5563;
    border: 1px solid #d1d5db !important; /* 테두리 추가 */
}
.btn-list:hover {
    transform: translateY(-1px); /* 살짝 떠오르는 효과 */
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

/* [저장] 버튼: 신뢰감을 주는 블루 (가장 강조) */
.btn-save {
    background-color: #3b82f6;
    color: white;
    width: 70px; /* 메인 액션이라 더 길게 설정 */
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}
.btn-save:hover {
    background-color: #2563eb;
    transform: translateY(-1px); /* 살짝 떠오르는 효과 */
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}
.btn-save:active {
    transform: translateY(0);
}

/* [삭제] 버튼: 경고의 레드 */
.btn-delete {
    background-color: #ef4444;
    color: white;
}
.btn-delete:hover {
    transform: translateY(-1px); /* 살짝 떠오르는 효과 */
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

/* 처리 중 비활성화 상태 */
.btn-common:disabled {
    background-color: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 메모 */
/* 한 줄을 통째로 사용하는 행 전용 스타일 */
.full-width-row {
    display: contents; /* 그리드 레이아웃 유지 */
}

/* 라벨: 1칸 차지 */
.full-row-label {
    grid-column: span 1;
    background-color: #f8f9fa;
    font-weight: bold;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 내용: 5칸 차지 */
.full-row-content {
    grid-column: span 5;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 12px;
    display: block !important; /* 가로 나열 방지 */
    min-height: 50px;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* 폼 요소(input, textarea) 꽉 차게 */
.full-row-content input[type="file"],
.full-row-content textarea {
    width: 100%;
    box-sizing: border-box;
}

.full-row-content textarea {
    height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    resize: vertical;
}

/* 한 줄 전체를 차지하게 만드는 클래스 */
.row-full-label {
    grid-column: 1 / 2 !important;
    background-color: #f8f9fa;
}

.row-full-content {
    grid-column: 2 / 7 !important;
    background-color: #fff !important;
    display: block !important;
    min-height: 100px;
    padding: 15px;
}

/* 사이드아이콘 */

#main-menu ul li a.active {
  color: #5d78ff; /* 활성화될 때의 색상 */
  font-weight: bold;
}

#main-menu ul li a.active i {
  color: #5d78ff; /* 아이콘 색상도 동일하게 변경 */
}

/* 서브 메뉴 텍스트 활성화 스타일 */
.sub-link.active {
  color: #5d78ff !important;
  font-weight:bolder ;

}