/* Shared Memory Component Styles */
/* Styling handled in main styles.css */
/*.shared-memory-container {
    grid-area: shared-memory;
}*/

.memory-header {
    margin-bottom: 1.5rem;
}

.memory-header h3 {
    color: var(--color-header);
    margin-bottom: 0.5rem;
}

.memory-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.memory-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.memory-block {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: var(--bg-secondary);
    box-shadow: var(--card-shadow);
    position: relative;
}

.memory-block:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.memory-block.locked {
    border-color: var(--color-blocked);
    box-shadow: 0 0 0 2px var(--color-blocked);
}

.block-header {
    background-color: var(--bg-tertiary);
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.block-address {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.lock-icon {
    color: var(--color-blocked);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.block-content {
    padding: 1rem;
}

.block-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.block-type {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-style: italic;
}

.block-value {
    font-family: monospace;
    padding: 0.6rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.block-footer {
    padding: 0.6rem;
    border-top: 1px solid #e0e0e0;
    background-color: #fafafa;
    font-size: 0.8rem;
    color: #777;
}

/* Memory access animations */
.memory-access-animation {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1000;
    pointer-events: none;
}

.memory-access-animation.read {
    background-color: #2196f3;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.7);
}

.memory-access-animation.write {
    background-color: #ff5722;
    box-shadow: 0 0 10px rgba(255, 87, 34, 0.7);
}

.memory-access-animation.lock {
    background-color: #d32f2f;
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.7);
}

.memory-access-animation.unlock {
    background-color: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
}

/* Access highlight effects */
.read-access {
    animation: access-highlight-blue 0.8s;
}

.write-access {
    animation: access-highlight-orange 0.8s;
}

.lock-access {
    animation: access-highlight-red 0.8s;
}

.unlock-access {
    animation: access-highlight-green 0.8s;
}

@keyframes access-highlight-blue {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(33, 150, 243, 0.7); }
}

@keyframes access-highlight-orange {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(255, 87, 34, 0.7); }
}

@keyframes access-highlight-red {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(211, 47, 47, 0.7); }
}

@keyframes access-highlight-green {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.7); }
}

/* Access denied animation */
.access-denied {
    position: fixed;
    background-color: rgba(211, 47, 47, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.access-denied-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate3d(-5px, 0, 0); }
    20%, 40%, 60%, 80% { transform: translate3d(5px, 0, 0); }
}

/* Demo message styles */
.demo-message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 6px;
    transition: all 0.5s ease;
    animation: fade-in 0.5s ease;
}

.demo-message.race-condition {
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
}

.demo-message.synchronized {
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.demo-message h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
