/* 공통 스타일 - 심플 디자인 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: #fff;
    color: #333;
    padding: 24px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.header p {
    font-size: 0.95em;
    color: #666;
}

.content {
    padding: 24px;
}

/* 네비게이션 바 */
.nav-bar {
    background: #fff;
    padding: 12px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.95em;
}

.nav-link:hover {
    background: #f5f5f5;
    color: #333;
}

.nav-link.active {
    background: #333;
    color: white;
}

/* 업로드 섹션 */
.upload-section {
    background: #fff;
    border-radius: 4px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.upload-section h2 {
    color: #333;
    margin-bottom: 16px;
    font-size: 1.3em;
    font-weight: 600;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    margin: 16px 0;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: inline-block;
    padding: 12px 24px;
    background: #333;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background 0.2s;
}

.file-input-label:hover {
    background: #555;
}

.upload-btn {
    margin-top: 16px;
    padding: 10px 24px;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: #555;
}

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

/* 로딩, 에러, 정보 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1em;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: 16px auto;
}

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

.error {
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    padding: 16px;
    margin: 16px 0;
    border-radius: 4px;
    color: #c62828;
}

.info-section {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    padding: 16px;
    margin: 16px 0;
    border-radius: 4px;
}

.info-section h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.info-section p {
    margin: 4px 0;
    color: #666;
    font-size: 0.95em;
}

/* 아코디언 */
.accordion-section {
    margin-top: 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.accordion-header {
    background: #f5f5f5;
    color: #333;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
    border-bottom: 1px solid #e0e0e0;
}

.accordion-header:hover {
    background: #eeeeee;
}

.accordion-header h2,
.accordion-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.accordion-icon {
    font-size: 1em;
    transition: transform 0.3s;
    color: #666;
}

.accordion-icon.expanded {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-content.expanded {
    max-height: 5000px;
}

.accordion-body {
    padding: 20px;
}

/* 테이블 */
.table-container {
    margin-bottom: 24px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.table-header {
    background: #f5f5f5;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.table-header h3 {
    margin: 0 0 4px 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.table-meta {
    font-size: 0.85em;
    color: #666;
}

.table-wrapper {
    overflow-x: auto;
}

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

thead {
    background: #f5f5f5;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

td {
    color: #666;
    font-size: 0.9em;
}

tbody tr:hover {
    background: #fafafa;
}

.no-tables {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 1em;
}

/* 이미지 */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.image-container {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.image-container:hover {
    border-color: #999;
}

.image-header {
    background: #f5f5f5;
    color: #333;
    padding: 10px 12px;
    font-size: 0.85em;
    font-weight: 500;
    border-bottom: 1px solid #e0e0e0;
}

.image-wrapper {
    padding: 12px;
    background: #fafafa;
    text-align: center;
}

.image-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
    cursor: pointer;
}

.image-info {
    padding: 8px 12px;
    background: #fafafa;
    font-size: 0.8em;
    color: #666;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-download-btn {
    padding: 4px 10px;
    background: #333;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.image-download-btn:hover {
    background: #555;
}

.download-all-images-btn {
    padding: 8px 16px;
    background: #666;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 8px;
}

.download-all-images-btn:hover {
    background: #777;
}

.no-images {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 1em;
}

/* 이미지 모달 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.image-modal-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 1200px;
    margin-top: 5%;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
}

.image-modal-close:hover {
    opacity: 0.7;
}

/* 텍스트 콘텐츠 */
.text-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
    padding: 16px;
    background: #fafafa;
    border-radius: 4px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.9em;
    border: 1px solid #e0e0e0;
}

/* AI 섹션 */
.ai-section {
    margin-top: 24px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 24px;
}

.ai-section h2 {
    margin-bottom: 16px;
    color: #333;
    font-size: 1.3em;
    font-weight: 600;
}

.ai-query-form {
    margin-bottom: 16px;
}

.ai-query-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.95em;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 12px;
}

.ai-query-input:focus {
    outline: none;
    border-color: #999;
}

.ai-process-btn {
    padding: 10px 24px;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-process-btn:hover {
    background: #555;
}

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

.ai-examples {
    margin-top: 16px;
    padding: 12px;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ai-examples h4 {
    margin-bottom: 8px;
    color: #333;
    font-size: 0.95em;
    font-weight: 600;
}

.ai-examples ul {
    list-style: none;
    padding: 0;
}

.ai-examples li {
    margin: 4px 0;
    cursor: pointer;
    color: #666;
    font-size: 0.9em;
    text-decoration: underline;
}

.ai-examples li:hover {
    color: #333;
}

.ai-result {
    margin-top: 16px;
    padding: 16px;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ai-result h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.ai-result-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
    font-size: 0.9em;
}
