/* ============================================================================ */
/* TurboBricksManager - static\branding\brand.css */
/* Author: ZioTitanok (v. 2026.06.03) */
/* ============================================================================ */

/* --- Design Tokens --- */
:root {
    --brand-color-primary: #008000;
    --brand-color-primary-rgb: 0, 128, 0;
    --brand-color-secondary: #ffffff;
    --brand-ink: #17324d;
    --brand-muted: #5c6770;
    --brand-bg: #f4f6f8;
    --brand-surface: #ffffff;
    --brand-shadow: 0 8px 24px rgba(23, 50, 77, 0.08);

    --bs-primary: var(--brand-color-primary);
    --bs-primary-rgb: var(--brand-color-primary-rgb);
    --bs-body-bg: var(--brand-bg);
    --bs-body-color: var(--brand-ink);
    --bs-secondary-color: var(--brand-muted);
    --bs-border-color: rgba(23, 50, 77, 0.12);
    --bs-border-radius: 0.375rem;
    --bs-box-shadow-sm: var(--brand-shadow);
    --bs-link-color: var(--brand-color-primary);
    --bs-link-hover-color: var(--brand-ink);
}

/* --- Base Elements --- */
body {
    line-height: 1.55;
}

h1,
h2,
h3,
h4,
h5,
h6,
.app-brand {
    color: var(--brand-ink);
    letter-spacing: 0;
}

th {
    font-size: clamp(16px, 2vw, 18px);
}

/* --- App Layout --- */
.app-main {
    width: 100%;
}

.app-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-content > .row,
.app-content > section.row {
    margin-left: 0;
    margin-right: 0;
}

.app-content > .row > .col-lg-12,
.app-content > section.row > .col-lg-12 {
    padding-left: 0;
    padding-right: 0;
}

.app-content > .row > .col-lg-12 > .container,
.app-content > section.row > .col-lg-12 > .container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.app-content h3:first-child {
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 0.35rem;
}

.app-content h3:first-child + .d-flex h5,
.app-content .row.justify-content-center h5 {
    color: var(--bs-secondary-color);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.35;
}

.app-content > .row > .col-lg-12 > .container > hr:first-of-type,
.app-content > section.row > .col-lg-12 > .container > hr:first-of-type {
    margin: 1rem 0 1.25rem;
    opacity: 0.12;
}

.surface-panel {
    background: var(--brand-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--brand-shadow);
    padding: 1.25rem;
}

/* --- Navigation --- */
.app-brand {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1;
}

.app-navbar {
    background: var(--brand-color-primary) !important;
    box-shadow: 0 6px 18px rgba(23, 50, 77, 0.06);
    color: var(--brand-color-secondary);
}

.app-navbar-brand {
    align-items: center;
    display: inline-flex;
    gap: 0.55rem;
    line-height: 1;
    padding-bottom: 0.25rem;
    padding-top: 0.25rem;
}

.app-navbar-logo {
    height: 36px;
    width: 36px;
}

.app-navbar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.app-navbar-brand-text small {
    color: var(--brand-color-secondary);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1;
    opacity: 0.82;
}

.app-navbar .app-brand,
.app-navbar .navbar-brand,
.app-navbar .navbar-toggler,
.app-navbar .nav-link {
    color: var(--brand-color-secondary) !important;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .navbar-brand:hover,
.app-navbar .navbar-brand:focus {
    color: var(--brand-color-secondary) !important;
    opacity: 0.82;
}

.app-navbar .square-btn {
    --bs-btn-color: var(--brand-color-secondary);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--brand-color-secondary);
    --bs-btn-hover-bg: rgba(255, 255, 255, 0.16);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--brand-color-secondary);
    --bs-btn-active-bg: rgba(255, 255, 255, 0.24);
    --bs-btn-active-border-color: transparent;
}

.app-nav .nav-link {
    --bs-nav-link-color: var(--brand-color-secondary);
    --bs-nav-link-hover-color: var(--brand-color-secondary);
    align-items: center;
    display: flex;
    font-size: 0.95rem;
    font-weight: 500;
    min-height: 36px;
}

.app-mobile-nav .nav-link {
    --bs-nav-link-color: var(--brand-color-primary);
    --bs-nav-link-hover-color: var(--brand-color-secondary);
    font-size: 1rem;
    font-weight: 500;
}

a.nav-link {
    height: 100%;
    text-decoration: none !important;
}

