/* 기본 리셋 및 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 입력 섹션 */
.input-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.input-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.url-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 50px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.url-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.analyze-btn {
    padding: 15px 30px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 150px;
}

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

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.example-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.example-section code {
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* 상태 섹션 */
.status-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.status-card {
    text-align: center;
}

.status-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.status-text {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #666;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e8ed;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 에러 섹션 */
.error-section {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.error-card {
    text-align: center;
}

.error-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.error-text {
    color: #e53e3e;
    font-size: 1.1em;
}

/* 결과 섹션 */
.results-section {
    display: grid;
    gap: 30px;
}

.summary-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.summary-card h2 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.summary-text {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.summary-text h3 {
    margin-bottom: 10px;
    color: #333;
}

/* 차트 컨테이너 */
.chart-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.chart-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

.sentiment-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-item.positive .legend-color {
    background: #48bb78;
}

.legend-item.neutral .legend-color {
    background: #ed8936;
}

.legend-item.negative .legend-color {
    background: #f56565;
}

/* 키워드 섹션 */
.keywords-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.keywords-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

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

.keyword-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.keyword-item:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.keyword-word {
    font-weight: 500;
    color: #333;
}

.keyword-frequency {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

/* 푸터 */
.footer {
    text-align: center;
    margin-top: 50px;
    color: white;
    opacity: 0.8;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.info-content {
    margin-top: 20px;
}

.info-content ol, .info-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.info-content li {
    margin-bottom: 8px;
}

/* 고급 분석 스타일 */
.advanced-analysis {
    display: grid;
    gap: 30px;
    margin-top: 30px;
}

.advanced-toggle {
    text-align: center;
    margin: 30px 0;
}

.toggle-btn {
    padding: 15px 30px;
    background: linear-gradient(45deg, #38a169, #48bb78);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(56, 161, 105, 0.4);
}

/* 통합 인사이트 */
.insights-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.insights-content {
    display: grid;
    gap: 20px;
}

.insight-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.insight-card h4 {
    margin-bottom: 10px;
    color: #ffd700;
}

.insight-list {
    list-style: none;
    padding: 0;
}

.insight-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.insight-list li:last-child {
    border-bottom: none;
}

/* 향상된 감정 분석 */
.enhanced-sentiment-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.enhanced-sentiment-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

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

.sentiment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid;
    transition: transform 0.3s ease;
}

.sentiment-item:hover {
    transform: translateY(-2px);
}

.sentiment-excitement { border-left-color: #ff6b6b; }
.sentiment-satisfaction { border-left-color: #4ecdc4; }
.sentiment-curiosity { border-left-color: #45b7d1; }
.sentiment-agreement { border-left-color: #96ceb4; }
.sentiment-criticism { border-left-color: #feca57; }
.sentiment-disappointment { border-left-color: #ff9ff3; }
.sentiment-neutral { border-left-color: #bdc3c7; }

.business-insights {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.business-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.metric-value {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2em;
}

/* 토픽 분석 */
.topic-analysis-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.topic-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.topic-bar {
    flex: 1;
    height: 25px;
    background: #e1e8ed;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.topic-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 12px;
    transition: width 0.8s ease;
}

.topic-label {
    min-width: 120px;
    font-weight: 500;
    font-size: 0.9em;
}

.topic-percent {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: #667eea;
}

.content-insights {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.insights-section {
    margin-bottom: 20px;
}

.insights-section h5 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1em;
}

.insights-section ul {
    list-style: none;
    padding: 0;
}

.insights-section li {
    padding: 5px 0;
    color: #666;
    font-size: 0.9em;
}

/* 시청자 특성 분석 */
.audience-analysis-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.audience-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.age-analysis, .expression-analysis {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.age-bars, .expression-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

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

.bar-label {
    min-width: 80px;
    font-size: 0.9em;
    font-weight: 500;
}

.bar {
    flex: 1;
    height: 20px;
    background: #e1e8ed;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease;
}

.age-teenagers .bar-fill { background: #ff6b6b; }
.age-twenties .bar-fill { background: #4ecdc4; }
.age-thirties .bar-fill { background: #45b7d1; }
.age-older .bar-fill { background: #96ceb4; }

.expression-enthusiasm .bar-fill { background: #feca57; }
.expression-calm .bar-fill { background: #48dbfb; }
.expression-questioning .bar-fill { background: #ff9ff3; }
.expression-suggesting .bar-fill { background: #54a0ff; }

.bar-value {
    min-width: 35px;
    text-align: right;
    font-weight: bold;
    font-size: 0.9em;
}

/* 시계열 분석 */
.timeseries-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.timeseries-content {
    margin-top: 20px;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

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

.time-insight-item {
    background: #f0f7ff;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.insight-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.insight-label {
    font-size: 0.9em;
    color: #666;
}

/* 영상 성과 분석 */
.performance-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.performance-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.performance-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.performance-value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.performance-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
}

.performance-desc {
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .input-container {
        flex-direction: column;
    }
    
    .url-input {
        border-radius: 15px;
    }
    
    .analyze-btn {
        width: 100%;
        border-radius: 15px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .sentiment-legend {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .keywords-grid {
        grid-template-columns: 1fr;
    }
}
