/* 복수응답 코딩 도구 스타일 */

/* 기본 레이아웃 */
.analyzer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 페이지 제목 */
.page-title {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title h1 {
    color: #1e40af;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-title p {
    color: #6b7280;
    font-size: 1.1rem;
}

/* 업로드 섹션 */
.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-area.drag-over {
    border-color: #3b82f6;
    background: #dbeafe;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.2rem;
    color: #475569;
    margin-bottom: 1.5rem;
}

.upload-button {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.file-input {
    display: none;
}

/* 미리보기 섹션 */
.preview-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-section h3 {
    color: #1e40af;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* 설정 섹션 */
.settings-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-section h3 {
    color: #1e40af;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.settings-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-weight: 600;
    color: #374151;
}

.setting-select {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.setting-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 컬럼 선택 그리드 */
.column-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.column-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.column-checkbox-item:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
}

.column-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.column-checkbox-item label {
    flex: 1;
    cursor: pointer;
    user-select: none;
}

/* 버튼 스타일 */
.analyze-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    font-weight: 600;
}

.analyze-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.analyze-button:active {
    transform: translateY(0);
}

/* 결과 섹션 */
.results-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.results-section h3 {
    color: #1e40af;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* 데이터 테이블 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    overflow: auto;
    display: block;
    max-height: 400px;
}

.data-table table {
    width: 100%;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
}

.data-table tr:hover {
    background: #f9fafb;
}

/* 액션 버튼 */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.download-button,
.copy-button {
    flex: 1;
    min-width: 200px;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.copy-button {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.copy-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* 알림 */
.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 2rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9900;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.success {
    background: #10b981;
}

.notification.error {
    background: #ef4444;
}

.notification.info {
    background: #3b82f6;
}

/* 로딩 스피너 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 반응형 */
@media (max-width: 768px) {
    .analyzer-container {
        padding: 1rem;
    }

    .page-title h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .column-selection-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .download-button,
    .copy-button {
        width: 100%;
    }
}

/* 복수응답 열 설정 스타일 */
.column-config-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s;
}

.column-config-item:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.config-header {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed #e5e7eb;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.config-field label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.column-letter-input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    max-width: 200px;
}

.column-letter-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.confirm-column-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    white-space: nowrap;
}

.confirm-column-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 열 미리보기 레이아웃 */
.preview-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.preview-left,
.preview-right {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.preview-left h5,
.preview-right h5 {
    color: #1e40af;
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
}

.preview-data-table {
    background: white;
    border-radius: 6px;
    overflow: auto;
    max-height: 300px;
}

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

.preview-data-table th,
.preview-data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

.preview-data-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

.preview-data-table td {
    color: #475569;
}

.extracted-variables {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow: auto;
}

.extracted-variable-item {
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #374151;
    border: 1px solid #dbeafe;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.extracted-variable-item:hover {
    background: #f0f9ff;
    border-color: #93c5fd;
    transform: translateX(2px);
}

.extracted-variable-item:active {
    transform: scale(0.98);
    background: #dbeafe;
}

.extracted-variable-item::before {
    content: attr(data-number);
    background: #3b82f6;
    color: white;
    font-weight: 600;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* 변수명 섹션 */
.variables-section {
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.variable-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.variable-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s;
}

.variable-item:hover {
    background: #f0f9ff;
    border-color: #93c5fd;
}

.variable-number {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    font-weight: 700;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.variable-name-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.variable-name-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.add-variable-btn,
.remove-variable-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.add-variable-btn {
    background: #10b981;
    color: white;
}

.add-variable-btn:hover {
    background: #059669;
    transform: scale(1.05);
}

.remove-variable-btn {
    background: #ef4444;
    color: white;
}

.remove-variable-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.add-column-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
}

.add-column-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.remove-column-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.remove-column-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* 데이터 전체 미리보기 섹션 */
.data-preview-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 0;
    margin-bottom: 2rem;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #f3f4f6 100%);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid #e5e7eb;
}

.preview-header:hover {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.preview-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #6b7280;
    transition: transform 0.3s ease;
}

.toggle-icon.open {
    transform: rotate(90deg);
}

.preview-content {
    padding: 1rem;
    background: #fafbfc;
}

.excel-preview-table {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.excel-preview-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.excel-preview-table th {
    background: #1e40af;
    color: white;
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.excel-preview-table th.column-header {
    background: #3b82f6;
    font-size: 1rem;
}

.excel-preview-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.excel-preview-table tr:hover {
    background: #f0f9ff;
}

.excel-preview-table tr:nth-child(even) {
    background: #f9fafb;
}

/* Help Icon and Tooltip Styles */
.preview-title-with-help {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 1rem 0;
}

.help-tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.help-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    cursor: help;
    transition: background 0.2s ease;
}

.help-icon:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.help-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 130%;
    right: 0;
    background: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 10px;
    border: 6px solid transparent;
    border-top-color: #1f2937;
}

.help-tooltip-wrapper:hover .help-tooltip {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 768px) {
    .config-header {
        flex-direction: column;
        align-items: stretch;
    }

    .column-letter-input {
        max-width: 100%;
    }

    .remove-column-btn {
        width: 100%;
    }

    .variable-item {
        flex-wrap: wrap;
    }

    .variable-name-input {
        min-width: 200px;
    }
}

/* 소형 모바일 (480px 이하) */
@media (max-width: 480px) {
    .analyzer-container {
        padding: 0.5rem;
    }

    .page-title h1 {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: 1.5rem 0.75rem;
    }

    .upload-area p {
        font-size: 0.85rem;
    }

    /* 프리뷰 레이아웃 1열 */
    .preview-layout {
        grid-template-columns: 1fr;
    }

    /* 데이터 테이블 가로 스크롤 */
    .table-container,
    .data-preview {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table,
    table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td,
    table th,
    table td {
        padding: 0.4rem 0.2rem;
        white-space: nowrap;
    }

    .column-selection-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        gap: 0.5rem;
    }

    .download-button,
    .copy-button {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
        width: 100%;
    }

    .column-config-item {
        padding: 0.75rem;
    }

    .variable-name-input {
        min-width: 100%;
    }

    .section-header h2,
    .result-section h2 {
        font-size: 1.1rem;
    }
}
