/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Visualization Container */
.visualization-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Layer Styles */
.layer {
    margin-bottom: 25px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.layer:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
}

.layer-header h3 {
    color: #495057;
    font-size: 1.2rem;
    font-weight: 600;
}

.add-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.add-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.layer-content {
    padding: 20px;
    min-height: 80px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

/* PV layer should display all PVs in a horizontal row */
#pv-content {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 15px;
    overflow-x: auto;
    align-items: center;
}

#pv-content .bar {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 200px;
}

/* Different colors for each layer */
#filesystem-layer .layer-header { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
#filesystem-layer .layer-header h3 { color: white; }

#lv-layer .layer-header { background: linear-gradient(135deg, #4834d4, #686de0); }
#lv-layer .layer-header h3 { color: white; }

#vg-layer .layer-header { background: linear-gradient(135deg, #00d2d3, #01a3a4); }
#vg-layer .layer-header h3 { color: white; }

#pv-layer .layer-header { background: linear-gradient(135deg, #54a0ff, #2e86de); }
#pv-layer .layer-header h3 { color: white; }

/* Bar Styles */
.bar {
    position: relative;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    user-select: none;
    overflow: hidden;
}

.bar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.bar.selected {
    border: 3px solid #ffd700;
    box-shadow: 0 0 20px rgba(255,215,0,0.4);
}

/* Bar colors by type */
.bar.filesystem { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.bar.logical-volume { background: linear-gradient(135deg, #4834d4, #686de0); }
.bar.volume-group { background: linear-gradient(135deg, #00d2d3, #01a3a4); }
.bar.physical-volume { background: linear-gradient(135deg, #54a0ff, #2e86de); }

/* Resize handles - only for PV and LV */
.bar.physical-volume::before,
.bar.physical-volume::after,
.bar.logical-volume::before,
.bar.logical-volume::after {
    content: '';
    position: absolute;
    top: 0;
    width: 5px;
    height: 100%;
    background: rgba(255,255,255,0.3);
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bar.physical-volume::before,
.bar.logical-volume::before {
    left: 0;
}

.bar.physical-volume::after,
.bar.logical-volume::after {
    right: 0;
}

.bar.physical-volume:hover::before,
.bar.physical-volume:hover::after,
.bar.logical-volume:hover::before,
.bar.logical-volume:hover::after {
    opacity: 1;
}

/* VG and FS bars should not show resize handles */
.bar.volume-group,
.bar.filesystem {
    cursor: pointer; /* Only allow clicking, not resizing */
}

/* Bar info overlay */
.bar-info {
    position: absolute;
    top: -5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    pointer-events: none;
}

/* Controls */
.controls {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.info-panel h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

#info-content {
    color: #6c757d;
    line-height: 1.6;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #333;
}

#modal-title {
    margin-bottom: 25px;
    color: #495057;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.form-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.form-buttons button[type="submit"] {
    background: #007bff;
    color: white;
}

.form-buttons button[type="submit"]:hover {
    background: #0056b3;
}

.form-buttons button[onclick*="delete"] {
    background: #dc3545;
    color: white;
}

.form-buttons button[onclick*="delete"]:hover {
    background: #c82333;
}

.form-buttons button[onclick*="close"] {
    background: #6c757d;
    color: white;
}

.form-buttons button[onclick*="close"]:hover {
    background: #545b62;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .layer-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .visualization-container {
        padding: 15px;
    }

    .bar {
        min-width: 100%;
        margin-bottom: 10px;
    }

    .layer-content {
        flex-direction: column;
    }

    .modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 20px;
    }

    .form-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    .bar {
        height: 45px;
        font-size: 0.8rem;
    }

    .add-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* Animation classes */
.bar-entering {
    animation: slideInFromRight 0.5s ease-out;
}

.bar-leaving {
    animation: slideOutToRight 0.3s ease-in;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Drag and drop styles */
.bar.dragging {
    opacity: 0.7;
    z-index: 100;
}

.bar.drag-over {
    border: 3px dashed #007bff;
    background: rgba(0,123,255,0.2) !important;
}

/* Dependency status styles */
.bar.unassigned {
    border: 2px dashed #ffc107;
    opacity: 0.8;
}

.bar.unassigned::after {
    content: '⚠';
    position: absolute;
    top: 2px;
    right: 2px;
    color: #ffc107;
    font-weight: bold;
}

/* Status indicators */
.status-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.status-indicator.warning {
    background: #ffc107;
}

.status-indicator.error {
    background: #dc3545;
}