/* 전역 스타일 */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #43e97b;
    --warning-color: #ffa500;
    --error-color: #f5576c;
    --info-color: #4facfe;
    
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-card: #252d3d;
    --bg-hover: #2d3548;
    
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    --border-color: #2d3748;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 헤더 */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.logo i {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.nav-link i {
    font-size: 18px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* 메인 컨텐츠 */
.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 80px);
}

.page-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-sm:hover {
    background: var(--error-color);
    color: white;
}

/* 통계 카드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-content h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 섹션 카드 */
.section-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h2 i {
    color: var(--primary-color);
}

/* 노드 맵 */
.nodes-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    min-height: 200px;
}

.node-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.node-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.node-card.online {
    border-color: var(--success-color);
}

.node-card.busy {
    border-color: var(--warning-color);
}

.node-card.offline {
    border-color: var(--text-muted);
    opacity: 0.6;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.node-name {
    font-weight: 600;
    font-size: 16px;
}

.node-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.node-status.online {
    background: rgba(67, 233, 123, 0.2);
    color: var(--success-color);
}

.node-status.busy {
    background: rgba(255, 165, 0, 0.2);
    color: var(--warning-color);
}

.node-status.offline {
    background: rgba(113, 128, 150, 0.2);
    color: var(--text-muted);
}

.node-location {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.node-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.metric-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 8px;
}

.metric-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.metric-fill.success {
    background: var(--success-color);
}

.metric-fill.warning {
    background: var(--warning-color);
}

.metric-fill.error {
    background: var(--error-color);
}

/* 활동 목록 */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background: var(--bg-hover);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.activity-description {
    color: var(--text-secondary);
    font-size: 14px;
}

.activity-time {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

/* 워크플로우 그리드 */
.workflows-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.workflow-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
}

.workflow-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.workflow-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.workflow-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.workflow-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.workflow-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.workflow-steps {
    margin-bottom: 16px;
}

.workflow-steps-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-item-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary-color);
}

.workflow-actions {
    display: flex;
    gap: 8px;
}

.workflow-actions .btn {
    flex: 1;
    justify-content: center;
}

/* 서비스 그리드 */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.service-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.service-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.service-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.service-type {
    color: var(--text-secondary);
    font-size: 13px;
}

.service-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
}

/* 노드 그리드 */
.nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* 작업 목록 */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border-color);
}

.task-card.completed {
    border-left-color: var(--success-color);
}

.task-card.running {
    border-left-color: var(--info-color);
}

.task-card.failed {
    border-left-color: var(--error-color);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.task-name {
    font-weight: 600;
    font-size: 16px;
}

.task-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.task-logs {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--success-color);
    margin-top: 12px;
}

/* 상태 배지 */
.status-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active,
.status-badge.running,
.status-badge.online {
    background: rgba(67, 233, 123, 0.2);
    color: var(--success-color);
}

.status-badge.provisioning,
.status-badge.pending {
    background: rgba(79, 172, 254, 0.2);
    color: var(--info-color);
}

.status-badge.paused,
.status-badge.stopped {
    background: rgba(255, 165, 0, 0.2);
    color: var(--warning-color);
}

.status-badge.failed,
.status-badge.error {
    background: rgba(245, 87, 108, 0.2);
    color: var(--error-color);
}

.status-badge.completed {
    background: rgba(67, 233, 123, 0.2);
    color: var(--success-color);
}

.status-badge.draft {
    background: rgba(160, 174, 192, 0.2);
    color: var(--text-secondary);
}

/* 우선순위 배지 */
.priority-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.priority-badge.high {
    background: rgba(245, 87, 108, 0.2);
    color: var(--error-color);
}

.priority-badge.medium {
    background: rgba(255, 165, 0, 0.2);
    color: var(--warning-color);
}

.priority-badge.low {
    background: rgba(160, 174, 192, 0.2);
    color: var(--text-secondary);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 900px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--error-color);
    color: white;
}

.modal-body {
    padding: 24px;
}

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

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.step-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.step-input {
    flex: 1;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .main-nav {
        gap: 4px;
    }
    
    .nav-link {
        padding: 10px 16px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .workflows-grid,
    .services-grid,
    .nodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: space-around;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .workflows-grid,
    .services-grid,
    .nodes-grid {
        grid-template-columns: 1fr;
    }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 로딩 상태 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading i {
    animation: spin 1s linear infinite;
}

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

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
