* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* API Key 섹션 */
.api-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.api-selector {
    margin-bottom: 15px;
}

.api-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.api-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    background: white;
}

.api-selector select:focus {
    border-color: #667eea;
}

.api-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.api-input-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.api-input-group input:focus {
    border-color: #667eea;
}

.api-input-group button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    white-space: nowrap;
}

.api-input-group button:hover {
    background: #5a6fd8;
}

.help-btn {
    width: 40px !important;
    padding: 12px !important;
    background: #28a745 !important;
    border-radius: 50% !important;
}

.help-btn:hover {
    background: #218838 !important;
}

#apiStatus {
    font-size: 14px;
    font-weight: 600;
}

#apiStatus.success {
    color: #28a745;
}

#apiStatus.error {
    color: #dc3545;
}

/* 도움말 섹션 */
.help-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

.help-content {
    padding: 25px;
}

.help-content h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.help-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.help-item h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.help-item p {
    color: #666;
    line-height: 1.5;
    font-size: 14px;
    margin: 0;
}

.help-item a {
    color: #667eea;
    text-decoration: none;
}

.help-item a:hover {
    text-decoration: underline;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 모듈 그리드 */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.module-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.module-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.module-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.module-card p {
    color: #666;
    font-size: 14px;
}

/* 모듈 실행 영역 */
.module-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e1e1;
}

.module-header h2 {
    color: #333;
}

.module-header button {
    background: #ff4757;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-content {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.submit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #5a6fd8;
}

/* 결과 영역 */
.result-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e1e1;
}

.result-header button {
    background: #ff4757;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

.result-content {
    padding: 25px;
    max-height: 500px;
    overflow-y: auto;
}

#resultText {
    line-height: 1.6;
    white-space: pre-wrap;
}

/* 로딩 스피너 */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 유틸리티 클래스 */
.hidden {
    display: none !important;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .api-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .api-input-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .api-input-group input,
    .api-input-group button {
        width: 100%;
        min-width: auto;
    }
}

/* 스크롤바 스타일링 */
.result-content::-webkit-scrollbar {
    width: 6px;
}

.result-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.result-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.result-content::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}