/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 컨테이너 */
.container, .auth-container, .admin-container, .history-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
header {
    background: white;
    border-radius: 15px 15px 0 0;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #764ba2;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #666;
    font-weight: 500;
}

/* 버튼 스타일 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #666;
}

.btn-secondary:hover:not(:disabled) {
    background: #d0d0d0;
}

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* 상태 바 */
.status-bar {
    background: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.status {
    font-weight: 600;
    color: #666;
}

.connection {
    color: #28a745;
    font-size: 14px;
}

/* 대화 컨테이너 */
.chat-container {
    background: white;
    height: 450px;
    overflow-y: auto;
    padding: 20px;
    border: 2px solid #f0f0f0;
}

/* 메시지 스타일 */
.message {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

.user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: 60px;
    text-align: right;
}

.bot-message {
    background: #f7f7f7;
    color: #333;
    margin-right: 60px;
}

.message .time {
    font-size: 12px;
    opacity: 0.7;
    margin-right: 10px;
}

.message .speaker {
    font-weight: 600;
    margin-right: 8px;
}

.interim-message {
    background: #fff3cd;
    color: #856404;
    font-style: italic;
}

/* 컨트롤 영역 */
.controls {
    background: white;
    padding: 20px;
    border-radius: 0 0 15px 15px;
    display: flex;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.btn-mic {
    background: #4CAF50;
    color: white;
}

.btn-mic.listening {
    animation: pulse 1.5s infinite;
    background: #f44336;
}

/* API 설정 */
.api-settings {
    background: white;
    padding: 15px 20px;
    margin-top: 20px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.api-settings input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

/* 로그인/회원가입 폼 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    color: #764ba2;
    margin-bottom: 10px;
}

.auth-box h2 {
    text-align: center;
    color: #666;
    font-size: 20px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 13px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    margin: 0 10px;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* 알림 메시지 */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* 관리자 페이지 */
.admin-container {
    background: white;
    border-radius: 15px;
    padding: 0;
}

.admin-container header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.nav a:hover {
    text-decoration: underline;
}

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

.stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-card p {
    color: #333;
    font-size: 28px;
    font-weight: bold;
}

/* 테이블 */
.user-list {
    padding: 20px;
}

.user-list h2 {
    margin-bottom: 20px;
    color: #333;
}

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

th {
    background: #f7f7f7;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.user-row.status-pending {
    background: #fff3cd;
}

.user-row.status-suspended {
    background: #f8d7da;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #764ba2;
    color: white;
}

.badge-user {
    background: #667eea;
    color: white;
}

.badge-active {
    background: #28a745;
    color: white;
}

.badge-pending {
    background: #ffc107;
    color: #333;
}

.badge-suspended {
    background: #dc3545;
    color: white;
}

.edit-field {
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 4px;
    width: 150px;
}

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

/* 대화 기록 페이지 */
.history-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    margin-top: 20px;
}

.session-list {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.session-item {
    padding: 15px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.session-item:hover {
    border-color: #667eea;
    background: #f7f7ff;
}

.session-item.active {
    border-color: #764ba2;
    background: linear-gradient(135deg, #f5f7ff 0%, #e8ebff 100%);
}

.session-time {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

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

.message-count {
    margin-right: 10px;
}

.duration {
    color: #999;
}

.session-status {
    margin-top: 5px;
    font-size: 12px;
}

.status-active {
    color: #28a745;
}

.status-completed {
    color: #666;
}

.message-view {
    background: white;
    border-radius: 10px;
    padding: 20px;
}

.message-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.history-message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
}

.user-msg {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
}

.bot-msg {
    background: #f7f7f7;
    border-left: 4px solid #764ba2;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.msg-role {
    font-weight: 600;
}

.msg-time {
    color: #999;
    font-size: 13px;
}

.msg-content {
    color: #333;
    line-height: 1.5;
}

/* 필터 바 */
.filter-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.filter-bar form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-bar input[type="date"] {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
}

/* 통계 바 */
.stats-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    gap: 30px;
}

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

.stat label {
    color: #666;
    font-size: 14px;
}

.stat span {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

/* 대화 분석 */
.conversation-analysis {
    margin-top: 30px;
    padding: 20px;
    background: #f7f7f7;
    border-radius: 10px;
}

.conversation-analysis h3 {
    margin-bottom: 15px;
    color: #333;
}

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

.analysis-stats div {
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
}

/* 대화 액션 */
.conversation-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .history-layout {
        grid-template-columns: 1fr;
    }
    
    .session-list {
        max-height: 300px;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .user-message,
    .bot-message {
        margin-left: 0;
        margin-right: 0;
    }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 번역기 스타일 추가 */
.btn-translator {
    background: linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-translator:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 128, 237, 0.3);
}

.translation-mode-badge {
    background: linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
    margin-left: 10px;
}
