/* Global styles */
body {
    background-color: #bd9a79;
    color: #433120;
}

.row {
    --bs-gutter-x: 0rem;
}

/* Headings */
h1,
h2 {
    font-weight: bolder;
    text-align: center;
}

h1 {
    background-color: rgb(119, 80, 54);
    color: #F3C24A;
    padding: 4px;
    border-radius: 10px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

h2 {
    font-size: 1.4rem;
}

/* Main container */
.container {
    background-color: rgb(67, 51, 38);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-top: 0 !important;
}

/* Section headers */
.collapse-header {
    color: #F3C24A;
    font-weight: bolder;
    background-color: rgb(119, 80, 54);
    border-radius: 10px 10px 0 0;
    padding: 10px;
    margin: 0;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    margin: 0;
}

.collapse-area {
    background-color: rgb(180, 127, 92);
    border-radius: 10px;
    overflow: hidden;
}

.collapse {
    padding-bottom: 10px;
}

/* Log output */
#log {
    max-height: 500px;
    min-height: 500px;
    overflow-y: auto;
    background: rgb(234, 208, 178);
    color: black;
    padding: 10px;
    font-size: 14px;
    white-space: pre-wrap;
}

/* Progress bar */
.progress {
    border-radius: 0px;
    height: 25px;
    background-color: rgb(180, 127, 92);
    border-bottom: rgb(67, 49, 32) 2px solid;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #16a34a);
    transition: width 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: black;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    pointer-events: none;
    font-weight: bolder;
    font-size: 100%;
}

/* Buttons */
.btn {
    font-weight: bold;
    border-radius: 8px;
    padding: 6px 12px;
    transition: background-color 0.3s ease, transform 0.1s ease;
    border: 2px solid transparent;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Folder select button */
.custom-folder-button {
    background-color: #f6bb27;
    color: #433120;
    border-color: #bd9a79;
}

.custom-folder-button:hover {
    background-color: #e2b33d;
}

.custom-folder-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(243, 194, 74, 0.5);
    border-color: #f6bb27;
    outline: none;
}

.custom-folder-button:disabled {
    color: black;
    background-color: #f6bb27;
    border-color: #bd9a79;
    filter: brightness(60%);
}

.custom-folder-button:active {
    background-color: #f6bb27 !important;
    border-color: #bd9a79 !important;
}

/* Start button */
.custom-start-button {
    background-color: #28a745;
    color: black;
    border-color: #1e7e34;
}

.custom-start-button:hover {
    background-color: #218838;
}

.custom-start-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5);
    border-color: #28a745;
    outline: none;
}

.custom-start-button:disabled {
    color: black;
    background-color: #28a745;
    border-color: #1e7e34;
    filter: brightness(60%);
}

.custom-start-button:active {
    background-color: #28a745 !important;
    border-color: #1e7e34 !important;
}

/* Stop button */
.custom-stop-button {
    background-color: #dc3545;
    color: black;
    border-color: #a71d2a;
}

.custom-stop-button:hover {
    background-color: #c82333;
}

.custom-stop-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
    border-color: #dc3545;
    outline: none;
}

.custom-stop-button:disabled {
    color: black;
    background-color: #dc3545;
    border-color: #a71d2a;
    filter: brightness(60%);
}

.custom-stop-button:active {
    background-color: #dc3545 !important;
    border-color: #a71d2a !important;
}

/* Layout fix for buttons */
.row.note .col-md-4 {
    padding: 0 5px;
}

/* Custom checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.custom-checkbox .checkmark {
    position: absolute;
    left: 0;
    top: 0;
    height: 22px;
    width: 22px;
    background-color: rgb(234, 208, 178);
    border: 2px solid #bd9a79;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.custom-checkbox:hover .checkmark {
    background-color: #f3c24a;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #28a745;
    border-color: #1e7e34;
}

.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-title {
        display: none;
    }

    #log {
        max-height: 300px;
        min-height: 300px;
    }
}

@media only screen and (max-width: 1024px) {
    .container {
        min-width: fit-content;
    }
}

/* GENERAL RESET & SCROLLBAR */
* {
    touch-action: manipulation;
}

::-webkit-scrollbar {
    width: 10px;
    background-color: #f2d9bb;
}

::-webkit-scrollbar-thumb {
    background-color: #bd9a79;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #f2d9bb;
}

/* --- DROPDOWN MENUS --- */
.dropdown-menu-dark {
    background-color: #7c5a3b;
    border: 1px solid #f3c24a;
    color: white;
    font-weight: bold;
    border-radius: 10px;
}

