/* style.css */

/* 기본 및 공통 스타일 */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 버튼 기본 스타일 reset 및 공통 */
button {
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #3a3a3a;
    color: #e0e0e0;
    padding: 5px 10px;
}

/* 로그인 페이지 등 배경 스타일 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    /* 배경 이미지 설정 (전체 화면 꽉 채우기) */
    background: url('drone_background.png') no-repeat center center fixed;
    background-size: cover;
    position: relative; /* page-title 절대 위치의 기준점 */
}

/* [수정됨] 로그인 화면 메인 타이틀 스타일 */
.page-title {
    position: absolute;
    top: 60px;       /* 상단 여백 */
    left: 60px;      /* 좌측 여백 */
    color: #ffffff;  /* 흰색 텍스트 */
    font-size: 3rem; /* 크기 2배 (약 64px ~ 70px) */
    font-weight: 600;
    margin: 0;
    z-index: 10;
    /* 배경과 구분을 위한 검은 그림자 */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.login-container {
    background: rgba(255, 255, 255, 0.95); /* 배경이 비치지 않도록 불투명도 조정 */
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); /* 그림자 조금 더 진하게 */
    width: 400px;
    box-sizing: border-box;
    z-index: 20;
}
.login-container h1 {
    font-size: 2.2rem;
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: bold;
    text-align: center; /* 로그인 박스 내부 타이틀 중앙 정렬 */
}
.login-subtext {
    font-size: 1rem;
    color: #666;
    margin: 0 0 2.5rem 0;
    text-align: center; /* 서브 텍스트 중앙 정렬 */
}
.input-group {
    margin-bottom: 1rem;
    position: relative;
    text-align: left;
}
.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #fff;
    color: #333;
    font-size: 1rem;
}
.input-group .icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

/* [수정됨] 로그인 버튼 스타일 (중앙 정렬 추가) */
.login-button {
    width: auto;
    min-width: 150px;
    padding: 0.8rem 2.5rem;
    background-color: #5a67d8;
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: bold;

    /* 중앙 정렬을 위한 설정 */
    display: block;
    margin: 1.5rem auto 0 auto;
}

