/* ============================================================
   Ink Manager - Stylesheet
   ink.printberry.no
   ============================================================ */

:root {
    --brand-primary: #1a73e8;
    --brand-dark: #1a1d23;
    --brand-darker: #13161b;
    --brand-light: #f8f9fa;
    --brand-accent: #00c853;
    --text-primary: #e1e3e6;
    --text-secondary: #d3d9e2;
    --surface: #1e2128;
    --surface-hover: #262a33;
    --surface-border: #2d3139;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

/* ============================================================
   BASE
   ============================================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--brand-darker);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-darker) 0%, #0d1117 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 40px 30px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--brand-primary), #42a5f5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.login-header .text-muted {
    color: var(--text-secondary) !important;
    font-size: 14px;
}

/* Bootstrap .text-muted override for dark theme */
.text-muted {
    color: #9ca3af !important;
}

/* PIN Input */
.pin-input-group {
    text-align: center;
    margin-bottom: 24px;
}

.pin-input-group .form-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--surface-border);
    background: transparent;
    transition: var(--transition);
}

.pin-dot.filled {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.pin-hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Numpad */
.numpad {
    max-width: 280px;
    margin: 0 auto 24px;
}

.numpad-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.numpad-btn {
    width: 72px;
    height: 56px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad-btn:hover,
.numpad-btn:active {
    background: var(--surface-hover);
    border-color: var(--brand-primary);
}

.numpad-clear,
.numpad-delete {
    font-size: 18px;
    color: var(--text-secondary);
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: var(--brand-primary);
    border: none;
    color: white;
    font-size: 16px;
}

.btn-login:disabled {
    opacity: 0.4;
    background: var(--brand-primary);
}

/* ============================================================
   LANGUAGE TOGGLE
   ============================================================ */
.lang-btn {
    font-size: 24px;
    line-height: 1;
    margin-right: 15px;
    opacity: 0.85;
    transition: var(--transition);
    text-decoration: none !important;
}

.lang-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar-top {
    background: var(--brand-dark) !important;
    border-bottom: 1px solid var(--surface-border);
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    font-size: 18px;
    color: white !important;
}

.navbar-brand i {
    color: var(--brand-primary);
}

/* ============================================================
   TABS
   ============================================================ */
.app-tabs {
    background: var(--brand-dark);
    border-bottom: 1px solid var(--surface-border);
    padding: 0 12px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.app-tabs::-webkit-scrollbar {
    display: none;
}

.app-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    border-radius: 0;
}

.app-tabs .nav-link.active {
    color: var(--brand-primary);
    background: transparent;
    border-bottom-color: var(--brand-primary);
}

.app-tabs .nav-link:hover {
    color: var(--text-primary);
}

/* ============================================================
   APP CONTENT
   ============================================================ */
.app-content {
    min-height: calc(100vh - 56px);
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--brand-primary);
}

.stat-card-warning:hover {
    border-color: #ff9800;
}

.stat-icon {
    font-size: 24px;
    color: var(--brand-primary);
    margin-bottom: 8px;
}

.stat-card-warning .stat-icon {
    color: #ff9800;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   ACTION BUTTONS
   ============================================================ */
.btn-action {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 20px 16px;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.btn-action i {
    font-size: 28px;
    color: var(--brand-primary);
}

.btn-action span {
    font-size: 13px;
    font-weight: 500;
}

.btn-action:hover {
    background: var(--surface-hover);
    border-color: var(--brand-primary);
    color: var(--text-primary);
}

/* ============================================================
   CONTAINER CARDS
   ============================================================ */
.container-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.container-card {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    gap: 12px;
}

.container-card:hover {
    background: var(--surface-hover);
    border-color: var(--brand-primary);
}

.container-card-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.1);
}

.container-card-body {
    flex: 1;
    min-width: 0;
}

.container-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.container-card-header strong {
    font-size: 14px;
}

.container-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.container-card-notes {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    opacity: 0.75;
}

.container-card-arrow {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
    position: relative;
}

.search-bar .input-group {
    background: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.search-bar .input-group-text {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
}

.search-bar .form-control,
.search-bar .form-select {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
}

.search-bar .form-control:focus,
.search-bar .form-select:focus {
    background: var(--surface-hover);
    border-color: var(--brand-primary);
    color: var(--text-primary);
    box-shadow: none;
}

/* ============================================================
   SHELF GRID TABLE
   ============================================================ */
.shelf-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.shelf-table {
    border-collapse: separate;
    border-spacing: 3px;
    width: max-content;
    min-width: 100%;
}

.shelf-table thead th {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 4px 2px 8px;
    position: sticky;
    top: 0;
    background: var(--brand-darker);
    z-index: 2;
    min-width: 44px;
}

.shelf-row-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 6px !important;
    vertical-align: middle;
    position: sticky;
    left: 0;
    background: var(--brand-darker);
    z-index: 1;
    min-width: 28px;
}

.shelf-cell {
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 44px;
    vertical-align: middle;
}

.shelf-cell-empty {
    background: var(--surface);
    border: 1px solid var(--surface-border);
}

.shelf-cell-active {
    background: rgba(0, 200, 83, 0.12);
    border: 1px solid rgba(0, 200, 83, 0.35);
}

.shelf-cell-over {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.45);
}

