/* Planner Layout */
.planner-section {
    padding: 0;
    min-height: 100vh;
    background: var(--light-gray);
}

.planner-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    height: calc(100vh - 70px);
}

/* Sidebar */
.planner-sidebar {
    background: var(--white);
    border-right: 1px solid #E5E7EB;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

.sidebar-header h2 {
    margin: 0;
}

.yard-setup, .items-panel, .yard-stats, .planner-actions {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.yard-setup h3, .items-panel h3, .yard-stats h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--dark);
}

.yard-setup .input-group {
    margin-bottom: 1rem;
}

.yard-setup .btn {
    width: 100%;
}

/* Search Box */
.search-box {
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 2px solid #E5E7EB;
    border-radius: 6px;
    font-size: 0.95rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Items List */
.items-list {
    max-height: 400px;
    overflow-y: auto;
}

.item-chip {
    background: var(--light-gray);
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.item-chip:hover {
    background: #E5F6FD;
    border-color: var(--primary);
    transform: translateX(4px);
}

.item-chip h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    color: var(--dark);
}

.item-chip p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gray);
}

/* Yard Stats */
.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stat-item span {
    color: var(--gray);
}

.stat-item strong {
    color: var(--dark);
}

/* Planner Actions */
.planner-actions {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 2rem;
}

.planner-actions .btn {
    flex: 1;
}

/* Canvas Area */
.planner-canvas {
    display: flex;
    flex-direction: column;
    background: var(--light-gray);
}

.canvas-header {
    background: var(--white);
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.canvas-tools {
    display: flex;
    gap: 0.5rem;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #E5E7EB;
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--light-gray);
    border-color: var(--primary);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #E5E7EB;
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

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

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

/* Canvas Wrapper */
.canvas-wrapper {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.yard-canvas {
    position: relative;
    background: #FFF;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    min-width: 400px;
    min-height: 300px;
}

.map-canvas {
    position: relative;
    width: 800px;
    height: 600px;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    overflow: hidden;
}

.map-canvas #map {
    width: 100%;
    height: 100%;
}

.yard-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, #E5E7EB 1px, transparent 1px),
        linear-gradient(to bottom, #E5E7EB 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    border-radius: 8px;
}

.items-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Placed Items */
.placed-item {
    position: absolute;
    cursor: move;
    transition: opacity 0.2s;
    user-select: none;
}

.placed-item:hover {
    opacity: 0.9;
    z-index: 100;
}

.item-setup-area {
    background: rgba(46, 164, 221, 0.1);
    border: 2px dashed var(--primary);
    border-radius: 4px;
    position: relative;
}

.item-actual-size {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.75rem;
    text-align: center;
    padding: 4px;
    box-shadow: var(--shadow);
}

.item-label {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    background: var(--dark);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.item-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #EF4444;
    color: var(--white);
    border: 2px solid var(--white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
}

.placed-item:hover .item-remove {
    display: flex;
}

/* Canvas Legend */
.canvas-legend {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #E5E7EB;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.instructions-list {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.instructions-list li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.modal-content .btn {
    width: 100%;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 968px) {
    .planner-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .planner-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
    }
    
    .canvas-wrapper {
        min-height: 500px;
    }
}
