:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --accent-color: #e74c3c;
    --bg-color: #f4f7f6;
    --river-color: #2980b9;
    --bank-color: #8e44ad;
    --text-color: #2c3e50;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    color: var(--primary-color);
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #ecf0f1;
    border-radius: 8px;
}

.algorithm-selector, .controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.algo-btn, .primary-btn, .secondary-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.algo-btn {
    background: #bdc3c7;
}

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

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

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

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

/* Visualization */
.river-container {
    display: flex;
    height: 350px;
    background: #e0f2f1; /* Light sky blue */
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 5px solid #3e2723;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.bank {
    width: 20%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    position: relative;
    background: #4caf50; /* Green grass */
    z-index: 2;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-left: 2px solid #388e3c;
    border-right: 2px solid #388e3c;
}

.left-bank {
    border-left: none;
    border-radius: 7px 0 0 7px;
}

.right-bank {
    border-right: none;
    border-radius: 0 7px 7px 0;
}

.bank-label {
    font-weight: bold;
    margin-bottom: 15px;
    background: #2e7d32;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-content: flex-start;
    height: 100%;
}

.item-icon {
    font-size: 2.5rem;
    background: white;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid #eee;
}

.item-icon:hover {
    transform: scale(1.15) translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    background: #fff;
    border-color: var(--primary-color);
}

.river {
    width: 60%;
    background: #03a9f4; /* Deep water */
    position: relative;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 10%),
        radial-gradient(circle at 70% 60%, rgba(255,255,255,0.1) 0%, transparent 10%),
        linear-gradient(90deg, #0288d1 0%, #03a9f4 50%, #0288d1 100%);
    animation: waves 5s ease-in-out infinite;
    z-index: 1;
}

@keyframes waves {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.boat-lane {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    height: 100px;
}

.boat {
    position: absolute;
    left: 10px;
    width: 120px;
    height: 70px;
    background: #5d4037; /* Darker wood */
    border-radius: 5px 5px 40px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 1s cubic-bezier(0.45, 0, 0.55, 1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
    cursor: pointer;
    border-top: 4px solid #795548;
}

.boat:hover {
    filter: brightness(1.2);
}

.boat-icon {
    font-size: 3.5rem;
    position: absolute;
    top: -35px;
    left: 10px;
}

.boat-items {
    display: flex;
    gap: 8px;
    z-index: 10;
    margin-left: 20px;
}

.farmer-in-boat {
    font-size: 2.2rem;
    position: absolute;
    top: -15px;
    right: 15px;
    z-index: 11;
}

.boat-items .item-icon {
    width: 45px;
    height: 45px;
    font-size: 1.8rem;
    border: none;
}

/* Status Panel */
.status-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.status-box, .stats-box, .log-box {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.log-box {
    max-height: 200px;
    overflow-y: auto;
}

#log-content {
    font-size: 0.9rem;
    color: #666;
}

.log-entry {
    border-bottom: 1px solid #eee;
    padding: 4px 0;
}

.log-entry:last-child {
    border-bottom: none;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: #888;
}

@media (max-width: 768px) {
    .status-panel {
        grid-template-columns: 1fr;
    }
}