.shelf-cell-missing {
    background: var(--brand-darker);
    border: 1px dashed var(--surface-border);
    opacity: 0.4;
    cursor: default;
}

.shelf-cell:not(.shelf-cell-missing):hover {
    border-color: var(--brand-primary);
    transform: scale(1.08);
    z-index: 3;
    position: relative;
}

.shelf-cell-code {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.shelf-cell-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.shelf-cell-empty .shelf-cell-count {
    color: var(--text-secondary);
    opacity: 0.4;
}

.shelf-cell-over .shelf-cell-count {
    color: #ff9800;
}

/* Keep old shelf card styles for shelf detail/other uses */
.shelf-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    height: 100%;
}

.shelf-card:hover {
    border-color: var(--brand-primary);
    background: var(--surface-hover);
}

.shelf-card-active {
    border-left: 3px solid var(--brand-accent);
}

.shelf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.shelf-code {
    font-size: 20px;
    font-weight: 700;
}

.shelf-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--brand-darker);
    padding: 2px 8px;
    border-radius: 12px;
}

.shelf-colors {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

/* ============================================================
   PMS COLOR DROPDOWN
   ============================================================ */
.pms-search-wrapper {
    position: relative;
}

.pms-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.pms-dropdown.show {
    display: block;
}

.pms-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
}

.pms-dropdown-item:hover {
    background: var(--surface-hover);
}

.pms-dropdown-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}

.pms-dropdown-code {
    font-weight: 600;
    font-size: 13px;
}

.pms-dropdown-name {
    font-size: 11px;
    color: var(--text-secondary);
}

.pms-dropdown-hex {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
}

/* ============================================================
   COLOR CARDS (Color Tab)
   ============================================================ */
.color-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.color-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
}

.color-card-swatch {
    height: 80px;
    width: 100%;
}

.color-card-info {
    padding: 10px 12px;
}

.color-card-code {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.color-card-hex {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: monospace;
}

.color-card-category {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.color-edit-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.color-card:hover .color-edit-btn {
    opacity: 1;
}

.color-edit-btn:hover {
    background: rgba(0,0,0,0.8);
    color: var(--brand-primary);
}

/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-color-swatch {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.1);
}

.detail-info h4 {
    margin: 0 0 4px;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-item {
    background: var(--brand-darker);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.detail-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
}

.grams-display {
    background: var(--brand-darker);
    border-radius: var(--radius-sm);
    padding: 14px;
}

/* ============================================================
   DETAIL MODAL FOOTER (sticky)
   ============================================================ */
.detail-modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--surface);
    border-top: 1px solid var(--surface-border);
    padding: 10px 16px;
    gap: 8px;
}

/* ============================================================
   HISTORY
   ============================================================ */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--surface-border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: var(--brand-primary);
}

.history-content {
    flex: 1;
}

.history-action {
    font-weight: 600;
    font-size: 13px;
}

.history-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================================
   SCANNER
   ============================================================ */
.scanner-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}

.scanner-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 200px;
    height: 200px;
    border: 2px solid var(--brand-primary);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
}

/* html5-qrcode overrides */
#scannerPreview {
    border-radius: var(--radius);
    overflow: hidden;
}
#scannerPreview video {
    border-radius: var(--radius);
}
#scannerPreview img[alt="Info icon"] {
    display: none;
}
#qr-shaded-region {
    border-color: var(--brand-primary) !important;
}

/* ============================================================
   SCAN RESULT POPUP
   ============================================================ */
.scan-result-found {
    padding: 0.5rem 0;
}

