:root {
    --primary-color: #4a90a4;
    --primary-hover: #3a7a94;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #e0e0e0;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

/* 관리자 로그인 화면 */
.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h2 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.login-card input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 15px;
}

.login-card input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.login-card .error-text {
    color: var(--danger-color);
    margin-top: 15px;
    font-size: 0.9rem;
}

.login-card .back-link {
    display: block;
    margin-top: 20px;
    color: var(--text-secondary);
    text-decoration: none;
}

.login-card .back-link:hover {
    color: var(--primary-color);
}

[data-theme="dark"] {
    --bg-color: #0f0f1a;
    --card-bg: #1a1a2e;
    --text-color: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #2a2a4a;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* 사이드바 */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.85rem;
    opacity: 0.7;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}

.nav-link.active {
    background: rgba(74, 144, 164, 0.2);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-link .icon {
    font-size: 1.2rem;
}

.back-link {
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

/* 메인 콘텐츠 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px 30px;
    min-height: 100vh;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.top-header h1 {
    font-size: 1.8rem;
    color: var(--text-color);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 콘텐츠 섹션 */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 통계 그리드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 12px;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

.stat-change {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-change.positive {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.stat-change.negative {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* 차트 카드 */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

.chart-card canvas {
    max-height: 300px;
}

/* 최근 활동 */
.recent-activity {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.recent-activity h3 {
    margin-bottom: 20px;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    font-size: 1.2rem;
}

.activity-info {
    flex: 1;
}

.activity-info p {
    font-size: 0.95rem;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
}

/* 섹션 헤더 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 164, 0.4);
}

/* 포트폴리오 요약 */
.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.summary-card p {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* AI 인사이트 */
.ai-loading {
    text-align: center;
    padding: 50px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-results {
    display: grid;
    gap: 20px;
}

.insight-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.insight-card h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.insight-card p {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-line;
}

/* 반응형 */
@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .admin-container {
        flex-direction: column;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
        gap: 5px;
    }

    .nav-link {
        padding: 10px 15px;
        border-left: none;
        border-radius: var(--radius);
        font-size: 0.85rem;
    }

    .nav-link .icon {
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .top-header h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-summary {
        grid-template-columns: 1fr;
    }
}

/* 테이블 스타일 */
.table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-color);
}

.data-table tr:hover {
    background: var(--bg-color);
}

.data-table .no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: var(--primary-hover);
}

.btn-danger-small {
    background: var(--danger-color);
}

.btn-danger-small:hover {
    background: #c82333;
}

/* 검색 박스 */
.search-box input {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 250px;
    background: var(--card-bg);
    color: var(--text-color);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.large {
    max-width: 800px;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: var(--text-color);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 포트폴리오 컨트롤 */
.portfolio-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.portfolio-controls select {
    min-width: 200px;
}

/* 포트폴리오 뷰어 */
.portfolio-viewer {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    min-height: 300px;
    max-height: 80vh;
    overflow-y: auto;
}

/* 전체 포트폴리오 보기 */
.all-portfolios-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.all-portfolios-header h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.all-portfolios-header p {
    color: var(--text-secondary);
}

.student-portfolio-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 15px;
    overflow: hidden;
}

.student-portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-color);
    cursor: pointer;
    transition: background 0.3s;
}

.student-portfolio-header:hover {
    background: var(--primary-color);
    color: white;
}

.student-portfolio-header:hover .student-id {
    color: rgba(255, 255, 255, 0.8);
}

.student-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.student-number {
    background: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
}

.student-portfolio-header:hover .student-number {
    background: white;
    color: var(--primary-color);
}

.student-id {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.student-portfolio-content {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.portfolio-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.portfolio-section:last-child {
    border-bottom: none;
}

.portfolio-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.portfolio-item {
    background: var(--bg-color);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.portfolio-item strong {
    color: var(--text-color);
}

.portfolio-item p {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cover-letter-preview {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    line-height: 1.8;
    max-height: 300px;
    overflow-y: auto;
}

/* 학생 선택 드롭다운 */
#studentSelect {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    min-width: 200px;
    background: var(--card-bg);
    color: var(--text-color);
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}
