/* ═══════════════════════════════════════════════════
   등록원 AI 검토 시스템 - 스타일시트
   ═══════════════════════════════════════════════════ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── 헤더 ── */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 24px 0;
    box-shadow: var(--shadow-lg);
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.header p {
    font-size: 0.875rem;
    opacity: 0.85;
}

/* ── 메인 컨테이너 ── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

/* ── 카드 ── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── 업로드 영역 ── */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone.has-file {
    border-color: var(--success);
    background: var(--success-light);
    border-style: solid;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
}

.file-info {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
}

.file-info.visible {
    display: block;
}

.file-name {
    font-weight: 600;
    color: var(--gray-800);
}

.file-size {
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* ── 버튼 ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    width: auto;
}

/* ── 진행 상태 ── */
.progress-section {
    display: none;
}

.progress-section.visible {
    display: block;
}

.progress-steps {
    list-style: none;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 0.9rem;
    color: var(--gray-400);
    border-bottom: 1px solid var(--gray-100);
}

.progress-step:last-child {
    border-bottom: none;
}

.progress-step.active {
    color: var(--primary);
    font-weight: 500;
}

.progress-step.done {
    color: var(--success);
}

.progress-step.error {
    color: var(--danger);
}

.step-icon {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.step-detail {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-left: 36px;
}

/* ── 스피너 ── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── 결과 영역 ── */
.result-section {
    display: none;
}

.result-section.visible {
    display: block;
}

.result-content {
    background: var(--gray-900);
    color: #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 600px;
    overflow-y: auto;
    position: relative;
}

.result-content .cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--primary);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ── 비용 정보 ── */
.cost-info {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: var(--warning-light);
    border-radius: 8px;
    border-left: 4px solid var(--warning);
}

.cost-info.visible {
    display: block;
}

.cost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.cost-item {
    text-align: center;
}

.cost-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cost-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* ── 일일 API 비용 배너 ── */
.daily-cost-banner {
    background: white;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: border-color 0.3s;
}

.daily-cost-banner.warning {
    border-left-color: var(--warning);
}

.daily-cost-banner.danger {
    border-left-color: var(--danger);
}

.daily-cost-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.daily-cost-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.daily-cost-date {
    font-size: 0.8rem;
    color: var(--gray-400);
}

.daily-cost-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.daily-cost-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s;
    min-width: 0;
}

.daily-cost-bar.warning {
    background: var(--warning);
}

.daily-cost-bar.danger {
    background: var(--danger);
}

.daily-cost-details {
    font-size: 0.8rem;
    color: var(--gray-600);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.daily-cost-remaining {
    color: var(--gray-400);
}

.daily-cost-count {
    margin-left: auto;
    color: var(--gray-400);
}

.daily-cost-exceeded {
    background: var(--danger-light);
    border: 2px solid var(--danger);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    color: var(--danger);
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: center;
}

/* ── 푸터 ── */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* ── 반응형 ── */
@media (max-width: 640px) {
    .header h1 {
        font-size: 1.2rem;
    }
    
    .container {
        padding: 16px;
    }
    
    .card {
        padding: 16px;
    }
    
    .upload-zone {
        padding: 32px 16px;
    }
    
    .cost-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── 토스트 알림 ── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
