:root {
    --primary-color: #0078d4;
    --secondary-color: #555;
    --danger-color: #dc3545;
}
body {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f8fa;
    color: #333;
}

/* Style header title link like plain text */
.header-title a {
    color: inherit;
    text-decoration: none;
}
.header-title a:visited,
.header-title a:hover,
.header-title a:focus {
    color: inherit;
    text-decoration: none;
}
footer {
    text-align: center;
    font-size: 0.9rem;
    color: #888;
    padding: 2rem 0;
    margin-top: 4rem;
}
/* Forms */
.action-link {
    color: #0e74c9;
    text-decoration: none;
    font-weight: bold;
}
.action-link:hover {
    text-decoration: underline;
}
.order-search-group {
    width: min(380px, 100%);
}

@media (max-width: 576px) {
    .order-search-group {
        width: 100%;
    }
}
.warning-row,
.warning-row > td {
    background-color: #fff8dc !important;
}

.table-striped tbody tr:nth-of-type(odd) > td,
.table-striped tbody tr:nth-of-type(odd) > th {
    background-color: #f9f9f9;
}

.table-hover tbody tr:hover > td,
.table-hover tbody tr:hover > th {
    background-color: #eef;
}
.clickable-row {
    cursor: pointer;
}
.diff-plus {
    background-color: #d2f5d2;
    color: #2a7a2a;
}
.diff-minus {
    background-color: #fce4e4;
    color: #8b1f1f;
}
.diff-zero {
    background-color: #f0f0f0;
    color: #666;
}
.serial-box {
    margin-top: 0.5rem;
}
.queue-info {
    margin-top: 0.25rem;
    font-size: 0.9rem;
}
.serial-count {
    margin-top: 0.25rem;
    font-size: 0.9rem;
}
.serial-list {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 6px;
    /* allow about 20 entries before scrolling */
    max-height: 300px;
    overflow-y: auto;
}
.serial-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.3rem 0;
    font-family: monospace;
    border-bottom: 1px solid #ddd;
}
.serial-list li:hover {
    background-color: #eef;
}
.serial-list button {
    background: transparent;
    border: none;
    color: #c00;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
}
.serial-list button:hover {
    color: #f00;
}
@media print {
    body * {
        visibility: hidden;
    }
    .print-area, .print-area * {
        visibility: visible;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}
.log-dashboard {
    font-family: sans-serif;
    padding: 20px;
    background: #f5f5f5;
}
.log-dashboard table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-top: 20px;
}
.log-dashboard th,
.log-dashboard td {
    padding: 10px;
    border: 1px solid #ccc;
    vertical-align: top;
}
.log-dashboard tr:nth-child(even) {
    background: #f0f0f0;
}
.log-dashboard .timestamp {
    color: #666;
    white-space: nowrap;
    font-size: 13px;
}
.log-dashboard .context {
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
}
.log-dashboard .level-ERROR {
    color: red;
    font-weight: bold;
}
.log-dashboard .level-WARNING {
    color: orange;
    font-weight: bold;
}
.log-dashboard .level-INFO {
    color: green;
    font-weight: bold;
}
.log-dashboard form.inline-form {
    display: inline;
    margin-left: 20px;
}
input[readonly] {
    background-color: #f0f0f0;
    color: #666;
    cursor: not-allowed;
}

/* Preserve line breaks in modal messages */
#messageModalBody {
    white-space: pre-line;
}
/* Login page */
.login-page {
    background: #f5f7fa;
    font-family: sans-serif;
}
.login-wrapper {
    max-width: 400px;
    margin: 10vh auto;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.login-wrapper h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.test-label-page {
    font-family: sans-serif;
    padding: 2em;
}
#labelFrame {
    margin-top: 1em;
    width: 400px;
    height: 600px;
    border: 1px solid #ccc;
}
.label-list {
    margin-top: 2em;
}
.center-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
}
#serialInput {
    padding: 15px;
    font-size: 18px;
    width: 400px;
    border: 2px solid #ccc;
    border-radius: 8px;
    text-align: center;
}
#feedback {
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
}
#orderDetails {
    margin-bottom: 30px;
    display: none;
    transition: opacity 0.3s;
}
.item-status {
    margin: 5px 0;
}
.item-list {
    list-style: none;
    padding: 0;
    display: inline-block;
    text-align: left;
}
.active-order {
    background-color: #fffae6;
}
.active-order > td {
    background-color: #fffae6 !important;
}
.status-label.pending {
    color: #6c757d;
}
.status-label.processing {
    color: #0d6efd;
}
.status-label.success {
    color: #198754;
}
.status-label.error {
    color: #dc3545;
}
.done {
    background-color: #f0f0f0;
    opacity: 0.5;
}
.done > td {
    background-color: #f0f0f0 !important;
}
.fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}
.fireworks-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 9998;
}

/* Ensure visibility for progress text */
.progress-cell {
    min-width: 120px;
    white-space: nowrap;
}

/* Date input styling */
input[type="date"].date-input {
    min-width: 130px;
    width: auto;
}

select.form-select.filter-select {
    min-width: 130px;
    width: auto;
}

input[type="text"].serial-input {
    width: clamp(150px, 20vw, 220px);
}

/* Subtle buttons for order actions */
.btn-order-status {
    background-color: #fff3cd;
    border-color: #fff3cd;
    color: #664d03;
}
.btn-order-status:hover {
    background-color: #ffe8a1;
    border-color: #ffe8a1;
    color: #664d03;
}

.btn-order-delete {
    background-color: #f8d7da;
    border-color: #f8d7da;
    color: #842029;
}
.btn-order-delete:hover {
    background-color: #f1b0b7;
    border-color: #f1b0b7;
    color: #842029;
}

/* Mobile scroll helpers for long pages */
.mobile-scroll-shortcuts {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1050;
}

.mobile-scroll-shortcuts .btn {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}
