/* public/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');

:root {
    --bg-color: #f7f9fc;
    --sidebar-bg: #eaf0f6;
    --main-bg: #ffffff;
    --primary-color: #a2c4e0;
    --accent-color: #88a7c2;
    --purple-pastel: #c0b6f2;
    --purple-pastel-dark: #a89dd8;
    --red-pastel: #f2b6b6;
    --red-pastel-dark: #d89d9d;
    --folder-color: #ffcb7d;
    --folder-color-dark: #fcae44;
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #dde4ed;
    --success-color: #5cb85c;
    --error-color: #d9534f;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- 로그인 페이지 --- */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.login-box { background: var(--main-bg); padding: 40px; border-radius: 12px; box-shadow: var(--shadow); text-align: center; width: 100%; max-width: 400px; transition: transform 0.3s ease-in-out; }
.login-box:hover { transform: translateY(-5px); }
.login-box h1 { color: var(--accent-color); margin-bottom: 10px; }
.login-subtitle { color: var(--light-text-color); margin-bottom: 30px; }
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }
.input-group input { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px; transition: border-color 0.3s, box-shadow 0.3s; }
.input-group input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(162, 196, 224, 0.3); }
.login-button { width: 100%; padding: 12px; border: none; border-radius: 8px; background-color: var(--primary-color); color: white; font-size: 16px; font-weight: 700; cursor: pointer; transition: background-color 0.3s; }
.login-button:hover { background-color: var(--accent-color); }
.error-message { color: var(--error-color); background-color: #fdd; border: 1px solid var(--error-color); padding: 10px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }

/* --- 메인 앱 레이아웃 --- */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background-color: var(--sidebar-bg); padding: 20px; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header h2 { color: var(--accent-color); margin-bottom: 30px; }
.sidebar ul { list-style-type: none; flex-grow: 1; }
.sidebar ul li a { display: block; padding: 12px 15px; text-decoration: none; color: var(--text-color); border-radius: 8px; margin-bottom: 5px; transition: background-color 0.3s, color 0.3s; }
.sidebar ul li.active a, .sidebar ul li a:hover { background-color: var(--primary-color); color: white; }
.sidebar-footer { font-size: 14px; color: var(--light-text-color); word-break: break-all; }
.main-content { flex-grow: 1; padding: 30px; background-color: var(--main-bg); overflow-x: auto; }
.main-header { border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 20px; }

/* --- 경로 네비게이션 (Breadcrumbs) --- */
.breadcrumbs { margin-top: 10px; font-size: 14px; }
.breadcrumbs a { color: var(--primary-color); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { margin: 0 5px; color: var(--light-text-color); }

/* --- 업로드 섹션 --- */
.upload-section { background: var(--bg-color); padding: 20px; border-radius: 12px; margin-bottom: 20px; }
.upload-box { display: flex; gap: 10px; align-items: center; }
.upload-box button { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--purple-pastel); color: white; cursor: pointer; transition: background-color 0.3s; flex-shrink: 0; font-weight: 500; font-size: 14px; }
.upload-box button:hover { background-color: var(--purple-pastel-dark); }
.file-select-btn { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--red-pastel); color: white; cursor: pointer; transition: background-color 0.3s; flex-shrink: 0; font-weight: 500; font-size: 14px; }
.file-select-btn:hover { background-color: var(--red-pastel-dark); }
.upload-box input[type="file"] { display: none; }
.selected-filename { color: var(--light-text-color); font-size: 14px; flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message { margin-top: 15px; padding: 10px; border-radius: 8px; }
.message.success { background-color: #dff0d8; color: #3c763d; }
.message.error { background-color: #f2dede; color: #a94442; }

/* --- 다중 다운로드 및 보기 전환 컨트롤 --- */
.download-controls { display: flex; justify-content: space-between; align-items: center; padding: 15px; background-color: var(--bg-color); border-radius: 12px; margin-bottom: 20px; }
.download-actions { display: flex; align-items: center; gap: 20px; }
.select-all-label { font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.batch-download-btn { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--purple-pastel); color: white; cursor: pointer; font-weight: 500; transition: background-color 0.3s; font-size: 14px; }
.batch-download-btn:hover { background-color: var(--purple-pastel-dark); }
.view-switcher { display: flex; gap: 5px; }
.view-btn { background-color: transparent; border: 1px solid var(--border-color); color: var(--light-text-color); border-radius: 6px; width: 36px; height: 36px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s, color 0.3s; }
.view-btn.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }

/* --- 파일 그리드/리스트 공통 --- */
.file-grid, .file-list-view { transition: opacity 0.3s; }
.file-card { display: flex; text-decoration: none; color: var(--text-color); }
.download-btn, .file-size, .file-name a { text-decoration: none; }

/* --- 파일 그리드 보기 --- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.file-grid .file-card { background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px; text-align: center; flex-direction: column; justify-content: space-between; transition: box-shadow 0.3s, transform 0.3s; position: relative; }
.file-grid .file-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.file-checkbox { position: absolute; top: 10px; left: 10px; transform: scale(1.2); }
.file-icon { font-size: 48px; margin-bottom: 15px; margin-top: 25px; }
.file-name { font-weight: 500; margin-bottom: 5px; word-break: break-all; min-height: 40px; flex-grow: 1; }
.file-grid .file-size { font-size: 13px; color: var(--light-text-color); margin-bottom: 10px; }
.file-grid .is-file .download-btn { display: inline-block; padding: 8px 16px; background-color: var(--purple-pastel); color: white; border-radius: 8px; transition: background-color 0.3s; font-size: 14px; }
.file-grid .is-file .download-btn:hover { background-color: var(--purple-pastel-dark); }
.file-grid .is-folder .download-btn { display: none; }
.file-grid .is-folder .file-size { display: none; }
.folder-list-label { display: none; }

/* --- 폴더 스타일 (그리드) --- */
.file-grid .is-folder { background: var(--folder-color); border-color: var(--folder-color-dark); }
.file-grid .is-folder:hover { background: var(--folder-color-dark); }
.file-grid .is-folder .file-name a { font-weight: 700; color: #5d4037; }

/* --- 파일 리스트 보기 --- */
.file-list-view { display: flex; flex-direction: column; gap: 5px; }
.file-list-view .file-card { flex-direction: row; align-items: center; text-align: left; padding: 5px 15px; border-radius: 8px; transition: background-color 0.2s; }
.file-list-view .file-card:hover { background-color: var(--sidebar-bg); }
.file-list-view .file-icon { display: none; }

/* 리스트 보기: 아이템 순서 및 스타일 */
.file-list-view .file-checkbox { order: 1; }
.file-list-view .download-btn { order: 2; }
.file-list-view .file-size { order: 3; }
.file-list-view .file-name { order: 4; }

/* 리스트 보기: 폴더 */
.file-list-view .is-folder .file-size {
    visibility: hidden; /* 용량 버튼만 숨김 (공간 차지) */
}
.file-list-view .is-folder .file-name a {
    text-decoration: none;
    font-weight: 700;
    color: var(--accent-color);
}
.file-list-view .is-folder .file-name a:hover {
    text-decoration: underline;
}
.file-list-view .is-folder .folder-list-label {
    display: inline-block;
    color: var(--error-color);
    background-color: #fdeaea;
    border: 1px solid var(--error-color);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: baseline;
}


/* 리스트 보기: 공통 아이템 스타일 */
.file-list-view .file-checkbox { position: static; transform: scale(1.1); margin-right: 15px; }
.file-list-view .download-btn { display: inline-block; flex-shrink: 0; padding: 4px 12px; font-size: 13px; background-color: var(--purple-pastel); color: white; border-radius: 8px; transition: background-color 0.3s; }
.file-list-view .download-btn:hover { background-color: var(--purple-pastel-dark); }
.file-list-view .file-size {
    display: inline-block;
    flex-shrink: 0;
    width: 120px;
    text-align: center;
    margin: 0 15px;
    color: white;
    font-weight: 500;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 8px;
    background-color: var(--primary-color);
    transition: background-color 0.3s;
}
.file-list-view .file-name { flex-grow: 1; margin: 0; min-height: 0; padding: 8px 0; }

/* 다운로드 진행 중 스타일 */
.file-list-view .file-size.downloading {
    background: linear-gradient(90deg, var(--success-color), #81c784, var(--success-color));
    background-size: 200% 200%;
    animation: gradient-animation 2s ease infinite;
    white-space: nowrap;
    overflow: hidden;
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


/* --- 로그 뷰어 페이지 --- */
.delete-logs-section { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.delete-logs-btn { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--error-color); color: white; cursor: pointer; font-weight: 500; transition: background-color 0.3s; font-size: 14px; }
.delete-logs-btn:hover { background-color: #c9302c; }
.logs-container { display: flex; gap: 30px; flex-wrap: wrap; }
.log-table-wrapper { flex: 1; min-width: 300px; background-color: var(--bg-color); padding: 20px; border-radius: 12px; }
.log-table-wrapper h2 { margin-bottom: 15px; color: var(--accent-color); border-bottom: 2px solid var(--border-color); padding-bottom: 10px; }
.log-table { width: 100%; border-collapse: collapse; }
.log-table th, .log-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
.log-table th { background-color: var(--sidebar-bg); }
.log-table td { word-break: break-all; }

/* 모바일 반응형 */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-bottom: 1px solid var(--border-color); }
    .main-content { padding: 20px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .file-card { padding: 15px; }
    .login-box { padding: 25px; }
    .download-controls { flex-direction: column; gap: 15px; align-items: stretch; }
    .download-actions { justify-content: space-between; }
    .view-switcher { justify-content: flex-end; }
    .batch-download-btn { width: auto; }
}

