/* Bylands Field Job Board - Mobile-first styles (DCI base theme + board additions) */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Board palette (distinct from DCI's dark-green checkin theme):
   page #68c468 field green, login/popup cards black-grey, accent = the page green. */
body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #68c468;
    color: #333;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Short views (login/message/loading) sit vertically centered like the DCI
   check-in page; App.showView toggles the class. Scrolling views stay top-anchored. */
body.v-centered {
    align-items: center;
}

.container {
    width: 100%;
    max-width: 480px;
    padding: 20px 20px 48px;
}

/* Language Selector */
.lang-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.lang-btn {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 28px;
    padding: 6px 10px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s, transform 0.1s;
    line-height: 1;
}

.lang-btn:hover {
    opacity: 0.8;
}

.lang-btn.active {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.6);
}

.lang-btn:active {
    transform: scale(0.92);
}

.flag-img {
    width: 32px;
    height: 32px;
    display: block;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 24px;
    color: #142914;
}

.header-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.subtitle {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 1px;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Initial hidden state lives in the stylesheet: the CSP (style-src 'self',
   no 'unsafe-inline') can block inline style="" attributes, and JS toggles
   element.style via CSSOM, which CSP never blocks and always wins over these. */
#login-error,
#board-error,
#completed-list,
#app-details-block,
#finish-error,
#connection-lost {
    display: none;
}

/* Card - the login / finish / message "windows" are black-grey */
.card {
    background: #242824;
    color: #e8ece8;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* Login form */
.input-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #a8b0a8;
    margin-bottom: 8px;
}

.login-input {
    display: block;
    width: 100%;
    padding: 14px 16px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 3px;
    background: #1a1d1a;
    color: #f2f2f2;
    border: 3px solid #3d423d;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

#worker-code-input {
    text-transform: uppercase;
}

.login-input:focus {
    border-color: #68c468;
}

/* Browser autofill paints remembered values on a light background. Clipping the
   autofill background to the text (instead of the 1000px inset-shadow trick) leaves
   the input's own dark background visible everywhere - the shadow version let light
   pixels peek through at the 12px rounded corners. */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f2f2f2;
    -webkit-background-clip: text;
    background-clip: text;
    caret-color: #f2f2f2;
}

.login-hint {
    margin-top: 14px;
    text-align: center;
    font-size: 13px;
    color: #a8b0a8;
}

.form-error {
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #3b2323;
    border-radius: 8px;
    color: #ff9d94;
    font-size: 14px;
    font-weight: 500;
}

/* Buttons */
.btn-primary {
    display: block;
    width: 100%;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #132613;
    background: #68c468;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: #7bd47b;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: #565b56;
    color: #9aa09a;
    cursor: not-allowed;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #dfe5df;
    background: #363b36;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #434943;
}

/* Board header */
.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: #142914;
}

