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

:root {
    --primary-color: #0D9488;
    --primary-hover: #0F766E;
    --primary-light: #CCFBF1;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --accent-warm: #F59E0B;
    --accent-coral: #F97316;
    --text-primary: #134E4A;
    --text-secondary: #5F7A76;
    --bg-primary: #F0FDFA;
    --bg-secondary: #FFFFFF;
    --border-color: #D1E7E4;
    --shadow-sm: 0 1px 2px 0 rgba(13, 148, 136, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(13, 148, 136, 0.1);
    --shadow-lg: 0 10px 25px -3px rgba(13, 148, 136, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg, #7CB342 0%, #E8B830 30%, #E09950 60%, #26C6DA 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* 로그인 섹션 */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #8BC34A, #F59E0B, #F97316, #EF4444);
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.login-card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.login-card #googleSignInBtn {
    display: flex;
    justify-content: center;
}

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

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 0.5rem;
}

.user-info {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 사용량 표시 */
.usage-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    display: inline-flex;
    font-size: 0.8125rem;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.usage-label {
    font-weight: 600;
    opacity: 0.9;
}

.usage-value {
    opacity: 0.8;
}

.usage-divider {
    width: 1px;
    height: 1rem;
    background: rgba(255, 255, 255, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo img {
    width: 176px;
    height: 176px;
    object-fit: contain;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* 메인 컨텐츠 */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* 카드 공통 스타일 (레거시 호환) */
.upload-card,
.progress-card,
.result-card {
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* 업로드 섹션 */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

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

.upload-area h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* 버튼 스타일 */
.btn-browse {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-browse:hover {
    background: #E5E7EB;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    margin-top: 1.5rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-primary);
}

.btn-copy {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* 파일 정보 */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-light);
    border: 1px solid #99F6E4;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1.5rem;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    color: var(--danger-color);
    background: #FEE2E2;
}

/* 옵션 섹션 */
.options-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.options-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.options-section h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.125rem;
    background: linear-gradient(180deg, #8BC34A, #F59E0B);
    border-radius: 2px;
}

.option-group {
    margin-bottom: 1.25rem;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.select-input,
.text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    background: white;
    transition: all 0.2s ease;
}

.select-input {
    cursor: pointer;
}

.select-input:focus,
.text-input:focus {
    outline: none;
    border-color: var(--accent-warm);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
    background: #FFFBEB;
}

.text-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 0.875rem;
}

.select-input:disabled {
    background: var(--bg-primary);
    cursor: not-allowed;
    opacity: 0.6;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.checkbox-group {
    margin-top: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* 통합 워크플로우 */
.unified-workflow {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workflow-card {
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.workflow-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #8BC34A, #F59E0B, #F97316, #EF4444);
}

/* 업로드 카드 accordion */
.upload-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.upload-card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.accordion-arrow {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
    display: none;
}

.upload-card.collapsed .accordion-arrow {
    transform: rotate(-90deg);
    display: block;
}

.upload-card-body {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: 1.5rem;
}

.upload-card.collapsed .upload-card-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.upload-card.collapsed .upload-card-header h3 {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 스테퍼 카드 */
.stepper-card {
    animation: fadeIn 0.3s ease;
}

.stepper-rail {
    display: flex;
    flex-direction: column;
}

.stepper-step {
    display: flex;
    gap: 1rem;
}

.stepper-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.stepper-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.stepper-line {
    width: 2px;
    flex: 1;
    background: var(--border-color);
    min-height: 1.5rem;
    transition: background 0.3s ease;
}

.stepper-content {
    flex: 1;
    padding-bottom: 1.5rem;
}

.stepper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.stepper-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.stepper-percentage {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stepper-status {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stepper-progress-bar {
    width: 100%;
    height: 0.375rem;
    background: #E5E7EB;
    border-radius: 9999px;
    overflow: hidden;
}

.stepper-progress-fill {
    height: 100%;
    background: var(--border-color);
    border-radius: 9999px;
    transition: width 0.3s ease;
    width: 0%;
}

.stepper-eta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
    min-height: 1rem;
}

/* 스테퍼 상태: active */
.stepper-step[data-state="active"] .stepper-circle {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.stepper-step[data-state="active"] .stepper-line {
    background: linear-gradient(to bottom, var(--primary-color), var(--border-color));
}

.stepper-step[data-state="active"] .stepper-percentage {
    color: var(--primary-color);
}

.stepper-step[data-state="active"] .stepper-progress-fill {
    background: var(--primary-color);
    position: relative;
}

.stepper-step[data-state="active"] .stepper-progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

/* 스테퍼 상태: completed */
.stepper-step[data-state="completed"] .stepper-circle {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.stepper-step[data-state="completed"] .stepper-line {
    background: var(--success-color);
}

.stepper-step[data-state="completed"] .stepper-percentage {
    color: var(--success-color);
}

.stepper-step[data-state="completed"] .stepper-progress-fill {
    background: var(--success-color);
}

.stepper-step[data-state="completed"] .stepper-status {
    color: var(--success-color);
}

/* 스테퍼 상태: error */
.stepper-step[data-state="error"] .stepper-circle {
    border-color: var(--danger-color);
    background: var(--danger-color);
    color: white;
}

.stepper-step[data-state="error"] .stepper-progress-fill {
    background: var(--danger-color);
}

.stepper-step[data-state="error"] .stepper-status {
    color: var(--danger-color);
}

/* Spinner */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 결과 섹션 */
.result-card {
    animation: fadeIn 0.3s ease;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.result-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* 탭 */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.content-box {
    background: var(--bg-primary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.content-box pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* 마크다운 컨텐츠 스타일 */
.markdown-content {
    font-size: 0.9375rem;
    line-height: 1.8;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.markdown-content h1 {
    font-size: 1.875rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.markdown-content h3 {
    font-size: 1.25rem;
}

.markdown-content h4 {
    font-size: 1.125rem;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.markdown-content em {
    font-style: italic;
}

.markdown-content code {
    background: #F3F4F6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.markdown-content pre {
    background: #F3F4F6;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

.markdown-content table th {
    background: var(--bg-primary);
    font-weight: 600;
}

.markdown-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.markdown-content a:hover {
    color: var(--primary-hover);
}

/* 푸터 */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    color: white;
    opacity: 0.8;
}

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

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

    .logo h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-card,
    .progress-card,
    .result-card,
    .workflow-card {
        padding: 1.5rem;
    }

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

    .options-grid {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

    .tabs {
        overflow-x: auto;
    }

    .tab {
        white-space: nowrap;
    }

    .header-top {
        flex-direction: column;
        gap: 1rem;
    }

    .user-info {
        position: static;
    }

    .usage-bar {
        font-size: 0.75rem;
        gap: 1rem;
        padding: 0.375rem 1rem;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo h1 {
        font-size: 1.75rem;
    }

    .file-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }
}

/* 편집 영역 (F3) */
.edit-textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* 이메일 자동발송 체크박스 */
.email-option {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.email-option-hint {
    margin-top: 4px;
    margin-left: 26px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
