* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

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

.panel h2 {
    margin-bottom: 15px;
    color: #2575fc;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.graph-container {
    height: 400px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    position: relative;
    overflow: scroll;
    background-color: #f9f9f9;
}

/* Hide scrollbar */

.graph-container {
    -ms-overflow-style: none;
    /* Internet Explorer 10+ */
    scrollbar-width: none;
    /* Firefox, Safari 18.2+, Chromium 121+ */
}

.graph-container::-webkit-scrollbar {
    /* WebKit */
    display: none;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #555;
}

input,
select,
button {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

button {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(0);
}

.algorithm-section {
    grid-column: 1 / -1;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.matrix-table th,
.matrix-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
}

.matrix-table th {
    background-color: #f0f0f0;
}

.status {
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-weight: 600;
    text-align: center;
}

.safe {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.unsafe {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.process {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.resource {
    position: absolute;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.edge {
    position: absolute;
    height: 3px;
    background-color: #666;
    transform-origin: 0 0;
    z-index: -1;
}

.allocation {
    background-color: #4caf50;
}

.request {
    background-color: #ff9800;
}

.deadlock-cycle {
    background-color: #f44336;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.recovery-options {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.recovery-btn {
    flex: 1;
    padding: 12px;
}

.abort {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
}

.preempt {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

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