/* =================================
   기본 및 공통 스타일
   ================================= */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f9;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid transparent;
    padding: 0.6em 1.2em;
    font-size: 1em;
    font-weight: 500;
    font-family: inherit;
    background-color: #007bff;
    color: white;
    transition: background-color 0.2s;
}
button:hover { background-color: #0056b3; }

input[type="text"], input[type="email"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

hr { border: 0; height: 1px; background-color: #e0e0e0; margin: 2rem 0; }

.alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-error { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }

/* =================================
   사용자 페이지 레이아웃
   ================================= */
.container { display: flex; min-height: 100vh; }

.sidebar {
    width: 280px;
    background-color: #fff;
    border-right: 1px solid #e9ecef;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0,0,0,0.02);
}
.sidebar header {
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar header h3 { margin: 0; font-size: 1.2em; }
.sidebar .btn-new-analysis {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    font-weight: bold;
    margin-bottom: 20px;
}
.sidebar .btn-new-analysis:hover { background-color: #007bff; text-decoration: none; }

.history-list h4 { margin-top: 0; color: #6c757d; font-size: 0.9em; text-transform: uppercase; }
.history-list ul { list-style: none; padding: 0; margin: 0; overflow-y: auto; }
.history-list .date-header { font-size: 0.8em; font-weight: bold; color: #adb5bd; padding: 15px 5px 5px; }
.history-list .history-item a {
    display: block;
    padding: 10px 15px;
    border-radius: 5px;
    color: #343a40;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s;
}
.history-list .history-item a:hover { background-color: #f8f9fa; text-decoration: none; }
.history-list .history-item.active a { background-color: #E5F5FF; color: #555555; font-weight: 500; }

.content-view { flex-grow: 1; padding: 40px; background-color: #f8f9fa; }

/* =================================
   콘텐츠 뷰 섹션별 스타일
   ================================= */
.new-analysis-view h2, .analysis-result-view h2 {
    margin-top: 0;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 15px;
    margin-bottom: 30px;
}
#analysis-form { display: flex; gap: 10px; }
#analysis-form input { flex-grow: 1; }
.video-overview { background: #fff; padding: 25px; border-radius: 8px; margin-bottom: 30px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.video-overview p { margin: 10px 0; }
.video-overview strong { color: #495057; min-width: 100px; display: inline-block; }
.gemini-report { background: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); line-height: 1.7; }
.gemini-report h1, .gemini-report h2, .gemini-report h3 { border-bottom: 1px solid #eee; padding-bottom: 5px; margin: 1.5em 0 1em; }

/* =================================
   관리자 페이지 스타일
   ================================= */
.admin-container { padding: 20px; }
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #343a40;
    color: white;
    border-radius: 8px;
    margin-bottom: 30px;
}
.admin-header h1 { margin: 0; font-size: 1.5em; }
.admin-header nav a { color: #f8f9fa; margin-left: 20px; font-weight: 500; }
.admin-header nav a:hover { color: #007bff; text-decoration: none; }
.admin-content h2 { margin-top: 0; margin-bottom: 20px; }
.user-add-form, .user-list, .prompt-editor { background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 30px; }
.user-add-form form { display: flex; gap: 15px; align-items: center; }
.user-add-form form input { flex: 1; }

#userTable { width: 100%; border-collapse: collapse; margin-top: 20px; }
#userTable th, #userTable td { padding: 12px 15px; border: 1px solid #dee2e6; text-align: left; vertical-align: middle; }
#userTable thead { background-color: #f8f9fa; }
#userTable .deactivated { color: #999; background-color: #f5f5f5; text-decoration: line-through; }
.prompt-editor textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 400px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    line-height: 1.6;
    font-family: 'D2Coding', 'Consolas', monospace;
}

/* 로딩 오버레이 스타일 */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    color: white;
    text-align: center;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
}

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

.disclaimer-text {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: -15px;
    margin-bottom: 25px;
    text-align: center;
}