.login-button:hover { background-color: #434190; }
.footer-bar {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 50px;
    background-color: #ffffff; opacity: 0.7; z-index: 100;
    display: flex; justify-content: center; align-items: center; gap: 20px;
}


/* 대시보드 헤더 */
header {
    background-color: #333;
    padding: 0 1rem;
    flex-shrink: 0;
}
.tabs { display: flex; justify-content: space-between; align-items: center; }
.tab-button {
    background: none; border: none; color: #aaa;
    padding: 1rem 1.5rem; font-size: 1rem; font-weight: bold;
}
.tab-button.active { color: white; border-bottom: 3px solid #5a67d8; }
.logout-button {
    background-color: #d9534f; color: white; border: none;
    padding: 0.5rem 1rem; border-radius: 4px; font-weight: bold;
}

/* 메인 컨텐츠 (다크 테마) */
main {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.tab-content { display: none; }
.tab-content.active {
    display: flex; flex-direction: column; flex-grow: 1; min-height: 0;
}

/* Video 스타일 */
.video-container { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
.video-player {
    width: 100%; flex-grow: 1; min-height: 0;
    background-color: #111; color: #eee;
    display: flex; flex-direction: row; gap: 10px;
    padding: 10px; box-sizing: border-box; border-radius: 4px; position: relative;
}
#video-wrap { flex: 2; display: flex; flex-direction: column; gap: 4px; position: relative; }
#frame { flex: 1; min-height: 0; max-width: 100%; background: #000; border: 1px solid #333; z-index: 1; }
#det-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; z-index: 1; }
#det-list { flex: 1; font-size: 11px; background: #000; border: 1px solid #333; padding: 6px; overflow-y: auto; white-space: pre; }
#bbox-container { position: absolute; pointer-events: none; z-index: 5; top: 0; left: 0; }
.bbox { position: absolute; border: 2px solid red; box-sizing: border-box; }

/* Segmented Control (모델 선택) */
.segmented-control-container {
    position: absolute; top: 40px; left: 20px; z-index: 10;
    display: flex; flex-wrap: wrap; gap: 4px;
    background-color: rgba(50, 50, 50, 0.7); padding: 4px; border-radius: 6px;
}
.segmented-control-container input[type="radio"] { display: none; }
.segmented-control-button {
    display: inline-block; padding: 6px 10px; font-size: 0.85rem;
    color: #eee; background-color: #555; border: 1px solid #777; border-radius: 4px;
    cursor: pointer; user-select: none;
}
.segmented-control-container input[type="radio"]:checked + .segmented-control-button {
    background-color: #5a67d8; color: white; border-color: #434190; font-weight: bold;
}

/* Video Overlays */
.video-overlay {
    position: absolute; z-index: 10;
    background-color: rgba(0, 0, 0, 0.5); color: #ffffff;
    padding: 4px 8px; border-radius: 4px; font-weight: bold; pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}
.video-overlay.top-right { top: 100px; right: 10px; font-size: 60px; }
.video-overlay.bottom-right { bottom: 70px; right: 10px; font-size: 28px; color: #FFEE00; }


/* ========================================================== */
/* [설정 탭 - AI 모델 & 관심 인물 관리 스타일] */
/* ========================================================== */

.toolbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 1rem;
}
.section-title { font-size: 1.2rem; font-weight: bold; margin-right: 10px; }
.right-actions { margin-left: auto; display: flex; gap: 10px; }

/* 공통 테이블 스타일 */
.model-table {
    width: 100%; border-collapse: collapse; background: #2a2a2a;
}
.model-table th, .model-table td {
    border: 1px solid #444; padding: 0.8rem 1rem; vertical-align: middle;
}
.model-table th { background-color: #333; text-align: center; }
.model-table td:first-child { text-align: center; } /* 번호 */
.model-table td { text-align: center; } /* 기본 중앙 정렬 */

/* 파일명 표시 input */
#file-name-display {
    font-size: 0.9rem; color: #ccc; background-color: #2a2a2a;
    border: 1px solid #444; padding: 5px 10px; border-radius: 4px;
    min-width: 300px; text-align: left; font-style: italic;
}
.hidden-file-input { display: none; }
.hidden { display: none !important; }

/* 버튼 스타일 */
.btn-browse {
    cursor: pointer; border-radius: 4px; border: 1px solid #666;
    padding: 5px 10px; font-size: 14px; background-color: #4f4f4f; color: #e0e0e0;
}
.btn-browse:hover { background-color: #5a5a5a; }

.btn-action { background-color: #4CAF50; color: white; border: none; }
.btn-delete { background-color: #f44336; color: white; border: none; }
.refresh-button { margin-left: auto; }

/* 흰색 배경 버튼 (UI 디자인 반영) */
.btn-white {
    background-color: #fff; color: #333; border: 1px solid #ccc; font-weight: bold;
}
.btn-white:hover { background-color: #f0f0f0; }

/* 구분선 */
.divider {
    height: 1px; background-color: #444; margin: 3rem 0 2rem 0; border: none;
}

/* ========================================================== */
/* [신규] 관심 인물(POI) 관리 전용 스타일 */
/* ========================================================== */

/* 빈 목록 메시지 */
.empty-message {
    text-align: center; padding: 4rem 0; color: #888; font-size: 1.1rem;
}

/* 미리보기 컨테이너 (세로 정렬) */
.preview-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

/* 개별 이미지 아이템 (이미지 + 삭제버튼) */
.preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 4px;
}

/* 미리보기 이미지 크기 */
.poi-preview {
    width: 50px; height: 50px; object-fit: cover;
    border-radius: 4px; border: 1px solid #555; display: block; margin: 0 auto;
    cursor: pointer; /* 클릭 가능 표시 */
    transition: 0.3s;
}
.poi-preview:hover { opacity: 0.7; }

/* 삭제 버튼 공통 */
.btn-delete-small {
    background-color: #fff; border: 1px solid #ccc; color: #333;
    padding: 4px 10px; margin-left: 10px; cursor: pointer; font-size: 12px;
    border-radius: 2px;
}
.btn-delete-small:hover { background-color: #eee; }

/* 모달 관련 스타일 (기존 유지) */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex; justify-content: center; align-items: center; z-index: 2000;
}
.modal-content {
    background-color: #fff; padding: 2rem; width: 400px; box-shadow: 0 4px 10px rgba(0,0,0,0.3); color: #333;
}
.modal-content h3 { margin-top: 0; margin-bottom: 2rem; text-align: left; font-size: 1.2rem; font-weight: bold; }
.modal-body { margin-bottom: 2rem; }
.modal-body input { width: 100%; padding: 10px; border: 1px solid #ccc; text-align: center; box-sizing: border-box; }
.modal-actions { display: flex; justify-content: center; gap: 20px; }
.modal-actions button { width: 100px; padding: 8px 0; font-weight: bold; cursor: pointer; }
.btn-modal-confirm { background-color: #fff; color: #333; border: 1px solid #999; }
.btn-modal-cancel { background-color: #fff; color: #333; border: 1px solid #999; }
.btn-modal-confirm:hover, .btn-modal-cancel:hover { background-color: #eee; }

/* ========================================================== */
/* [신규] 이미지 뷰어 모달 스타일 */
/* ========================================================== */

/* 뷰어 모달 이미지 */
.modal-image {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    border-radius: 5px;
    animation-name: zoom;
    animation-duration: 0.4s;
}

/* 확대 애니메이션 */
@keyframes zoom {
    from {transform:scale(0)}
    to {transform:scale(1)}
}

/* 닫기 버튼 (X) */
.close-viewer {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001;
}

.close-viewer:hover,
.close-viewer:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}