.worker-name {
    font-size: 18px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-header {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: rgba(20, 30, 20, 0.55);
    border: 1px solid rgba(20, 30, 20, 0.65);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-header:hover {
    background: rgba(20, 30, 20, 0.75);
}

/* Board error toast */
.board-error {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #ffebee;
    border-left: 5px solid #c62828;
    border-radius: 8px;
    color: #c62828;
    font-size: 14px;
    font-weight: 600;
}

/* Board sections */
.board-section {
    margin-bottom: 20px;
}

.section-title {
    color: #142914;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.priority-group-title {
    color: #142914;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0.75;
    margin: 14px 0 8px;
}

.empty-note {
    color: rgba(20, 41, 20, 0.65);
    font-size: 14px;
    padding: 8px 2px;
}

/* Job cards */
.job-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    border-left: 6px solid #9e9e9e;
}

.job-card.priority-high {
    border-left-color: #d32f2f;
}

.job-card.priority-medium {
    border-left-color: #ef6c00;
}

.job-card.priority-low {
    border-left-color: #388e3c;
}

.job-card.completed {
    opacity: 0.85;
    cursor: pointer;
}

.job-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.job-bin {
    font-size: 24px;
    font-weight: 800;
    color: #0c360c;
    letter-spacing: 1px;
}

.job-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chip {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.chip-priority-high {
    background: #ffebee;
    color: #c62828;
}

.chip-priority-medium {
    background: #fff3e0;
    color: #e65100;
}

.chip-priority-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.chip-overdue {
    background: #d32f2f;
    color: #fff;
}

.chip-stale {
    background: #f9a825;
    color: #fff;
}

.chip-status {
    background: #e3f2fd;
    color: #1565c0;
}

.job-type {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* Job type identity: emoji + coloured pill (colour comes from BC, set via CSSOM) */
.job-type-emoji {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.job-type-pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 700;
    background: #eeeeee;
    color: #333;
}

.job-item {
    font-size: 14px;
    color: #666;
    margin-top: 2px;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 8px;
    font-size: 13px;
    color: #888;
}

.job-meta-label {
    font-weight: 600;
    color: #999;
}

/* Expanded card details */
.job-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.job-instructions {
    font-size: 14px;
    color: #444;
    line-height: 1.5;
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.job-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    font-size: 13px;
}

.job-detail-label {
    color: #999;
    font-weight: 500;
    flex-shrink: 0;
}

.job-detail-value {
    color: #333;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.job-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-action {
    flex: 1;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-action:active {
    transform: scale(0.97);
}

.btn-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-take {
    background: #0c360c;
    color: #fff;
}

.btn-start {
    background: #1565c0;
    color: #fff;
}

.btn-finish {
    background: #2e7d32;
    color: #fff;
}

.btn-release {
    background: #eceff1;
    color: #455a64;
    flex: 0 0 auto;
    padding-left: 18px;
    padding-right: 18px;
}

/* Designer field values in expanded card details (plan section 20) */
.job-field-values {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f5f7f5;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
}

.job-field-values .job-field-row {
    padding: 2px 0;
}

.job-field-values .job-field-label {
    font-weight: 600;
    color: #333;
}

/* Recently completed toggle */
.completed-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    background: rgba(20, 30, 20, 0.5);
    border: 1px solid rgba(20, 30, 20, 0.6);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    margin-bottom: 10px;
}

.completed-arrow {
    font-size: 14px;
    transition: transform 0.2s;
}

.completed-toggle.open .completed-arrow {
    transform: rotate(180deg);
}

/* Finish flow */
.finish-job-summary {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #3a3f3a;
}

.finish-job-type {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #e8ece8;
}

.finish-job-bin {
    display: block;
    font-size: 26px;
    font-weight: 800;
    color: #8fdc8f;
    letter-spacing: 1px;
    margin-top: 4px;
}

.finish-job-item {
    display: block;
    font-size: 14px;
    color: #b0b8b0;
    margin-top: 2px;
}

.finish-notes {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    background: #1a1d1a;
    color: #f2f2f2;
    border: 2px solid #3d423d;
    border-radius: 10px;
    outline: none;
    resize: vertical;
    margin-bottom: 16px;
}

.finish-notes:focus {
    border-color: #68c468;
}

/* Finish-flow designer fields (snapshot Finish-stage questions) */
.finish-fields-title {
    font-size: 15px;
    font-weight: 700;
    color: #b8c0b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

#finish-fields-block {
    margin-bottom: 16px;
}

.finish-field {
    margin-bottom: 10px;
}

.finish-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #a8b0a8;
    margin-bottom: 3px;
}

.finish-field-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
    background: #161816;
    color: #f2f2f2;
    border: 2px solid #3d423d;
    border-radius: 8px;
    outline: none;
}

.finish-field-input:focus {
    border-color: #68c468;
}

/* Error / message view */
.error-card {
    text-align: center;
    border-top: 6px solid #f44336;
}

.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    line-height: 1;
}

.error-icon img {
    width: 60px;
    height: 60px;
    display: block;
}

.error-message {
    font-size: 16px;
    color: #e4e8e4;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Loading */
.spinner {
    width: 48px;
    height: 48px;
    margin: 40px auto 20px;
    border: 5px solid rgba(20, 41, 20, 0.3);
    border-top-color: #142914;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    text-align: center;
    color: rgba(20, 41, 20, 0.75);
    font-size: 16px;
}

/* Connection Lost Banner */
.connection-lost {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #d32f2f;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    animation: connectionPulse 2s ease-in-out infinite;
}

.connection-lost-icon {
    font-size: 18px;
}

.emoji-xs {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
}

@keyframes connectionPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
