/* Global Styles */
body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 20px;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: white;
    color: black;
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Nanum Gothic', sans-serif;
    line-height: 1.6;
    padding: 20px;
    font-size: 20pt;
    /* Default text size 20pt */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    /* Identify container for absolute positioning context */
    transition: max-width 0.3s ease;
    /* Smooth transition */
}

.container.full-width {
    max-width: 98%;
}

.maximize-btn {
    position: absolute;
    padding: 8px 16px;
    background-color: #333;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14pt;
    font-family: inherit;
    border-radius: 4px;
}

.maximize-btn-top {
    top: 0;
    right: 0;
}

.maximize-btn-bottom {
    bottom: -50px;
    /* Position below the container or at the bottom edge */
    right: 0;
}

.maximize-btn:hover {
    background-color: #555;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24pt;
}

/* Upload Section */
.upload-section {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-weight: bold;
    font-size: 14pt;
}

.input-group input {
    padding: 10px;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 12pt;
}

/* Table Styles */
.table-container {
    margin-bottom: 40px;
    overflow-x: auto;
}

.table-title {
    font-size: 20pt;
    font-weight: bold;
    margin-bottom: 10px;
    border-left: 5px solid black;
    padding-left: 10px;
}

.table-scroll-container {
    max-height: 400px;
    /* Approximately 10 lines */
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #ccc;
}

table {
    width: auto;
    border-collapse: collapse;
    background-color: white;
    color: black;
    font-size: 10pt;
    /* Tables remain 10pt as earlier */
    white-space: nowrap;
}

th,
td {
    padding: 6px 10px;
    border: 1px solid black;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

/* Diagram Section */
.diagram-section {
    margin-top: 40px;
    width: 100%;
}

#supply-plan-container {
    width: 100%;
    height: 960px;
    border: 2px solid black;
    background-color: white;
    position: relative;
    overflow: hidden;
}

.instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    font-size: 18pt;
    pointer-events: none;
}

/* D3 Elements Styling */
.node-triangle {
    fill: yellow;
    stroke: black;
    stroke-width: 2px;
    cursor: grab;
}

.node-triangle:active {
    cursor: grabbing;
}

.node-bottom-label {
    font-size: 15pt;
    font-weight: bold;
    fill: black;
    text-anchor: middle;
    pointer-events: none;
}

.link-line {
    fill: none;
    stroke: #5b9bd5;
    /* Blue line */
    stroke-width: 4px;
    /* Thick line */
}

.link-label {
    font-size: 10pt;
    fill: black;
    text-anchor: middle;
}

.marker {
    fill: #5b9bd5;
}

/* Download Button Styling (SVG Download) */
.download-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    background-color: #5b9bd5;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14pt;
    font-weight: bold;
    font-family: inherit;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.download-btn:hover {
    background-color: #4a8ac2;
}

/* Sample Download Button (Regular Flow) */
.sample-down-btn {
    padding: 12px 24px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16pt;
    font-weight: bold;
    font-family: inherit;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, transform 0.1s;
}

.sample-down-btn:hover {
    background-color: #218838;
}

.sample-down-btn:active {
    transform: translateY(2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 16px;
        /* Decrease base font size for mobile */
    }

    .container {
        width: 100%;
        padding: 0;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .upload-section {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }

    .input-group label {
        font-size: 14px;
    }

    .table-title {
        font-size: 18px;
    }

    #supply-plan-container {
        height: 60vh;
        /* Use viewport height for better fit on small screens */
        min-height: 400px;
    }

    .instructions {
        font-size: 14px;
        width: 90%;
    }

    .download-btn {
        padding: 8px 12px;
        font-size: 14px;
        bottom: 10px;
        right: 10px;
    }
}