.dropdown-menu-dark li {
    margin-bottom: 5px;
}

.dropdown-menu-custom {
    background-color: #f3e0c2;
    min-width: 200px;
    max-height: 350px;
    overflow-y: auto;
    border: 2px solid #a97c50;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-menu-custom li {
    list-style: none;
    margin-bottom: 5px;
}

.dropdown-menu-custom li,
.form-check {
    margin-bottom: 0px !important;
}

.dropdown-menu-custom .form-check-input {
    border: 2px solid #a97c50;
    background-color: white;
}

.dropdown-menu-custom .form-check-input:checked {
    background-color: #f3c24a;
    border-color: #f3c24a;
}

.dropdown-menu-custom .form-check-label {
    color: #433120;
    font-weight: bold;
}

.dropdown-menu .form-check:hover {
    background-color: rgba(243, 194, 74, 0.25);
}

/* --- SEARCH AND SELECT --- */
#searchInput::placeholder {
    color: #7b5a3b;
}

.form-select,
.form-select option,
.btn-custom {
    background-color: #f2d9bb;
    color: #433120;
    border: 2px solid #a97c50;
    font-weight: bold;
}

#searchInput:focus,
#sortSelect:focus,
.btn-custom:focus {
    border-color: #f3c24a;
    box-shadow: 0 0 0 0.2rem rgba(243, 194, 74, 0.25);
    outline: none;
}

.btn.dropdown-toggle::after {
    display: none !important;
}

.custom-button .bi-funnel {
    font-weight: bolder;
    color: #433120;
}

/* --- FORM ELEMENTS --- */
.custom-input,
.custom-select,
.custom-button,
.form-control:focus {
    background-color: #f3e0c2;
    color: #3e2a16;
    border: 2px solid #bd9a79;
    font-weight: bold;
    border-radius: 8px;
}

.form-select:disabled {
    background-color: #cbbda8 !important;
    color: #3e2a16;
    border: 2px solid #bd9a79;
    font-weight: bold;
    border-radius: 8px;
}

.custom-input::placeholder {
    color: #8d7155;
}

.custom-input:focus,
.custom-select:focus,
.custom-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(243, 194, 74, 0.5);
    border-color: #f3c24a;
    outline: none;
}

.custom-button {
    background-color: #f3c24a;
    color: #433120;
    text-align: center;
    padding: 6px 12px;
    transition: background-color 0.3s ease;
}

.custom-button:hover {
    background-color: #e2b33d;
}

.custom-option-panel {
    background: linear-gradient(180deg, rgba(243, 224, 194, 0.55), rgba(234, 208, 178, 0.78));
    border: 2px solid #a97c50;
    border-radius: 10px;
    padding: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.custom-option-label {
    display: block;
    margin-bottom: 8px;
    color: #433120;
    font-size: 0.9rem;
    font-weight: bolder;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
}

.custom-textarea {
    background-color: #f3e0c2;
    color: #3e2a16;
    border: 2px solid #bd9a79;
    font-weight: bold;
    border-radius: 8px;
}

.custom-textarea::placeholder {
    color: #8d7155;
    font-weight: 600;
}

/* Current forum visual system */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background: #201711 url("../../img_base/bg.png") center / cover fixed no-repeat;
    color: #f7ead5;
}

.container {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 8px 12px;
    background: rgba(32, 23, 17, 0.74);
    border-inline: 1px solid rgba(215, 155, 66, 0.24);
    box-shadow: inset 12px 0 18px -18px rgba(215, 155, 66, 0.42),
        inset -12px 0 18px -18px rgba(215, 155, 66, 0.42);
}

.container > .row {
    --bs-gutter-x: 0;
    margin-inline: 0;
    row-gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    flex-wrap: nowrap;
}

.container > .row > .col-12 {
    padding-inline: 0;
    margin-bottom: 0 !important;
}

#content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    overflow-y: auto;
}

#content > .collapse-area {
    flex: 0 0 auto;
    width: 100%;
}

#content > .collapse-area:last-child {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(32, 23, 17, 0.88);
}

#content > .collapse-area:last-child .collapse.show {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#content > .collapse-area:last-child #log {
    height: 100%;
    min-height: 0;
    max-height: none;
    background: transparent;
}

.collapse-area {
    overflow: hidden;
    background: rgba(79, 54, 37, 0.86);
    border: 1px solid rgba(215, 155, 66, 0.52);
    border-radius: 0;
}

