@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #f4f6f8;
    --text-main: #111827;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --highlight: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    /* Hide body scroll for sidebar layout */
    height: 100vh;
    width: 100vw;
}

/* Platform Layout Setup */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: #ffffff;
    color: #334155;
    display: flex;
    flex-direction: column;
    box-shadow: 1px 0 15px rgba(0, 0, 0, 0.05);
    z-index: 50;
    border-right: 1px solid #e2e8f0;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #0f172a;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: #64748b;
}

.flow-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding-bottom: 3rem;
}

.flow-list li {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

.flow-list li.nested-flow {
    padding-left: 2.5rem;
    font-size: 0.85rem;
    border-bottom: none;
    position: relative;
}

.flow-list li.nested-flow::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #cbd5e1;
}

.flow-list li.nested-subflow {
    padding-left: 3.5rem;
    font-size: 0.8rem;
    border-bottom: none;
    position: relative;
}

.flow-list li.nested-subflow::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #cbd5e1;
}

.flow-list li:hover {
    background: #f8fafc;
    color: #0f172a;
}

.flow-list li.nested-flow:hover::before,
.flow-list li.nested-subflow:hover::before {
    background: #0ea5e9;
}

.sidebar-category {
    padding: 1.25rem 1.5rem !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    cursor: pointer;
}

.sidebar-category:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

.sidebar-category.active {
    background: #f0f9ff !important;
    color: #0284c7 !important;
    border-left: 4px solid #0ea5e9 !important;
}

.flow-list li.active {
    background: #f0f9ff;
    color: #0284c7;
    font-weight: 600;
    border-left: 4px solid #0ea5e9;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 3rem;
    background-color: var(--bg-color);
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    background: #ffffff;
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    min-height: 80vh;
    /* Make sure it looks like a large page */
}

/* Below is the same refined Process Flow CSS */
.header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInDown 0.6s ease-out;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.flow-container {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 1.5rem 1.5rem 3rem 1.5rem;
    /* Increased padding to prevent hover clipping */
    position: relative;
    z-index: 1;
}

.flow-header {
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.step-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    /* Don't stretch if there are few */
    width: 180px;
    animation: fadeIn 0.8s ease-out forwards;
}

.step-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-md);
    padding: 1.5rem 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    width: 170px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

/* Red Box ONLY for Bottlenecks */
.step-card.bottleneck {
    border: 3px solid var(--highlight);
    background-color: #fff5f5;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.card-content h2 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-main);
    word-break: break-word;
}

.step-card.bottleneck .card-content h2 {
    color: #b91c1c;
}

.sub-tasks {
    list-style: none;
    margin-top: 1rem;
    width: 100%;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    height: 100px;
    overflow-y: auto;
    background: #eef2f6;
    border-radius: 8px;
    padding: 0.75rem;
}

.sub-tasks li {
    margin-bottom: 0.4rem;
    line-height: 1.4;
    color: #334155;
    font-weight: 500;
}

.sub-tasks li:last-child {
    margin-bottom: 0;
}

.time-indicator {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 1.2rem;
    min-width: 80px;
    /* Force minimum width to prevent blue circle from cramping */
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1.05rem;
    transition: var(--transition);
}

.step-wrapper:hover .time-indicator {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.time-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

/* Problem Area Styling */
.problem-area {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    width: 100%;
    min-height: 20px;
}

.problem-line {
    position: absolute;
    top: -1rem;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-left: 2px dashed #cbd5e1;
    z-index: 0;
}

.problem-pill {
    position: relative;
    z-index: 1;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    transition: var(--transition);
}

.problem-merah {
    background: #ffffff;
    border: 1px solid #ef4444;
    color: #b91c1c;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.05);
}

.problem-merah:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
    background: #fef2f2;
}

.problem-kuning {
    background: #ffffff;
    border: 1px solid #eab308;
    color: #a16207;
    box-shadow: 0 2px 4px rgba(234, 179, 8, 0.05);
}

.problem-kuning:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 8px rgba(234, 179, 8, 0.2);
    background: #fefce8;
}

.problem-abu {
    background: #ffffff;
    border: 1px solid #94a3b8;
    color: #475569;
    box-shadow: 0 2px 4px rgba(148, 163, 184, 0.05);
}

.problem-abu:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 8px rgba(148, 163, 184, 0.2);
    background: #f8fafc;
}

/* Status specific modifiers */
.status-selesai {
    background: #dcfce7 !important;
    border-color: #22c55e !important;
    color: #166534 !important;
}

.status-progress {
    border-style: dashed !important;
    border-width: 2px !important;
    animation: dashBlink 1.5s infinite;
}

@keyframes dashBlink {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.arrow-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    margin-top: 65px;
    transform: translateY(-50%);
    flex: 0 0 auto;
    animation: fadeIn 1s ease-out forwards;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling for sidebar and main content */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #334155;
}

@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .main-content {
        padding: 1.5rem;
    }
}