@import url('https://fonts.googleapis.com/css2?family=Bungee&display=swap');

.resistor-neo-wrapper {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 1000px; margin: 20px auto;
    border: 3px solid #000; border-radius: 12px;
    box-shadow: 8px 8px 0px #000; padding: 25px;
    background: #fff; color: #000; box-sizing: border-box;
}

.resistor-neo-wrapper * { box-sizing: border-box; }

.resistor-header {
    background: #e2f0cb; padding: 15px 20px; border-radius: 12px;
    border: 3px solid #000; box-shadow: 4px 4px 0px #000; margin-bottom: 25px; text-align: center;
}
.resistor-header h2 { margin: 0 0 5px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase; color: #000; }
.resistor-header p { margin: 0; font-weight: 800; font-size: 0.95rem; }

/* TABS */
.resistor-tabs { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
.res-tab {
    flex: 1; text-align: center; padding: 12px; font-weight: 900; font-size: 1.1rem;
    border: 3px solid #000; border-radius: 8px; background: #e9ecef; color: #000;
    cursor: pointer; box-shadow: 3px 3px 0px #000; transition: 0.1s; text-transform: uppercase;
}
.res-tab.active { background: #ffdac1; box-shadow: 1px 1px 0px #000; transform: translate(2px, 2px); }

/* NỘI DUNG */
.res-content { display: none; flex-direction: column; gap: 20px; }
.res-content.active { display: flex; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.info-banner { background: #fdfd96; padding: 15px 20px; border: 3px dashed #000; border-radius: 8px; font-weight: 800; font-size: 1.05rem; }

/* CSS DRAWING: ĐIỆN TRỞ */
.resistor-visual-container { display: flex; align-items: center; justify-content: center; margin: 30px 0; }
.resistor-wire { width: 60px; height: 12px; background: #ccc; border: 3px solid #000; z-index: 1; }
.resistor-body {
    width: 280px; height: 75px; background: #e6c280; /* Màu nền điện trở (Tan) */
    border: 3px solid #000; border-radius: 30px; position: relative; z-index: 2;
    display: flex; justify-content: space-evenly; align-items: stretch; padding: 0 15px;
    box-shadow: inset 0 -8px 0 rgba(0,0,0,0.15), 4px 4px 0px #000;
}
.res-band { width: 18px; background: transparent; border-left: 2px solid rgba(0,0,0,0.3); border-right: 2px solid rgba(0,0,0,0.3); transition: background-color 0.2s; }
.res-band-tol { margin-left: 25px; } /* Cách dải dung sai ra 1 chút */
.res-band-tcr { margin-left: 15px; }

/* KẾT QUẢ ĐỌC MÀU */
.result-board { text-align: center; background: #b5ead7; border: 3px solid #000; border-radius: 8px; padding: 20px; box-shadow: 4px 4px 0px #000; }
.main-val { display: block; font-family: 'Bungee', sans-serif; font-size: 45px; color: #000; text-shadow: 2px 2px 0px #fff; -webkit-text-stroke: 1px #000; word-break: break-all;}
.sub-val { font-weight: 900; font-size: 1.5rem; color: #ff595e; background: #fff; padding: 4px 15px; border: 3px solid #000; border-radius: 20px; }

/* BỘ CHỌN MÀU (SELECTS) */
.band-selector { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: -10px; font-weight: 900; font-size: 1.1rem;}
.res-radio-group { display: flex; gap: 10px; }
.radio-neo input { display: none; }
.radio-neo .radio-btn { padding: 6px 15px; border: 2px solid #000; border-radius: 6px; background: #fff; cursor: pointer; box-shadow: 2px 2px 0px #000; transition: 0.1s; }
.radio-neo input:checked + .radio-btn { background: #000; color: #fff; box-shadow: 0px 0px 0px #000; transform: translate(2px, 2px); }

.select-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 15px; }
.color-group { display: flex; flex-direction: column; gap: 5px; }
.color-group label { font-weight: 900; font-size: 0.95rem; text-transform: uppercase;}
.color-select {
    width: 100%; padding: 12px; font-size: 1.05rem; font-weight: 900; border-radius: 8px; 
    border: 3px solid #000; outline: none; box-shadow: 3px 3px 0px #000; cursor: pointer; transition: 0.1s;
    /* JS sẽ can thiệp background color vào đây */
}
.color-select:focus { box-shadow: 1px 1px 0px #000; transform: translate(2px, 2px); }

/* INPUT & BUTTONS CHO REVERSE/SMD */
.input-row { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 15px; }
.res-group { display: flex; flex-direction: column; gap: 8px; }
.res-group label { font-weight: 900; font-size: 1.05rem; }
.res-neo-input, .res-neo-select {
    width: 100%; padding: 15px; font-size: 1.2rem; font-weight: 900; font-family: monospace;
    border-radius: 8px; border: 3px solid #000; background: #fff; color: #000;
    outline: none; box-shadow: inset 3px 3px 0px rgba(0,0,0,0.05); transition: 0.1s;
}
.res-neo-select { box-shadow: 4px 4px 0px #000; cursor: pointer; }
.res-neo-input:focus { border-color: #ff595e; }

.action-row { margin-top: 10px; }
.res-btn-primary {
    width: 100%; cursor: pointer; font-size: 1.3rem; font-weight: 900; padding: 15px;
    background-color: #ffca3a; border: 3px solid #000; border-radius: 8px; box-shadow: 4px 4px 0px #000;
    text-transform: uppercase; color: #000; transition: 0.1s;
}
.res-btn-primary:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px #000; }

.res-result-box { background-color: #f9f9f9; border: 3px solid #000; border-radius: 8px; padding: 25px; margin-top: 20px; }
.res-result-box.hidden { display: none; }
.encode-text-result { text-align: center; font-weight: 900; font-size: 1.3rem; padding: 10px; border: 3px dashed #000; border-radius: 8px; background: #fff; }
.alert-box { background: #ffb7b2; padding: 12px; border: 3px solid #000; border-radius: 6px; font-weight: 900; color: #000; }
.alert-box.hidden { display: none; }

@media (max-width: 600px) {
    .resistor-body { width: 200px; height: 50px; }
    .res-band { width: 12px; }
    .main-val { font-size: 30px; }
    .input-row { flex-direction: column; }
}