/* --- Buttons / Links --- */
.btn-primary {
    --bs-btn-color: var(--brand-color-secondary);
    --bs-btn-bg: var(--brand-color-primary);
    --bs-btn-border-color: var(--brand-color-primary);
    --bs-btn-hover-color: var(--brand-color-secondary);
    --bs-btn-hover-bg: var(--brand-color-primary);
    --bs-btn-hover-border-color: var(--brand-color-primary);
    --bs-btn-active-color: var(--brand-color-secondary);
    --bs-btn-active-bg: var(--brand-color-primary);
    --bs-btn-active-border-color: var(--brand-color-primary);
    --bs-btn-disabled-color: var(--brand-color-secondary);
    --bs-btn-disabled-bg: darkgrey;
    --bs-btn-disabled-border-color: darkgrey;
}

.btn-xs {
    --bs-btn-padding-y: 0.2rem;
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-font-size: 0.75rem;
    --bs-btn-border-radius: 0.25rem;
}

.btn.disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: var(--bs-btn-disabled-opacity) !important;
}

.square-btn {
    height: 2.5rem;
    min-width: 2.5rem;
    width: 2.5rem;
}

button.btn-icon,
a.btn-icon,
span.btn-icon {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    height: 40px !important;
    justify-content: center;
    min-height: 40px !important;
    min-width: 40px !important;
    padding: 0;
    width: 40px !important;
}

button.btn-icon-overlay {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    height: 30px !important;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 5px;
    top: 5px;
    width: 30px !important;
}

.collection-item-actions {
    align-items: center;
    display: grid;
    gap: 0.25rem;
    grid-template-columns: repeat(3, 40px);
    justify-content: start;
    width: max-content;
}

a.back-to-top {
    align-items: center;
    background: var(--brand-color-primary) !important;
    border-radius: 50%;
    bottom: 1.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: flex;
    height: 50px;
    justify-content: center;
    padding: 0;
    position: fixed;
    right: 1.5rem;
    text-decoration: none;
    width: 50px;
    z-index: 1030;
}

/* --- Forms --- */
.form-control,
.form-select,
.input-group-text {
    background-color: var(--brand-surface);
    border: 1px solid var(--bs-border-color);
    color: var(--brand-ink);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--brand-color-primary) 18%, transparent);
}

input[type=date],
input[type=datetime-local],
input[type=email],
input[type=number],
input[type=password],
input[type=search],
input[type=tel],
input[type=text],
input[type=time],
input[type=url],
textarea {
    padding-left: .875rem;
    padding-right: .875rem;
}

.form-check-input:checked {
    background-color: var(--brand-color-primary);
    border-color: var(--brand-color-primary);
}

.form-check-input:focus {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--brand-color-primary) 25%, transparent);
}

.form-check-input:disabled,
.form-check-input:disabled ~ .form-check-label {
    cursor: not-allowed;
}

.form-switch .form-check-input {
    cursor: pointer;
}

.form-switch .form-check-input:disabled {
    cursor: not-allowed;
}

/* --- Accordion --- */
.accordion {
    border-bottom: 0 !important;
}

.accordion-header .accordion-button {
    --bs-accordion-btn-active-icon: var(--bs-accordion-btn-icon);
    --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23d32f2f'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    border: 0 !important;
    color: var(--brand-color-primary);
}

.accordion-button::after {
    flex-shrink: 0;
    margin-left: auto !important;
}

.accordion-body {
    line-height: 1.5rem !important;
}

.accordion-collapse {
    background-color: #e2e2e2;
}

/* --- Feedback / Toasts --- */
.alert-htmx {
    bottom: 40px;
    z-index: 1055;
}

.toast {
    --bs-toast-bg: #fff !important;
}

.notification-toast {
    z-index: 1080;
    margin-top: 50px;
    margin-bottom: 10px;
}

/* --- Cards / Lists --- */
.card.border-owned,
.border-owned {
    border: 3px solid #198754 !important;
}

.card.border-wanted,
.border-wanted {
    border: 3px solid #ffcc00 !important;
}

.card-link-wrapper {
    min-height: 100%;
}

article.card-extra {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

article.card-extra:hover {
    box-shadow: 0 8px 32px 0 rgba(60, 60, 120, 0.15);
    transform: translateY(-2px) scale(1.01);
}

p.card-extra {
    color: grey !important;
    line-height: 1.4rem;
}

.list-group {
    max-height: 70vh;
    overflow-y: auto;
}

.list-group-item.active {
    z-index: 2;
    color: var(--brand-color-secondary) !important;
    background-color: var(--brand-color-primary) !important;
    border-color: var(--brand-color-primary) !important;
}

/* --- Tabs --- */
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    border-bottom-color: var(--brand-color-primary) !important;
    background-color: var(--brand-color-primary) !important;
    color: var(--brand-color-secondary) !important;
}