.collapse-header {
    position: relative;
    gap: 14px;
    margin: 0;
    padding: 8px 10px 8px 30px;
    border: 0;
    border-bottom: 1px solid rgba(215, 155, 66, 0.52);
    border-radius: 0;
    background: transparent;
    color: #f3c24a;
    font-size: 1.05rem;
    line-height: 1.1;
    text-align: left;
    text-shadow: none;
}

.collapse-header::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid #d79b42;
    transform: translateY(-50%) rotate(45deg);
}

.note {
    margin: 0;
    padding: 8px;
    background: rgba(96, 65, 44, 0.94);
    border: 0;
    border-radius: 0;
}

.row.note {
    width: 100%;
    margin-inline: 0 !important;
    padding: 4px !important;
    box-sizing: border-box;
}

.row.note .col-md-4,
.row.note .col-md-6,
.row.note .col-sm-12 {
    padding-inline: 4px;
}

.row.note .col-md-4 {
    padding-inline: 4px;
}

.row.note .col-md-6 {
    padding-inline: 4px;
}

.form-select,
.form-select option {
    min-height: 38px;
    border: 1px solid rgba(215, 155, 66, 0.72);
    border-radius: 5px;
    background-color: #ead6b8;
    color: #3e2a16;
}

.btn {
    min-height: 38px;
    border-width: 1px;
    border-radius: 5px;
    box-shadow: none;
}

.custom-folder-button {
    background: #d79b42;
    border-color: #f3c24a;
    color: #332318;
}

.custom-start-button {
    background: #3f704b;
    border-color: #78ad7e;
    color: #f2f5e9;
}

.custom-stop-button {
    background: #81453f;
    border-color: #b8786d;
    color: #f8e8e2;
}

.custom-folder-button:hover,
.custom-start-button:hover,
.custom-stop-button:hover {
    filter: brightness(1.1);
    transform: none;
}

.custom-folder-button,
.custom-folder-button:hover,
.custom-folder-button:focus,
.custom-folder-button:active,
.custom-folder-button.active {
    background: #e2b33d !important;
    border-color: #f3c24a !important;
    color: #332318 !important;
    box-shadow: none !important;
}

.custom-start-button,
.custom-start-button:hover,
.custom-start-button:focus,
.custom-start-button:active,
.custom-start-button.active {
    background: #4f8a5b !important;
    border-color: #8bc58b !important;
    color: #332318 !important;
    box-shadow: none !important;
}

.custom-stop-button,
.custom-stop-button:hover,
.custom-stop-button:focus,
.custom-stop-button:active,
.custom-stop-button.active {
    background: #9a5149 !important;
    border-color: #d08a7d !important;
    color: #332318 !important;
    box-shadow: none !important;
}

.custom-folder-button:disabled,
.custom-start-button:disabled,
.custom-stop-button:disabled {
    opacity: 0.58;
    filter: saturate(0.65) brightness(0.78);
    cursor: not-allowed;
}

.progress {
    height: 24px;
    border: 0;
    border-bottom: 1px solid rgba(215, 155, 66, 0.52);
    border-radius: 0;
    background: #332318;
    box-shadow: none;
}

.progress-bar {
    background: linear-gradient(90deg, #2f7f4d, #4fb36d);
    box-shadow: none;
}

.progress-text {
    color: #ffffff;
    text-shadow: none;
    font-size: 12px;
    font-weight: 800;
}

#log {
    min-height: 300px;
    max-height: 52vh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: rgba(32, 23, 17, 0.82);
    color: #f7ead5;
    padding: 10px;
    font-size: 13px;
}

@media (max-width: 1024px) {
    .container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}

@media (max-width: 700px) {
    body {
        background-attachment: scroll;
    }

    .container {
        padding-inline: 3px;
    }

    #log {
        min-height: 240px;
        max-height: 45vh;
    }
}

/* Match the overview container widths instead of forcing viewport width. */
.container {
    width: 100%;
    max-width: 1320px;
    margin-inline: auto !important;
}

@media (max-width: 1399.98px) {
    .container {
        max-width: 100%;
    }
}

html {
    scrollbar-width: thin;
    scrollbar-color: #9a6a45 #332318;
}

::-webkit-scrollbar {
    width: 10px;
    background: transparent;
}

::-webkit-scrollbar-track {
    background: #332318;
}

::-webkit-scrollbar-thumb {
    background: #9a6a45;
    border: 2px solid #332318;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b47b4f;
}

/* Keep the downloader sections in the same open, boxed layout as calculators. */
#content {
    gap: 10px;
}

#content > .collapse-area {
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
}

#content > .collapse-area .collapse-header {
    gap: 14px;
    padding: 8px 8px 8px 30px;
    border: 0;
    background: transparent;
    color: #f3c24a;
    text-align: left;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.38);
}

