/**
 * 차움 결과지 프로세스 플랫폼
 * Control Center Design
 */

:root {
    /* Primary Colors */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Status Colors */
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --error: #dc2626;
    --error-light: #fee2e2;
    --info: #0284c7;
    --info-light: #e0f2fe;

    /* Gray Scale */
    --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;

    /* Layout */
    --sidebar-width: 200px;
    --status-bar-height: 52px;

    /* Typography */
    --font-sans: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ========== LAYOUT ========== */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-500);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.brand-text {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--gray-400);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-link.active {
    background: var(--primary-600);
    color: white;
}

.nav-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--error);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.user-name {
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.user-role {
    font-size: 10px;
    color: var(--gray-400);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: var(--radius);
    color: var(--gray-400);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

/* Main Area */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Status Bar */
.status-bar {
    height: var(--status-bar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--gray-50);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 12px;
}

.status-item:hover {
    background: var(--gray-100);
}

.status-item.active {
    background: var(--primary-100);
    color: var(--primary-700);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.blue { background: var(--primary-500); }
.status-dot.yellow { background: var(--warning); }
.status-dot.purple { background: #8b5cf6; }
.status-dot.green { background: var(--success); }
.status-dot.emerald { background: #10b981; }

.status-label {
    font-size: 11px;
    font-weight: 500;
}

.status-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-900);
}

.status-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-bar-date {
    font-size: 11px;
    color: var(--gray-500);
}

/* Page Header */
.page-header {
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 20px;
}

/* ========== COMPONENTS ========== */

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-50);
    gap: 12px;
}

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

.card-title svg {
    width: 16px;
    height: 16px;
    color: var(--gray-500);
}

.card-body {
    padding: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: var(--error);
    color: white;
}
.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover {
    background: var(--gray-50);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}
.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

select.form-control {
    cursor: pointer;
    background: white;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    gap: 4px;
}

.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-blue { background: var(--primary-100); color: var(--primary-700); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--error-light); color: var(--error); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-success { background: var(--success-light); color: var(--success); }

/* Branch Pills */
.branch-pill,
.branch-bundang,
.branch-ilsan {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.branch-bundang {
    background: var(--primary-100);
    color: var(--primary-700);
}

.branch-ilsan {
    background: var(--success-light);
    color: var(--success);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--gray-300);
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-description {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: var(--success-light); color: #065f46; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-error { background: var(--error-light); color: #991b1b; }
.alert-info { background: var(--info-light); color: #075985; }

/* ========== DASHBOARD ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon.blue {
    background: var(--primary-100);
    color: var(--primary-600);
}

.stat-icon.amber {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.violet {
    background: #ede9fe;
    color: #7c3aed;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-content .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-content .stat-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    margin-top: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--error); }

/* Process Flow */
.process-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.process-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    position: relative;
}

.process-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 2px;
    background: var(--gray-300);
}

.process-step.active {
    background: var(--warning-light);
}

.process-step.active .step-indicator {
    background: var(--warning);
    color: white;
}

.process-step.completed {
    background: var(--success-light);
}

.process-step.completed .step-indicator {
    background: var(--success);
    color: white;
}

.step-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.step-indicator svg {
    width: 18px;
    height: 18px;
}

.step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
}

.step-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 4px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== TRANSLATION ========== */
.translation-container,
.translation-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.translation-pane {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.pane-header {
    padding: 12px 14px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pane-title {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pane-body {
    padding: 14px;
}

.translation-textarea {
    width: 100%;
    min-height: 280px;
    padding: 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
}

.translation-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tab-btn,
.tab-item {
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover,
.tab-item:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.tab-btn.active,
.tab-item.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
}

.toast {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* File Upload */
.file-drop {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-drop:hover,
.file-drop.dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
}

/* Utilities */
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--error); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .translation-container,
    .translation-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main {
        margin-left: 0;
    }
    .status-bar {
        overflow-x: auto;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .process-flow {
        flex-wrap: wrap;
    }
    .process-step {
        flex: 1 1 45%;
    }
    .process-step:not(:last-child)::after {
        display: none;
    }
}