/* --- Media / Uploads --- */
img.thumbnail-sm,
div.thumbnail-sm {
    height: 45px !important;
    width: 45px !important;
    object-fit: scale-down;
}

img.thumbnail-md,
div.thumbnail-md {
    height: 70px !important;
    width: 70px !important;
    min-height: 45px !important;
    min-width: 45px !important;
    object-fit: scale-down;
}

img.thumbnail-md-responsive,
div.thumbnail-md-responsive {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    width: 100%;
}

.image-upload {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: center;
    margin: 1px;
    position: relative;
    width: 110px;
    height: 110px;
}

/* --- Visual Markers --- */
.icon-circle {
    margin: 0 auto;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s, opacity 0.2s;
    padding: 0;
}

.icon-circle.filter-on {
    background: #ccc !important;
}

span.color-circle {
    width: 16px;
    height: 16px;
    display: inline-block;
}

div.color-square-md,
div.color-square-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    text-transform: uppercase;
    text-align: center;
    border-radius: 4px;
    border: 1px solid black;
    line-height: normal !important;
    background-color: var(--swatch);
}

div.color-square-sm {
    height: 45px;
    width: 45px;
    font-size: 7px;
}

div.color-square-md {
    height: 70px;
    width: 70px;
    font-size: 12px;
}

div.progress-bar {
    height: 20px;
    border-radius: 4px;
}

label.privee {
    background: var(--brand-color-primary) !important;
    border-color: var(--brand-color-primary) !important;
}

/* --- Icons --- */
i.icon-md { font-size: 24px; }
i.icon-lg { font-size: 30px; }
i.icon-xl { font-size: 32px; }
i.icon-xxl { font-size: 35px; }

/* --- Cursor Utilities --- */
.pointer { cursor: pointer; }

/* --- Typography Utilities --- */
.text-xxs { font-size: 8px; }
.text-xs { font-size: 12px; }
.text-xs-sm { font-size: clamp(12px, 2vw, 14px); }
.text-sm { font-size: 14px; }
.text-sm-md { font-size: clamp(14px, 2vw, 16px); }
.text-md { font-size: 16px; }
.text-md-lg { font-size: clamp(16px, 2vw, 18px); }
.text-lg { font-size: 18px; }
.text-lg-md { font-size: clamp(18px, 2vw, 20px); }
.text-xl { font-size: 20px; }
.text-xxl { font-size: 35px; }

/* --- Collection Stands --- */
.stands-layout {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-areas: "bench boards";
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.stands-board-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    grid-area: boards;
    min-width: 0;
}

