/* Operator Simulator Styles - Dark Mode */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
    position: relative;
    overflow-x: hidden;
}

/* Animated stars background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="0.5" fill="white" opacity="0.8"/><circle cx="80" cy="40" r="0.3" fill="white" opacity="0.6"/><circle cx="40" cy="60" r="0.4" fill="white" opacity="0.7"/><circle cx="90" cy="80" r="0.2" fill="white" opacity="0.5"/><circle cx="10" cy="90" r="0.3" fill="white" opacity="0.8"/></svg>') repeat;
    animation: twinkle 4s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 0.8; }
}

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

h1 {
    color: #00ffff;
    margin-bottom: 10px;
    text-align: center;
    font-size: 2.5em;
    text-shadow: 0 0 20px rgba(0,255,255,0.8);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    0% { text-shadow: 0 0 20px rgba(0,255,255,0.8); }
    100% { text-shadow: 0 0 30px rgba(0,255,255,1), 0 0 40px rgba(0,255,255,0.8); }
}

.subtitle {
    color: rgba(255,255,255,0.9);
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.1em;
}

/* Input Section */
.input-section {
    background: rgba(26, 26, 46, 0.8);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,255,255,0.2);
    animation: slideInUp 0.6s ease-out;
}

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

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

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0,255,255,0.5);
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(0,255,255,0.3);
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.5);
    color: #e0e0e0;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0,255,255,0.5);
}

.input-group textarea {
    resize: vertical;
}

.simulate-btn {
    background: linear-gradient(135deg, #00ffff 0%, #0080ff 100%);
    color: #000;
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,255,255,0.4);
    display: block;
    margin: 20px auto;
    position: relative;
    overflow: hidden;
}

.simulate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.simulate-btn:hover::before {
    left: 100%;
}

.simulate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,255,255,0.6);
}

/* Results Section */
.results-section {
    background: rgba(26, 26, 46, 0.8);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,255,255,0.2);
    animation: slideInUp 0.8s ease-out;
}

.instruction-item,
.transformation-step,
.final-call-item {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    border-left: 4px solid #00ffff;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.instruction-item h4,
.transformation-step h4,
.final-call-item h4 {
    margin-top: 0;
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0,255,255,0.5);
}

.instruction-item ul {
    margin: 10px 0;
    padding-left: 20px;
}

/* Data Comparison */
.data-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.data-before,
.data-after {
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.data-before h5,
.data-after h5 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #666;
}

code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    word-break: break-word;
    display: block;
    line-height: 1.6;
    white-space: pre-wrap;
}


/* Error Section */
.error-section {
    background: #fee;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 30px;
}

.error-message {
    color: #c0392b;
    font-weight: 600;
}

/* Collapsible transformation steps and instructions */
.transformation-step,
.instruction-item {
    border: 1px solid #ddd;
    margin-bottom: 10px;
}

.transformation-header,
.instruction-header {
    background: #f0f0f0;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #3498db;
}

.transformation-header:hover,
.instruction-header:hover {
    background: #e8e8e8;
}

.transformation-header h4,
.instruction-header h4 {
    margin: 0;
    color: #2c3e50;
}

.collapse-icon {
    font-size: 18px;
    transition: transform 0.3s;
}

.collapse-icon.expanded {
    transform: rotate(90deg);
}

.transformation-content,
.instruction-content {
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.transformation-content.expanded,
.instruction-content.expanded {
    max-height: 1000px;
    padding: 15px;
}

/* Compact comparison view */
.compact-comparison {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(145deg, #f0f8ff 0%, #e6f3ff 100%);
    border-radius: 12px;
    border-left: 4px solid #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.1);
}

.hex-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.hex-data {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.4;
    word-break: break-all;
    background: white;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.hex-data h5 {
    margin: 0 0 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #666;
}

.hex-byte {
    display: inline-block;
}

.hex-byte.changed {
    background: #e8f5e8;
    color: #2d7d2d;
    font-weight: bold;
    border-radius: 2px;
}

/* Instructions and Steps Side by Side */
.instructions-and-steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.instructions-breakdown,
.transformation-steps {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
}

.instructions-breakdown h3,
.transformation-steps h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Rocket Animation */
.rocket {
    position: fixed;
    top: 50%;
    left: -100px;
    width: 60px;
    height: 30px;
    font-size: 30px;
    z-index: 1000;
    opacity: 0;
    animation: rocketFly 3s ease-in-out;
    pointer-events: none;
}

@keyframes rocketFly {
    0% { left: -100px; opacity: 0; transform: translateY(0) rotate(0deg); }
    10% { opacity: 1; }
    50% { left: 50%; transform: translateY(-20px) rotate(5deg); }
    90% { opacity: 1; }
    100% { left: 100vw; opacity: 0; transform: translateY(0) rotate(15deg); }
}

/* Dark theme updates for remaining elements */
.data-before,
.data-after {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(0,255,255,0.2);
    color: #e0e0e0;
}

.data-before h5,
.data-after h5 {
    color: #00ffff;
}

.transformation-header,
.instruction-header {
    background: rgba(0,0,0,0.4);
    border-left: 4px solid #00ffff;
    color: #e0e0e0;
}

.transformation-header:hover,
.instruction-header:hover {
    background: rgba(0,0,0,0.6);
}

.transformation-header h4,
.instruction-header h4 {
    color: #00ffff;
}

.compact-comparison {
    background: rgba(0,0,0,0.4);
    border-left: 4px solid #00ffff;
}

.hex-data {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(0,255,255,0.2);
    color: #e0e0e0;
}

.hex-data h5 {
    color: #00ffff;
}

.hex-byte.changed {
    background: rgba(0,255,255,0.2);
    color: #00ffff;
    font-weight: bold;
}

.instructions-breakdown,
.transformation-steps {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(0,255,255,0.2);
}

.instructions-breakdown h3,
.transformation-steps h3 {
    color: #00ffff;
}

.error-section {
    background: rgba(255,0,0,0.1);
    border-left: 4px solid #ff4444;
}

.error-message {
    color: #ff6666;
}

/* Responsive */
@media (max-width: 768px) {
    .data-comparison,
    .hex-comparison,
    .instructions-and-steps {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 10px;
    }
    
    .input-section,
    .results-section {
        padding: 20px;
    }
}