@import url('https://fonts.googleapis.com/css2?family=Bungee&display=swap');

.percentcalc-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: 30px;
    background: #fff; color: #000; box-sizing: border-box;
}

.percentcalc-neo-wrapper * { box-sizing: border-box; }

/* HEADER */
.percentcalc-header {
    background: #ffb7b2; padding: 15px 20px; border-radius: 12px;
    border: 3px solid #000; box-shadow: 4px 4px 0px #000; margin-bottom: 30px; text-align: center;
}
.percentcalc-header h2 { margin: 0 0 5px 0; font-size: 1.8rem; font-weight: 900; text-transform: uppercase; }
.percentcalc-header p { margin: 0; font-weight: 800; font-size: 1rem; color: #222; }

/* GRID 2 CỘT */
.percentcalc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Chia 2 cột bằng nhau */
    gap: 25px;
    margin-bottom: 30px;
}

/* THẺ CARD CHỨC NĂNG */
.percentcalc-card {
    border: 3px solid #000; border-radius: 10px; padding: 25px;
    box-shadow: 4px 4px 0px #000; position: relative; transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column;
}
.percentcalc-card:focus-within { transform: translateY(-3px); box-shadow: 6px 6px 0px #000; }

.full-width-card {
    grid-column: 1 / -1; /* Ép card số 3 trải dài hết cả 2 cột */
}

.bg-yellow { background-color: #fdfd96; }
.bg-green { background-color: #e2f0cb; }
.bg-blue { background-color: #e6f7ff; }

.percentcalc-card-header {
    font-size: 1.3rem; font-weight: 900; margin: 0 0 15px 0; 
    border-bottom: 3px dashed #000; padding-bottom: 10px; text-transform: uppercase;
}

/* KHU VỰC CÂU HỎI & NHẬP LIỆU */
.percentcalc-question {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; flex-grow: 1;
}

.percentcalc-text { font-weight: 800; font-size: 1.1rem; color: #111; }

.percentcalc-input {
    padding: 12px 15px; font-size: 1.2rem; font-weight: 900; font-family: monospace;
    border: 3px solid #000; border-radius: 6px; outline: none; background-color: #fff; 
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.05); transition: 0.1s;
}
.percentcalc-input:focus { border-color: #ff595e; box-shadow: 2px 2px 0px #ff595e; transform: translateY(-2px);}

.input-short { width: 100px; }
.input-long { width: 140px; flex-grow: 1; } /* Cho phép ô input dãn ra theo cột */

/* KHU VỰC KẾT QUẢ */
.percentcalc-result-box {
    background-color: #fff; border: 3px solid #000; border-radius: 8px; padding: 15px 20px;
    display: flex; align-items: center; gap: 15px; box-shadow: 3px 3px 0px #000; margin-top: auto;
}

.percentcalc-res-label { font-weight: 900; font-size: 1.1rem; color: #555; text-transform: uppercase;}
.percentcalc-res-val {
    flex: 1; font-family: monospace; font-size: 2rem; font-weight: 900; color: #e05a47; word-break: break-all;
}

.text-green { color: #32CD32 !important; } /* Tăng */
.text-red { color: #ff595e !important; }   /* Giảm */

/* NÚT COPY */
.percentcalc-btn-copy {
    background-color: #ffca3a; border: 3px solid #000; border-radius: 6px; padding: 10px 15px;
    font-size: 1.2rem; cursor: pointer; box-shadow: 2px 2px 0px #000; transition: 0.1s;
}
.percentcalc-btn-copy:active { transform: translate(2px, 2px); box-shadow: 0px 0px 0px #000; }

/* KHU VỰC MẸO (TIPS) */
.percentcalc-tips {
    background-color: #f4f4f4; border: 3px dashed #000; border-radius: 12px; padding: 20px; font-weight: 600;
}
.percentcalc-tips h4 { margin: 0 0 10px 0; font-size: 1.2rem; font-weight: 900; color: #ff595e;}
.percentcalc-tips p { margin: 5px 0; line-height: 1.6; font-size: 1rem; color: #333;}

/* TOAST THÔNG BÁO COPY */
#percentcalcToast {
    visibility: hidden; min-width: 200px; background-color: #000; color: #fff;
    text-align: center; border-radius: 8px; padding: 12px; position: fixed;
    z-index: 9999; bottom: 30px; left: 50%; transform: translateX(-50%);
    font-weight: bold; opacity: 0; transition: opacity 0.3s, bottom 0.3s;
}
#percentcalcToast.show { visibility: visible; opacity: 1; bottom: 50px; }

/* ĐÁP ỨNG THIẾT BỊ DI ĐỘNG (MOBILE RESPONSIVE) */
@media (max-width: 800px) {
    .percentcalc-grid {
        grid-template-columns: 1fr; /* Gập lại thành 1 cột trên màn hình nhỏ */
    }
    .full-width-card {
        grid-column: 1; /* Reset lại để không bị tràn màn hình */
    }
    .percentcalc-input { flex: 1; width: 100%; }
    .percentcalc-result-box { flex-direction: column; align-items: stretch; text-align: center; }
    .percentcalc-res-val { font-size: 1.6rem; }
}