.stand-panel-header,
.stand-bench-header {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stand-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.stand-panel-actions {
    align-items: center;
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.stand-title {
    font-size: 1.1rem;
    line-height: 1.2;
    margin: 0;
}

.stand-meta {
    color: var(--bs-secondary-color);
    display: block;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.stand-name-form {
    max-width: 100%;
    width: min(100%, 360px);
}

.stand-scroll {
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.stand-board-inner {
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fb 100%);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    min-width: 640px;
    padding: 0.75rem;
}

.stand-rows {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stand-row {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.stand-row-grid {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: repeat(var(--stand-slots), minmax(0, 1fr));
    margin-left: auto;
    margin-right: auto;
    width: var(--stand-width);
}

.stand-custom-grid {
    aspect-ratio: var(--stand-columns) / var(--stand-rows);
    display: grid;
    gap: 0.35rem;
    grid-template-columns: repeat(var(--stand-columns), minmax(0, 1fr));
    grid-template-rows: repeat(var(--stand-rows), minmax(96px, 1fr));
    min-height: 220px;
}

.stand-custom-cell {
    min-height: 0;
}

.stand-zone {
    border: 1px dashed rgba(23, 50, 77, 0.22);
    border-radius: 6px;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.stand-zone.sortable-ghost,
.stand-zone:focus-within {
    border-color: var(--brand-color-primary);
}

.stand-slot {
    align-items: center;
    aspect-ratio: 1 / 1;
    background: #eef4f0;
    display: grid;
    gap: var(--stand-slot-gap, 0.2rem);
    grid-auto-rows: minmax(0, 1fr);
    grid-template-columns: repeat(var(--stand-slot-columns, 1), minmax(0, 1fr));
    justify-items: stretch;
    min-height: 70px;
    padding: 0.22rem;
    place-items: stretch;
    position: relative;
}

.stand-slot.stand-custom-cell {
    aspect-ratio: auto;
    height: 100%;
    min-height: 0;
}

.stand-slot-label {
    color: rgba(23, 50, 77, 0.42);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    position: absolute;
}

.stand-slot.is-filled .stand-slot-label,
.stand-slot:has(.stand-figure) .stand-slot-label {
    font-size: 0.7rem;
    left: 0.25rem;
    top: 0.25rem;
}

.stand-drawers {
    border-top: 1px solid var(--bs-border-color);
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(var(--stand-drawers), minmax(0, 1fr));
    margin-top: 0.8rem;
    padding-top: 0.8rem;
}

.stand-drawer-label {
    align-items: center;
    color: var(--bs-secondary-color);
    display: flex;
    font-size: 0.85rem;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.stand-drawer-zone,
.stand-bench-zone {
    align-content: flex-start;
    background: #fffaf1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 96px;
    padding: 0.45rem;
}

.stand-bench {
    grid-area: bench;
    position: sticky;
    top: 5rem;
}

.stand-bench-zone {
    background: #ffffff;
    max-height: 68vh;
    overflow-y: auto;
}

.stand-figure {
    align-items: center;
    background: var(--brand-surface);
    border: 1px solid rgba(23, 50, 77, 0.12);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(23, 50, 77, 0.07);
    cursor: grab;
    display: grid;
    gap: 0.45rem;
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 54px;
    padding: 0.35rem;
    width: 100%;
}

.stand-figure:active {
    cursor: grabbing;
}

.stand-figure.is-external {
    background: #eef3f6;
    border-style: dashed;
    cursor: default;
    opacity: 0.82;
}

.stand-figure.is-external:active {
    cursor: default;
}

.stand-figure-img {
    aspect-ratio: 1 / 1;
    height: 42px;
    object-fit: scale-down;
    width: 42px;
}

.stand-figure-text {
    min-width: 0;
}

.stand-figure-code,
.stand-figure-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stand-figure-code {
    color: var(--brand-ink);
    font-size: 0.8rem;
    font-weight: 700;
}

.stand-figure-name {
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
}

.stand-slot .stand-figure {
    gap: 0.2rem;
    grid-template-columns: 1fr;
    height: 100%;
    justify-items: center;
    min-height: 0;
    overflow: hidden;
    padding: 0.2rem;
    width: 100%;
}

.stand-slot .stand-figure-img {
    height: var(--stand-slot-image-size, 44px);
    max-height: 100%;
    max-width: 100%;
    width: var(--stand-slot-image-size, 44px);
}

.stand-slot .stand-figure-name {
    display: none;
}

.stand-slot .stand-figure-code {
    font-size: var(--stand-slot-code-size, 0.68rem);
    max-width: 100%;
    text-align: center;
}

.stand-slot:has(.stand-figure + .stand-figure) {
    align-items: stretch;
}

.stand-slot:has(.stand-figure + .stand-figure) .stand-slot-label {
    display: none;
}

.stand-drawer-zone .stand-figure {
    width: min(100%, 190px);
}

.stand-bench-zone .stand-figure {
    width: 100%;
}

.stand-save-status {
    min-width: 92px;
}

.stand-empty-state {
    align-items: center;
    display: flex;
    min-height: 180px;
}

.stand-layout-option {
    align-items: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    cursor: pointer;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0.75rem;
}

.stand-layout-options {
    border: 0;
    margin: 0;
    padding: 0;
}

.stand-layout-options.is-disabled {
    opacity: 0.55;
}

.stand-layout-option:hover,
.stand-layout-option:focus-within {
    border-color: var(--brand-color-primary);
}

@media (max-width: 991.98px) {
    .stands-layout {
        grid-template-areas:
            "bench"
            "boards";
        grid-template-columns: 1fr;
    }

    .stand-bench {
        position: static;
    }

    .stand-bench-zone {
        max-height: none;
    }
}

@media (max-width: 575.98px) {
    .stand-panel-header,
    .stand-bench-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .stand-panel-header {
        grid-template-columns: 1fr;
    }

    .stand-panel-actions {
        width: 100%;
    }

    .stand-drawers {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- Responsive --- */
@media (max-width: 576px) {
    .notification-toast {
        top: auto !important;
        bottom: 0 !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
        width: 100vw !important;
        display: flex !important;
        flex-direction: column-reverse !important;
        justify-content: flex-end !important;
        align-items: center !important;
        padding-bottom: 1rem !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        z-index: 1080 !important;
    }

    .notification-toast .toast {
        margin-top: 0 !important;
        margin-bottom: 0.5rem !important;
        width: 95vw !important;
        max-width: 95vw !important;
    }
}

@media (max-width: 767.98px) {
    .app-main {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .surface-panel {
        padding: 1rem;
    }

    .app-navbar-brand {
        gap: 0.55rem;
    }

    .app-navbar-logo {
        height: 36px;
        width: 36px;
    }
}
