:root {
    --header-height: 60px;
    --footer-height: 50px;
    --sidebar-width: 250px;
    --sidebar-width-collapsed: 60px;
    
    /* Modern Color Palette */
    --primary-color: #2563eb; /* Blue 600 */
    --primary-hover: #1d4ed8; /* Blue 700 */
    --secondary-color: #64748b; /* Slate 500 */
    --success-color: #10b981; /* Emerald 500 */
    --warning-color: #f59e0b; /* Amber 500 */
    --danger-color: #ef4444; /* Red 500 */
    
    --bg-color: #f1f5f9; /* Slate 100 */
    --surface-color: #ffffff;
    
    --text-primary: #1e293b; /* Slate 800 */
    --text-secondary: #475569; /* Slate 600 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    --sidebar-bg: #0f172a; /* Slate 900 */
    --sidebar-text: #e2e8f0; /* Slate 200 */
    
    --border-color: #e2e8f0; /* Slate 200 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar content"
        "footer footer";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr var(--footer-height);
    min-height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

.app-container.sidebar-collapsed {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* Header */
.app-header {
    grid-area: header;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    margin-right: 1rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.toggle-sidebar-btn:hover {
    color: var(--primary-color);
}

/* Sidebar */
.app-sidebar {
    grid-area: sidebar;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-nav li a:hover, .sidebar-nav li a.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--surface-color);
    border-left: 3px solid var(--primary-color);
}

.sidebar-nav li a i {
    min-width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
}

.app-container.sidebar-collapsed .sidebar-text {
    display: none;
}

/* Content */
.app-content {
    grid-area: content;
    padding: 2rem;
    overflow-y: auto;
}

/* Footer */
.app-footer {
    grid-area: footer;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Flowchart Styles */
.flowchart-wrapper {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.flowchart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

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

.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100px;
    position: relative;
}

.flow-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--bg-color);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.flow-node:hover .flow-step {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #eff6ff;
}

.flow-node h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.flow-node p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    color: var(--text-muted);
    font-size: 1.25rem;
    margin-top: 0;
}

.flow-node.danger .flow-step {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background-color: #fef2f2;
}

.flow-node.danger:hover .flow-step {
    background-color: #fee2e2;
}

@media (max-width: 768px) {
    .flowchart {
        flex-direction: column;
        align-items: center;
    }
    
    .flow-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
}
