* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 로그인 화면 */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 400px;
}

.login-container h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.login-container h2 {
    font-size: 1.5em;
    color: #666;
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-form button {
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-form button:hover {
    background: #5a67d8;
}

.error-message {
    color: #e53e3e;
    margin-top: 15px;
    padding: 10px;
    background: #fed7d7;
    border-radius: 5px;
}

/* 관리자 대시보드 */
.admin-dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    color: #667eea;
    font-size: 2em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stats {
    color: #666;
    font-size: 16px;
}

.logout-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background: #c53030;
}

/* 메인 콘텐츠 */
.admin-main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    width: 100%;
}

.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.control-group {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.control-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.control-btn.danger {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

.control-btn.danger:hover {
    background: #c53030;
}

.search-group {
    display: flex;
    gap: 10px;
}

.search-group input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 300px;
    font-size: 14px;
}

.search-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 테이블 */
.posts-table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.posts-table {
    width: 100%;
    border-collapse: collapse;
}

.posts-table th {
    background: #f7fafc;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.posts-table td {
    padding: 15px 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.posts-table tr:hover {
    background: #f7fafc;
}

.checkbox-col {
    width: 50px;
    text-align: center;
}

.id-col {
    width: 80px;
}

.author-col {
    width: 120px;
}

.title-col {
    width: 200px;
}

.content-col {
    width: 300px;
}

.date-col {
    width: 150px;
}

.stats-col {
    width: 100px;
}

.actions-col {
    width: 120px;
}

.content-preview {
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    color: #666;
    line-height: 1.4;
}

.stats-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.btn:hover {
    background: #f7fafc;
}

.btn.danger {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

.btn.danger:hover {
    background: #c53030;
}

.btn.view {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn.view:hover {
    background: #5a67d8;
}

/* 페이지네이션 */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.page-number.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
}

.modal-header h3 {
    color: #4a5568;
    font-size: 1.5em;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
}

.close:hover {
    color: #4a5568;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.post-detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.detail-row span,
.detail-row div {
    padding: 10px;
    background: #f7fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

#detailContent {
    min-height: 100px;
    white-space: pre-wrap;
    line-height: 1.6;
}

#detailComments {
    max-height: 200px;
    overflow-y: auto;
}

.comment-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #f7fafc;
}

.modal-footer .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* 반응형 */
@media (max-width: 1200px) {
    .admin-controls {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .control-group,
    .search-group {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .login-container {
        min-width: 300px;
        padding: 30px 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .posts-table-container {
        overflow-x: auto;
    }
    
    .posts-table {
        min-width: 800px;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 15px;
    }
}

/* 탭 네비게이션 */
.tab-navigation {
    display: flex;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #666;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #333;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-btn:first-child {
    border-right: 1px solid #dee2e6;
}

/* 탭 컨텐츠 */
.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* 봇 탭 강제 표시 */
#botTab.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 봇 관리 스타일 */
.bot-controls {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.bot-status-section,
.bot-config-section,
.bot-stats-section,
.bot-logs-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bot-status-section h3,
.bot-config-section h3,
.bot-stats-section h3,
.bot-logs-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

/* 봇 상태 표시 */
.status-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.status-indicator {
    font-size: 18px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    background: #dc3545;
    color: white;
}

.status-indicator.running {
    background: #28a745;
}

.bot-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 봇 설정 폼 */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 봇 통계 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: 700;
    font-size: 1.2em;
    color: #333;
}

/* 봇 로그 */
.logs-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.logs-header {
    display: flex;
    gap: 10px;
}

.logs-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
}

.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    color: #666;
    font-size: 12px;
    min-width: 120px;
}

.log-message {
    flex: 1;
    color: #333;
}

/* 추가 버튼 스타일 */
.control-btn.success {
    background: #28a745;
    color: white;
}

.control-btn.success:hover {
    background: #218838;
}

/* 봇 관리 반응형 */
@media (max-width: 768px) {
    .tab-navigation {
        flex-direction: column;
    }
    
    .tab-btn:first-child {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .status-display {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bot-actions {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}