#content > .collapse-area .collapse-header::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    margin-left: 10px;
    background: linear-gradient(90deg, rgba(215, 155, 66, 0.7), rgba(215, 155, 66, 0.08));
}

#content > .collapse-area > .note {
    margin: 0;
    padding: 8px !important;
    border: 1px solid rgba(215, 155, 66, 0.52);
    border-radius: 8px;
    background: #60412c;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 3px 8px rgba(0, 0, 0, 0.28);
}

#content > .collapse-area:last-child {
    background: transparent;
}

#content > .collapse-area:last-child > .progress {
    flex: 0 0 24px;
    min-height: 24px;
    border: 1px solid rgba(215, 155, 66, 0.52);
    border-bottom: 1px solid rgba(215, 155, 66, 0.52);
    border-radius: 8px 8px 0 0;
    background: rgba(10, 13, 15, 0.42);
}

#content > .collapse-area:last-child > .collapse.show {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 8px !important;
    border: 1px solid rgba(215, 155, 66, 0.52);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: rgba(10, 13, 15, 0.42);
    box-shadow: none;
}

#content > .collapse-area:last-child #log {
    color: #fff4de;
    font-weight: 600;
}

/* Match the calculator page title exactly. */
.container > .row > .col-12 > h1 {
    position: sticky;
    top: 0;
    z-index: 50;
    width: calc(100% + 16px);
    margin: 0 -8px 8px;
    background: var(--gf-navbar-bg);
    color: var(--gf-gold-strong);
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid var(--gf-gold-line);
    border-radius: 0;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
    font-size: 1.35rem;
    font-weight: 900;
    text-align: left;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.42);
}

.container > .row > .col-12 > h1::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 11px 2px 4px;
    border: 2px solid #d79b42;
    transform: rotate(45deg);
}

@media (max-width: 700px) {
    .container > .row > .col-12 > h1 {
        width: calc(100% + 6px);
        margin-inline: -3px;
    }
}

/* 2026 semantic text console */
#content > .collapse-area:last-child #log {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    overflow-y: auto;
    padding: 6px 0;
    background: transparent;
    color: #dce7ea;
    font-family: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
    box-shadow: none;
}

.log-line {
    --log-accent: #70b8d4;
    display: grid;
    grid-template-columns: 76px 18px 78px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 6px 12px 6px 10px;
    border-left: 0;
    border-bottom: 1px solid rgba(215, 155, 66, 0.24);
    background: transparent;
    animation: console-line-in 0.16s ease-out both;
}

.log-line:hover {
    background: transparent;
    border-bottom-color: rgba(215, 155, 66, 0.42);
}

.log-time {
    color: #657780;
    font-size: 11px;
    white-space: nowrap;
}

.log-icon {
    color: var(--log-accent);
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 0 10px color-mix(in srgb, var(--log-accent) 35%, transparent);
}

.log-level {
    color: var(--log-accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.075em;
    white-space: nowrap;
}

.log-message {
    min-width: 0;
    color: #dce7ea;
    overflow-wrap: anywhere;
}

.log-value {
    color: #8bddea;
    font-weight: 650;
}

.log-notice { --log-accent: #e0a84d; }
.log-info { --log-accent: #67bfe5; }
.log-process { --log-accent: #b492e6; }
.log-download { --log-accent: #55cedd; }
.log-success { --log-accent: #62d48b; }
.log-skip { --log-accent: #87969e; }
.log-cache { --log-accent: #9f9aea; }
.log-warning { --log-accent: #e9bd55; }
.log-error { --log-accent: #f06f74; }
.log-stopped { --log-accent: #df9367; }

.log-error .log-message {
    color: #ffd2d2;
}

.log-warning .log-message {
    color: #f4dfad;
}

.log-success .log-message {
    color: #ccefd8;
}

@keyframes console-line-in {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 700px) {
    .log-line {
        grid-template-columns: 64px 15px 64px minmax(0, 1fr);
        gap: 5px;
        padding-inline: 7px;
    }

    .log-time {
        font-size: 10px;
    }

    .log-level {
        font-size: 9px;
        letter-spacing: 0.035em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .log-line {
        animation: none;
    }
}

/* Keep log overflow inside the console instead of scrolling the page. */
html,
body {
    height: 100%;
    overflow: hidden;
}

.container {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

#content {
    overflow: hidden;
}

#content > .collapse-area:last-child,
#content > .collapse-area:last-child > .collapse.show,
#content > .collapse-area:last-child #log {
    min-height: 0;
}

#content > .collapse-area:last-child #log {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
