/* ============================================================
   BOOTH'S MULTIPLICATION SIMULATOR - SPECIFIC STYLES
   (Base design tokens and layout handled by shared.css)
   ============================================================ */

.container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 1500px;
    height: 950px;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.circuit-wrapper {
    position: absolute;
    top: 40px;
    left: 50px;
    width: 800px;
    height: 800px;
}

.booth-enclosure {
    position: absolute;
    top: 100px;
    left: 100px;
    width: 600px;
    height: 600px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    z-index: 2;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

.block {
    position: absolute;
    background: rgba(200, 220, 255, 0.3);
    border: 2px solid rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    text-align: center;
    height: 100px;
    transition: background 0.3s, box-shadow 0.3s, transform 0.1s;
}

.pill-shape {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 5px 20px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    font-weight: normal;
    font-size: 1rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.reg-bits {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    letter-spacing: 4px;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 15px;
    border-radius: 8px;
    border: 1px inset rgba(0, 0, 0, 0.2);
}

.block-m-reg {
    top: 30px;
    left: 150px;
    width: 300px;
}

.block-addsub {
    top: 180px;
    left: 150px;
    width: 300px;
}

.sub-label {
    font-family: var(--font-main);
    font-size: 1.1rem;
    letter-spacing: 1px;
    background: transparent;
    border: none;
}

.block-a-reg {
    top: 330px;
    left: 40px;
    width: 200px;
}

.block-q-reg {
    top: 330px;
    left: 260px;
    width: 200px;
}

.block-q1-reg {
    top: 330px;
    left: 480px;
    width: 80px;
}

.block-shift {
    top: 480px;
    left: 150px;
    width: 300px;
    justify-content: center;
}

/* Animations */
.highlight-add {
    background: rgba(40, 160, 96, 0.4) !important;
    border-color: var(--add-color) !important;
    box-shadow: 0 0 20px rgba(40, 160, 96, 0.6) !important;
}

.highlight-sub {
    background: rgba(217, 68, 85, 0.4) !important;
    border-color: var(--subtract-color) !important;
    box-shadow: 0 0 20px rgba(217, 68, 85, 0.6) !important;
}

.highlight-shift {
    background: rgba(230, 168, 23, 0.4) !important;
    border-color: var(--shift-color) !important;
    box-shadow: 0 0 20px rgba(230, 168, 23, 0.6) !important;
}

@keyframes pulseBorder {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.active-pulse {
    animation: pulseBorder 0.8s ease-in-out;
}

/* Input Nodes */
.io-node {
    position: absolute;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}

.io-label {
    font-weight: bold;
}

.io-value {
    width: 25px;
    height: 25px;
    border: 1px solid var(--main-border);
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.2s;
    font-family: var(--font-main);
    z-index: 10;
    border-radius: 6px;
}

.io-value.active {
    background: #000;
    color: #fff;
}

.input-group {
    position: absolute;
    background: rgba(230, 210, 240, 0.3);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
    z-index: 1;
    display: flex;
    align-items: center;
}

.input-group-label {
    position: absolute;
    left: -140px;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    width: 140px;
    text-align: right;
    padding-right: 15px;
}

.group-multiplicand {
    top: 145px;
    left: 20px;
    width: 60px;
    height: 140px;
}

.group-multiplicand .input-group-label {
    top: 50%;
    transform: translateY(-50%);
}

.in-m3 { top: 160px; left: 35px; flex-direction: column; }
.in-m2 { top: 190px; left: 35px; flex-direction: column; }
.in-m1 { top: 220px; left: 35px; flex-direction: column; }
.in-m0 { top: 250px; left: 35px; flex-direction: column; }

.in-m3 span, .in-m2 span, .in-m1 span, .in-m0 span { display: none; }

.group-multiplier {
    top: 450px;
    left: 20px;
    width: 60px;
    height: 140px;
}

.group-multiplier .input-group-label {
    top: 50%;
    transform: translateY(-50%);
}

.in-q3 { top: 465px; left: 35px; flex-direction: column; }
.in-q2 { top: 495px; left: 35px; flex-direction: column; }
.in-q1 { top: 525px; left: 35px; flex-direction: column; }
.in-q0 { top: 555px; left: 35px; flex-direction: column; }

.in-q3 span, .in-q2 span, .in-q1 span, .in-q0 span { display: none; }

.run-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.2s;
    letter-spacing: 1px;
}

.run-btn:hover {
    background: #1a56c5;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 108, 223, 0.3);
}

.run-btn:active {
    transform: translateX(-50%) translateY(1px);
}

/* Iteration Panel */
.iteration-panel {
    position: absolute;
    top: 100px;
    left: 800px;
    width: 600px;
    height: 500px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    padding-bottom: 10px;
}

.table-scroll {
    flex: 1;
    overflow-y: auto;
}

.iteration-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.4);
}