.scan-color-swatch {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    border: 2px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.scan-info-item {
    background: var(--brand-darker);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.scan-info-item i {
    color: var(--brand-primary);
}

/* Scan flash overlay (visual feedback when barcode scanned) */
.scan-flash {
    position: fixed;
    inset: 0;
    background: rgba(26, 115, 232, 0.15);
    z-index: 99999;
    pointer-events: none;
    animation: scanFlash 0.4s ease-out forwards;
}

@keyframes scanFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================================
   COLOR PREVIEW BOX
   ============================================================ */
.color-preview-box {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
    border: 1px solid var(--surface-border) !important;
}

.color-swatch-large {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    margin: 0 auto;
    border: 2px solid rgba(255,255,255,0.1);
}

/* ============================================================
   SIZE SELECTOR
   ============================================================ */
.size-selector {
    display: flex;
    gap: 12px;
}

.size-option {
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.size-option input[type="radio"] {
    display: none;
}

.size-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.size-visual {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-darker);
    border: 2px solid var(--surface-border);
    border-radius: var(--radius);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.size-visual i {
    color: var(--text-secondary);
    opacity: 0.6;
    transition: var(--transition);
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.size-visual i.size-sm {
    font-size: 28px;
}

.size-visual i.size-md {
    font-size: 40px;
}

.size-visual i.size-lg {
    font-size: 54px;
}

.size-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition);
    letter-spacing: 0.3px;
}

/* Hover */
.size-option:hover .size-visual {
    border-color: rgba(26, 115, 232, 0.4);
    background: var(--surface);
}

.size-option:hover .size-visual i {
    opacity: 0.8;
    color: var(--brand-primary);
}

/* Selected / Checked */
.size-option input[type="radio"]:checked + .size-card .size-visual {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary);
    background: rgba(26, 115, 232, 0.06);
}

.size-option input[type="radio"]:checked + .size-card .size-visual i {
    color: var(--brand-primary);
    opacity: 1;
}

.size-option input[type="radio"]:checked + .size-card .size-label {
    color: var(--text-primary);
}

/* ============================================================
   PROJECT TAGS
   ============================================================ */
.project-tags-wrapper {
    background: var(--brand-darker);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 6px;
}

.project-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.project-tags-container:empty {
    margin-bottom: 0;
}

.project-tag {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    gap: 4px;
}

.project-tag i {
    color: var(--brand-primary);
    font-size: 10px;
}

.project-tag-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    margin-left: 2px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.project-tag-remove:hover {
    color: #ff4444;
    opacity: 1;
    background: rgba(255, 68, 68, 0.15);
}

.project-tag-remove:focus {
    outline: none;
    box-shadow: none;
}

.project-tags-input-wrap {
    position: relative;
}

.project-tags-input-wrap .form-control {
    border: none;
    padding: 4px 8px;
    font-size: 13px;
    background: transparent;
}

.project-tags-input-wrap .form-control:focus {
    box-shadow: none;
    border: none;
}

.project-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 180px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.project-suggestions.show {
    display: block;
}

.project-suggestion-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.project-suggestion-item:hover {
    background: var(--surface-hover);
}

/* ============================================================
   FORMS (Dark theme overrides)
   ============================================================ */
.form-control,
.form-select {
    background-color: var(--brand-darker);
    border-color: var(--surface-border);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--brand-darker);
    border-color: var(--brand-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-text {
    color: var(--brand-primary);
    font-size: 12px;
}

.input-group-text {
    background-color: var(--surface);
    border-color: var(--surface-border);
    color: var(--text-secondary);
}

.form-range::-webkit-slider-thumb {
    background: var(--brand-primary);
}

.form-range::-webkit-slider-runnable-track {
    background: var(--surface-border);
}

/* ============================================================
   MODALS (Dark theme)
   ============================================================ */
.modal-content {
    background-color: var(--brand-dark);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
}

.modal-header {
    border-bottom-color: var(--surface-border);
}

.modal-footer {
    border-top-color: var(--surface-border);
    flex-wrap: wrap;
    gap: 6px;
}

.modal-title {
    font-weight: 700;
}

.btn-close {
    filter: invert(1);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
    background-color: var(--surface-border);
    border-radius: 4px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    border: none;
    border-radius: var(--radius-sm);
}

.toast-header {
    background: transparent;
    color: inherit;
    border-bottom-color: rgba(255,255,255,0.1);
}

.toast a {
    text-decoration: underline;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .tab-text {
        display: none;
    }

    .app-tabs .nav-link {
        padding: 12px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 22px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .numpad-btn {
        width: 64px;
        height: 50px;
        font-size: 20px;
    }

    .modal-dialog {
        margin: 8px;
    }

    .btn-action {
        padding: 16px 12px;
    }

    .btn-action i {
        font-size: 24px;
    }
}

/* iPad optimization */
@media (min-width: 768px) and (max-width: 1024px) {
    .container-fluid {
        max-width: 960px;
        margin: 0 auto;
    }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--brand-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    body {
        background: white;
        color: black;
    }
    .navbar-top,
    .app-tabs,
    .modal-footer,
    .btn-action {
        display: none !important;
    }
}

/* ============================================================
   SIZE BADGES (Container list)
   ============================================================ */
.size-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.size-badge-1kg {
    background: rgba(96, 125, 160, 0.18);
    color: #8ba7c8;
}

.size-badge-2kg {
    background: rgba(200, 170, 50, 0.15);
    color: #c8aa50;
}

.size-badge-4kg {
    background: rgba(56, 199, 120, 0.22);
    color: #38c778;
}

.size-badge-5kg {
    background: rgba(200, 80, 70, 0.2);
    color: #e06050;
}

.size-badge-6kg {
    background: rgba(180, 90, 230, 0.22);
    color: #c06af0;
}

/* ============================================================
   SHELF BOXES (Card-style column layout)
   ============================================================ */
.shelf-columns-wrapper {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
}

.shelf-row-labels {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--brand-darker);
}

.shelf-row-label-box {
    width: 28px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.shelf-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.shelf-col-header {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 4px 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    background: var(--brand-darker);
    z-index: 1;
}

.shelf-box {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    gap: 2px;
}

.shelf-box-empty {
    background: var(--surface);
    border: 1px solid var(--surface-border);
}

.shelf-box-active {
    background: rgba(0, 200, 83, 0.12);
    border: 1px solid rgba(0, 200, 83, 0.35);
}

.shelf-box-over {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.45);
}

.shelf-box-missing {
    background: var(--brand-darker);
    border: 1px dashed var(--surface-border);
    opacity: 0.35;
    cursor: default;
}

.shelf-box:not(.shelf-box-missing):hover {
    border-color: var(--brand-primary);
    transform: scale(1.1);
    z-index: 3;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.shelf-box-code {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.shelf-box-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.shelf-box-empty .shelf-box-count {
    color: var(--text-secondary);
    opacity: 0.4;
}

.shelf-box-over .shelf-box-count {
    color: #ff9800;
}

.shelf-box-light-text .shelf-box-code,
.shelf-box-light-text .shelf-box-count {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.shelf-box-dark-text .shelf-box-code,
.shelf-box-dark-text .shelf-box-count {
    color: #1a1a1a;
    text-shadow: 0 1px 2px rgba(255,255,255,0.4);
}

/* ============================================================
   DETAIL INLINE TAGS
   ============================================================ */
.detail-inline-tags {
    background: var(--brand-darker);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.detail-inline-tags .form-control {
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--surface);
}

.detail-inline-tags .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: none;
}

/* ============================================================
   SHELF BADGE (Container cards)
   ============================================================ */
.shelf-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(26, 115, 232, 0.15);
    color: var(--brand-primary);
    border: 1px solid rgba(26, 115, 232, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.shelf-badge i {
    font-size: 10px;
}

/* ============================================================
   SEARCH MODAL ENHANCEMENTS
   ============================================================ */
.search-input-wrapper {
    position: relative;
}

.search-project-suggestions {
    display: none;
    margin-top: 8px;
}

.search-project-suggestions.show {
    display: block;
}

.search-project-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.search-project-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.search-project-chip:hover {
    background: var(--surface-hover);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.search-project-chip i {
    color: var(--brand-primary);
}

.search-chip-count {
    background: var(--brand-darker);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.search-results-list {
    max-height: 50vh;
    overflow-y: auto;
}

/* Container tab project suggestions dropdown */
.container-project-suggestions {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1050;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: 220px;
    overflow-y: auto;
}
.container-project-suggestions.show {
    display: block;
}
.container-project-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
    border-bottom: 1px solid var(--surface-border);
}
.container-project-suggestion-item:last-child {
    border-bottom: none;
}
.container-project-suggestion-item:hover {
    background: var(--surface-hover);
    color: var(--brand-primary);
}
.container-project-suggestion-item i {
    color: var(--brand-primary);
    margin-right: 8px;
}
.container-project-suggestion-item .project-count {
    background: var(--brand-darker);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
}

/* ============================================================
   SHELF PICKER
   ============================================================ */
.shelf-picker {
    position: relative;
}

.shelf-selected-badge {
    display: inline-flex;
    align-items: center;
    background: var(--brand-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 8px;
}

.shelf-results {
    max-height: 180px;
    overflow-y: auto;
    margin-top: 4px;
    border-radius: var(--radius-sm);
}

.shelf-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    cursor: pointer;
    transition: var(--transition);
}

.shelf-result-item:hover,
.shelf-result-item.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.shelf-result-item.first {
    background: rgba(26, 115, 232, 0.15);
    border-color: var(--brand-primary);
}

.shelf-result-code {
    font-weight: 700;
    font-size: 15px;
}

.shelf-result-count {
    font-size: 12px;
    opacity: 0.8;
}

.shelf-result-empty {
    padding: 10px 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================================
   PMS DUPLICATE WARNING
   ============================================================ */
.pms-duplicate-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

.pms-dup-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 13px;
}

.pms-dup-item + .pms-dup-item {
    border-top: 1px solid rgba(255, 193, 7, 0.15);
    padding-top: 8px;
    margin-top: 4px;
}

/* ============================================================
   SHELF SELECT WRAPPER (legacy - kept for compat)
   ============================================================ */
.shelf-select-wrapper .form-select {
    scrollbar-width: thin;
}

.shelf-select-wrapper .form-select option {
    padding: 6px 8px;
}
