/* Reorder Buffer Simulation Styles */

:root {
    --primary-color: #3273dc;
    --success-color: #48c774;
    --warning-color: #ffdd57;
    --danger-color: #f14668;
    --info-color: #3298dc;
    --dark-color: #363636;
    --light-color: #f5f5f5;
    --border-radius: 6px;
    --box-shadow: 0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1), 0 0px 0 1px rgba(10, 10, 10, 0.02);
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.container.is-fluid {
    background: rgba(255, 255, 255, 0.95);
    margin: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

/* Header Styling */
.hero.is-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.hero-body {
    padding: 2rem 1.5rem;
}

.title .fas {
    margin-right: 0.5rem;
    color: #fff;
}

/* Box Enhancements */
.box {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.box:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.75em 1.5em -0.125em rgba(10, 10, 10, 0.15), 0 0px 0 1px rgba(10, 10, 10, 0.02);
}

/* Instruction Queue Styling */
.instruction-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dbdbdb;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background: #fafafa;
}

.instruction-item {
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.instruction-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.instruction-item.current {
    border-left-color: var(--success-color);
    background: #effaf3;
    font-weight: bold;
}

.instruction-item.completed {
    border-left-color: #ccc;
    background: #f5f5f5;
    opacity: 0.7;
}

/* ROB Table Styling */
.table {
    font-size: 0.85rem;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border: none;
}

.table td {
    text-align: center;
    padding: 0.5rem;
    border: 1px solid #e8e8e8;
    transition: background-color 0.2s ease;
}

.table tbody tr:hover td {
    background-color: #f0f8ff;
}

/* ROB Entry States */
.rob-entry {
    border-radius: var(--border-radius);
    padding: 0.25rem 0.5rem;
    font-weight: 500;
    font-size: 0.8rem;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.rob-entry.empty {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.rob-entry.issue {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.rob-entry.execute {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #74c0fc;
}

.rob-entry.complete {
    background: #d4edda;
    color: #155724;
    border: 1px solid #51cf66;
}

.rob-entry.commit {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #adb5bd;
}

.rob-entry.exception {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1556c;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Register Alias Table */
.rat-entry {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.rat-entry.mapped {
    background: #e3f2fd;
    font-weight: bold;
}

/* Timeline Styling */
.timeline-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dbdbdb;
    border-radius: var(--border-radius);
    padding: 1rem;
    background: #fafafa;
}

.timeline-row {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timeline-instruction {
    font-weight: bold;
    min-width: 120px;
    font-family: 'Courier New', monospace;
}

.timeline-stages {
    flex: 1;
    display: flex;
    margin-left: 1rem;
}

.timeline-stage {
    width: 20px;
    height: 20px;
    margin: 0 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    position: relative;
}

.timeline-stage.issue { background: var(--warning-color); }
.timeline-stage.execute { background: var(--info-color); }
.timeline-stage.complete { background: var(--success-color); }
.timeline-stage.commit { background: var(--dark-color); }
.timeline-stage.empty { background: #e8e8e8; color: #666; }

/* Commit Log */
.log-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dbdbdb;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background: #fafafa;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid #eee;
    color: var(--dark-color);
}

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

.log-entry .timestamp {
    color: var(--info-color);
    font-weight: bold;
}

.log-entry .instruction {
    color: var(--primary-color);
    font-weight: bold;
}

/* Control Buttons */
.button {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.2s ease;
}

.button:hover:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.button:active:not([disabled]) {
    transform: translateY(0);
}

.button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Slider Styling */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

/* Progress Bar */
.progress {
    border-radius: var(--border-radius);
    height: 1rem;
}

/* Help Button */
.help-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Modal Enhancements */
.modal-card {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.modal-card-head {
    background: var(--primary-color);
    color: white;
}

.modal-card-body {
    padding: 2rem;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .container.is-fluid {
        margin: 0.5rem;
    }
    
    .hero-body {
        padding: 1rem;
    }
    
    .title.is-3 {
        font-size: 1.5rem;
    }
    
    .subtitle.is-5 {
        font-size: 1rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 0.25rem;
    }
    
    .timeline-stage {
        width: 15px;
        height: 15px;
        font-size: 0.6rem;
    }
    
    .help-button {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }
}

@media screen and (max-width: 480px) {
    .columns {
        display: block;
    }
    
    .column {
        width: 100% !important;
        margin-bottom: 1rem;
    }
    
    .field.is-grouped {
        flex-wrap: wrap;
    }
    
    .field.is-grouped .control {
        margin-bottom: 0.5rem;
    }
    
    .button {
        font-size: 0.85rem;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.highlight {
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% { background-color: #ffeb3b; }
    100% { background-color: transparent; }
}

/* Instruction Syntax Highlighting */
.instruction-syntax {
    font-family: 'Courier New', monospace;
}

.instruction-syntax .opcode {
    color: var(--primary-color);
    font-weight: bold;
}

.instruction-syntax .register {
    color: var(--success-color);
    font-weight: bold;
}

.instruction-syntax .immediate {
    color: var(--warning-color);
    font-weight: bold;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-mono { font-family: 'Courier New', monospace; }
.font-bold { font-weight: bold; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}