:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --bg-color: #f5f7fa;
    --panel-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #7f8c8d;
    --border: #e0e6ed;
    --hover: #2980b9;
    --idle-bg: #bdc3c7;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border);
}

header h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 5px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

section {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

h2 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-left: 4px solid var(--secondary);
    padding-left: 10px;
}

h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* Input Section */
.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

input, select, button {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

input {
    flex: 1;
    min-width: 150px;
}

button {
    background-color: var(--secondary);
    color: white;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

button:hover {
    background-color: var(--hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

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

.danger-btn:hover {
    background-color: #c0392b;
}

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

.primary-btn:hover {
    background-color: #1a252f;
}

.remove-btn {
    background-color: var(--accent);
    padding: 6px 12px;
    font-size: 0.9rem;
}

.error-msg {
    color: var(--accent);
    margin-top: 10px;
    font-size: 0.95rem;
    min-height: 20px;
    font-weight: 500;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border: 1px solid var(--border);
    padding: 12px;
    text-align: center;
}

th {
    background-color: var(--primary);
    color: white;
    font-weight: 500;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:nth-child(even) {
    background-color: #f9fbfc;
}

tbody tr:hover {
    background-color: #e5edf5;
}

/* Controls */
.controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.algo-selection {
    display: flex;
    align-items: center;
    gap: 10px;
}

.algo-selection label {
    font-weight: bold;
    color: var(--primary);
}

.algo-selection select {
    min-width: 250px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Results Section */
.gantt-container, .table-container {
    margin-bottom: 30px;
}

/* Gantt Chart */
.gantt-chart {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 25px; /* Space for time labels */
    min-height: 80px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fdfdfd;
}

.gantt-block {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    min-width: 50px;
    border-right: 1px solid #fff;
    color: white;
    font-weight: bold;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    transition: filter 0.2s;
}

.gantt-block:hover {
    filter: brightness(1.1);
}

.gantt-block:last-child {
    border-right: none;
}

.gantt-block.idle {
    background-color: var(--idle-bg) !important;
    color: var(--text-main);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.3) 10px,
        rgba(255,255,255,0.3) 20px
    );
}

.gantt-time-left {
    position: absolute;
    bottom: -22px;
    left: 0;
    transform: translateX(-50%);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
}

.gantt-time-right {
    position: absolute;
    bottom: -22px;
    right: 0;
    transform: translateX(50%);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
}

.avg-metrics {
    margin-top: 20px;
    padding: 15px;
    background: #eef2f5;
    border-radius: 4px;
    display: flex;
    gap: 30px;
    justify-content: center;
    font-size: 1.1rem;
    border-left: 4px solid var(--primary);
}

.avg-metrics strong {
    color: var(--primary);
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .controls-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    .action-buttons {
        justify-content: flex-end;
    }
    .algo-selection select {
        width: 100%;
    }
    .avg-metrics {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}
