/* GIAO DIỆN SOFT BRUTALISM & NAMESPACED - GRAPHING CALCULATOR */
.graphcalc-container {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    max-width: 1100px; margin: 20px auto;
    border: 3px solid #111111; border-radius: 12px;
    box-shadow: 6px 6px 0px #111111; padding: 30px;
    background: #ffffff; color: #111111; box-sizing: border-box;
}

.graphcalc-container * { box-sizing: border-box; }

.graphcalc-title {
    font-family: 'Montserrat', sans-serif; font-size: 2rem; text-align: center;
    text-transform: uppercase; margin-top: 0; margin-bottom: 10px; font-weight: 900;
}

.graphcalc-desc { text-align: center; color: #444; font-weight: 600; margin-bottom: 30px; line-height: 1.5; }

.graphcalc-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 30px; }

/* Cột Điều khiển */
.graphcalc-control-panel { display: flex; flex-direction: column; gap: 20px; }

.graphcalc-card {
    border: 3px solid #111; border-radius: 10px; padding: 20px;
    box-shadow: 4px 4px 0px #111;
}
.bg-yellow { background-color: #fdfd96; }
.bg-blue { background-color: #e6f7ff; }

.graphcalc-card-header {
    font-family: 'Montserrat', sans-serif; font-size: 1.1rem; font-weight: 900;
    margin: 0 0 15px 0; border-bottom: 3px dashed #111; padding-bottom: 10px; text-transform: uppercase;
}

.graphcalc-group { margin-bottom: 15px; }
.graphcalc-group:last-child { margin-bottom: 0; }
.graphcalc-label { display: block; font-weight: 800; font-size: 0.95rem; margin-bottom: 8px; color: #111; }

.graphcalc-input-wrap { display: flex; box-shadow: inset 2px 2px 0px rgba(0,0,0,0.05); border-radius: 6px; }
.graphcalc-prefix {
    background-color: #111; color: #fff; font-family: 'Montserrat', sans-serif; font-weight: 900;
    padding: 0 15px; display: flex; align-items: center; border: 3px solid #111; border-right: none;
    border-radius: 6px 0 0 6px; font-size: 1.1rem;
}
.graphcalc-input {
    flex: 1; width: 100%; padding: 12px; font-size: 1.2rem; font-weight: 800;
    font-family: 'Courier New', Courier, monospace; border: 3px solid #111; border-radius: 0 6px 6px 0; outline: none;
}
.graphcalc-input:focus { border-color: #2d7bb5; }
.graphcalc-group small { display: block; margin-top: 5px; color: #555; font-weight: 600; font-size: 0.85rem; }

.graphcalc-color-picker { display: flex; align-items: center; gap: 15px; }
.graphcalc-input-color {
    width: 50px; height: 50px; padding: 0; border: 3px solid #111; border-radius: 6px;
    cursor: pointer; box-shadow: 2px 2px 0px #111; background-color: #fff;
}
#graphcalcColorHex { font-family: 'Courier New', Courier, monospace; font-weight: 900; font-size: 1.1rem; }

.graphcalc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.graphcalc-grid-2 .graphcalc-input { border-radius: 6px; font-size: 1rem; padding: 10px; }

.graphcalc-btn-primary, .graphcalc-btn-secondary {
    font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 1rem;
    padding: 15px; border: 3px solid #111; border-radius: 8px; cursor: pointer;
    box-shadow: 4px 4px 0px #111; transition: transform 0.1s; width: 100%; text-transform: uppercase;
}
.graphcalc-btn-primary { background-color: #111; color: #fff; margin-top: 10px; font-size: 1.1rem; }
.graphcalc-btn-secondary { background-color: #fff; color: #111; margin-top: 15px; padding: 10px; }
.graphcalc-btn-primary:active, .graphcalc-btn-secondary:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px #111; }

.graphcalc-error {
    margin-top: 10px; background-color: #ffe6e6; color: #e05a47; border: 2px dashed #e05a47;
    border-radius: 8px; padding: 12px; font-weight: 700; font-size: 0.95rem; display: none;
}
.graphcalc-debug { margin-top: 10px; font-size: 0.85rem; color: #666; font-family: monospace; }

/* Cột SVG Đồ thị */
.graphcalc-visual-panel { display: flex; flex-direction: column; gap: 20px; }

.graphcalc-canvas-wrap {
    background-color: #fff; border: 3px solid #111; border-radius: 10px;
    box-shadow: 5px 5px 0px #111; overflow: hidden; display: flex; justify-content: center; align-items: center;
    position: relative; height: 500px; width: 100%;
}
#graphcalcPlot { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }

/* CUSTOM LẠI CSS D3.js (Quan trọng: Đổ mã Hex cứng để khi render sang PNG không bị mất nét) */
.function-plot .axis path, .function-plot .axis line { stroke: #111111 !important; stroke-width: 2px !important; }
.function-plot .origin { stroke: #111111 !important; stroke-width: 2px !important; }
.function-plot text { font-family: 'Montserrat', sans-serif !important; font-weight: 700 !important; fill: #111111 !important; }
.function-plot .inner-x-axis, .function-plot .inner-y-axis { opacity: 0.2 !important; stroke-width: 1px !important; stroke: #111111 !important;}
.function-plot .line { stroke-width: 4px !important; fill: none !important; }

/* Khu vực Xuất ảnh */
.graphcalc-export-panel {
    background-color: #f9f9f9; border: 3px dashed #111; border-radius: 10px;
    padding: 20px; display: flex; flex-direction: column; gap: 15px;
}
.graphcalc-export-title { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 1.1rem; text-transform: uppercase; }
.graphcalc-export-options { display: flex; flex-direction: column; gap: 10px; }
.graphcalc-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; color: #333; }
.graphcalc-checkbox input { width: 18px; height: 18px; cursor: pointer; accent-color: #111; }

.graphcalc-btn-export {
    background-color: #b5ead7; font-family: 'Montserrat', sans-serif; font-weight: 900;
    font-size: 1rem; padding: 12px; border: 3px solid #111; border-radius: 8px; cursor: pointer;
    box-shadow: 4px 4px 0px #111; transition: transform 0.1s; align-self: flex-start; text-transform: uppercase;
}
.graphcalc-btn-export:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px #111; }

@media (max-width: 850px) {
    .graphcalc-layout { grid-template-columns: 1fr; }
    .graphcalc-canvas-wrap { height: 400px; }
}