.iteration-table th,
.iteration-table td {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 10px;
    text-align: center;
}

.iteration-table th {
    background: rgba(0, 0, 0, 0.1);
    font-family: var(--font-main);
}

.iteration-table tr.row-add { background: rgba(40, 160, 96, 0.15); }
.iteration-table tr.row-sub { background: rgba(217, 68, 85, 0.15); }
.iteration-table tr.row-shift { background: rgba(230, 168, 23, 0.15); }

.empty-row td {
    font-family: var(--font-main);
    font-style: italic;
    color: rgba(0, 0, 0, 0.5);
    padding: 30px !important;
}

.result-row {
    margin-top: 15px;
    padding: 15px;
    background: rgba(45, 108, 223, 0.1);
    border: 2px dashed var(--accent);
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#product-binary {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 2px;
}

/* HUD */
.hud {
    position: absolute;
    bottom: 100px;
    left: 800px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 20px 22px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 12px;
    width: 600px;
    z-index: 20;
    box-shadow: var(--glass-shadow);
    font-size: 1.3rem;
}

.hud-title {
    font-weight: bold;
    border-bottom: 1px solid #000;
    margin-bottom: 15px;
    padding-bottom: 5px;
    text-align: center;
    font-size: 1.5rem;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.equation {
    font-style: italic;
    text-align: center;
    margin-top: 15px;
    font-size: 1.4rem;
    border-top: 1px dashed #000;
    padding-top: 10px;
}

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

.animate-in {
    animation: slideIn 0.3s forwards;
    opacity: 0;
}

/* --- Dark Mode Overrides for Booths --- */
body.dark-mode .booth-enclosure,
body.dark-mode .block,
body.dark-mode .input-group,
body.dark-mode .hud,
body.dark-mode .iteration-panel {
    background: var(--box-bg);
    border-color: var(--main-border);
    color: var(--text-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body.dark-mode .reg-bits {
    background: rgba(30, 35, 45, 0.9);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .hud-title,
body.dark-mode .panel-title {
    border-bottom: 1px solid var(--main-border);
}

body.dark-mode .equation {
    border-top: 1px dashed var(--main-border);
}

body.dark-mode .iteration-table {
    background: rgba(30, 35, 45, 0.6);
}

body.dark-mode .iteration-table th {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .iteration-table th,
body.dark-mode .iteration-table td {
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .iteration-table tr.row-add { background: rgba(40, 160, 96, 0.2); }
body.dark-mode .iteration-table tr.row-sub { background: rgba(217, 68, 85, 0.2); }
body.dark-mode .iteration-table tr.row-shift { background: rgba(230, 168, 23, 0.2); }

body.dark-mode .empty-row td {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .io-value {
    background: rgba(40, 45, 55, 1);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-color);
}

body.dark-mode .io-value.active {
    background: rgba(181, 244, 255, 0.3);
    border-color: #88bbff;
    color: #ffffff;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .pill-shape {
    background: rgba(40, 45, 55, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}