﻿/*  Styling for the page heading and zone selector - START */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    background-color: #f8f9fa;
    margin: 0px;
    padding: 0px;
}

.page-heading {
    text-align: center;
    font-size: 2.1rem;
    margin: 16px 0 10px 0;
    color: #2c3e50;
    font-weight: 600;
    letter-spacing: 1px;
    /* set border-bottom to none and padding-bottom to 0 if don't want line */
    border-bottom: 2px solid #ccc;    
    padding-bottom: 10px;
}

.zone-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.zone-selector label {
    font-size: 1.1em;
    margin-right: 10px;
    font-weight: 500;
}
/*
.zone-selector select {
    padding: 6px 12px;
    font-size: 1em;
}*/

.zone-selector.inline {
    justify-content: flex-start;
    margin: 0;
}

/* For the 2-line stacked filter layout */
.filter-stacked {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start; /* align left in card */
    margin-bottom: 20px;
}

.filter-zone-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-date-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-date-row label {
    margin-bottom: 0;
}

.filter-btn {
    margin-left: 10px; /* just a little space between date and button */
    margin-top: 0 !important;
    padding: 6px 18px;
    font-size: 1em;
    font-weight: 600;
    background: #233b82;
    color: #fff;
    border: none;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(120,120,120,.04);
    cursor: pointer;
    transition: background 0.2s;
}

.filter-btn:hover {
    background: #604B3D;
}

/* Fixed-width, right-aligned labels for filter rows */
.filter-zone-row, .filter-date-btn-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    width: 55px; /* Adjust this value to fit your longest label */
    display: inline-block;
    text-align: right;
    margin-right: 8px;
    font-size: 1.07em;
    font-weight: 500;
}

/* Reduce gap below filters to "Open Orders" */
.heading-filter {
    margin-bottom: 0; /* Decrease space below filters */
}

/*  Styling for the page heading and zone selector - END */

.time-selector {
    margin-bottom: 20px;
}

.time-selector button {
    margin-right: 10px;
    padding: 10px;
}

.slots {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.slot {
    min-width: 120px;
    min-height: 90px;
    border: 2px dashed #aaa;
    background-color: white;
    text-align: center;
    padding: 10px 6px;
    transition: background 0.2s ease, transform 0.1s ease;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.9em;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* If any booking is Loading (yellow) */
.slot.loading {
    background-color: #fff7b2 !important;
    border: 2px dashed #e6c200 !important;
}

/* If all bookings are Loaded (green, solid border) */
.slot.loaded {
    background-color: #d2ffd2 !important;
    border: 2px solid #46b046 !important;
}

.slot-status-label {
    font-size: .85em;
    font-weight: 700;
    margin-left: 8px;
    text-transform: uppercase;
    color: #b8860b;
}

.slot.loaded .slot-status-label {
    color: #267e3e;
}


.slot.filled {
    background-color: #c4d5a3;
    border-color: #888;
}

.slot span {
    font-weight: bold;
    color: #604B3D;
}

.slot small,
.slot div {
    font-size: 0.8em;
    color: #604B3D;
    margin-top: 4px;
    word-wrap: break-word;
}

/* Hover feedback for drag-over */
.slot.hovered {
    background-color: #e0ffe0; /* light green */
    border: 2px solid green;
    transform: scale(1.05);
}

.slot-content {
    flex-grow: 1;
}

/* Draggable booking ID items */
.booking-id {
    padding: 8px 10px;
    background-color: #e3f2fd;
    margin-bottom: 6px;
    border: 1px solid #c4d5a3;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: move;
    transition: background 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* show booking ids within the box without cutting off or overflowing horizontally */
.booking-id {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
}

.booking-id:hover {
    background-color: #c4d5a3;
}

/* Show a Loader While the Page is Loading */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: sans-serif;
    font-size: 1.2em;
    color: #333;
}

.spinner {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* show a loader after the carrier name is entered - spinner and @keyframes spin are common for this and page loader */
.action-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255,255,255,0.95);
    padding: 20px 30px;
    border: 2px solid #ccc;
    border-radius: 10px;
    z-index: 9999;
    text-align: center;
    font-size: 1em;
    font-weight: bold;
}

/* show a loader after the zone is switched */
/* Loader overlay shown during zone switch */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255,255,255,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 5px solid #ccc;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* slots container styling */
.slots-container h3 {
    color: #604B3D;
    padding: 10px 14px;
    margin: 30px 0 10px 0;
    border-left: 6px solid #c4d5a3;
    font-size: 1.1rem;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.slots-container {
    padding: 10px 0 10px 0;
}

/* auto focus to the carrier input textbox in the modal */
#carrierInput:focus {
    border-color: #c4d5a3;
    box-shadow: 0 0 0 0.2rem rgba(196, 213, 163, 0.5);
}

/* styling for different color for each of the slot for timerange boxes*/
.bg-0 {
    background-color: #fff5cc;
}

.bg-1 {
    background-color: #d0f0c0;
}

.bg-2 {
    background-color: #fcd5ce;
}

.bg-3 {
    background-color: #dbeafe;
}

.bg-4 {
    background-color: #fcefc7;
}

/* pills inside slot */
.slot-bookings {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.pill {
    background: #fbe5cf;
    color: #603013;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pill .icon, .booking .icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .8rem;
    color: #233b82;
}

.pill .icon.del {
    color: #c93a3a;
}

.booking {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.booking .text {
    flex: 1;
}

/* slot highlight while dragging over */
.slot.drag-over {
    outline: 3px solid #233b82; /* solid, thicker */
    outline-offset: -3px;
    background-color: #eef4ff; /* light blue tint */
}

/* ===== Action overlay blocking UI while saving / unassigning ===== */
/* reusing the spinner class used with action loader */
.action-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255,255,255,0.7); /* translucent veil */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000; /* above everything */
}

.action-box {
    background: #ffffff;
    padding: 22px 34px;
    border: 2px solid #ccc;
    border-radius: 12px;
    text-align: center;
    font-size: 1em;
    font-weight: bold;
    color: #333;
}

.carrier-name {
    font-size: .8rem;
    color: #604B3D;
    margin-top: 2px;
    white-space: nowrap;
}

/* ------------------------------------------------------------------
   FLEX LAYOUT : booking list (left)  +  slots (right)
------------------------------------------------------------------*/
/* ================================================
   LAYOUT : booking pane (left) + main area (right)
   ================================================ */
.layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding-right: 0px;
    margin: 5%;
    margin-top: 0px;
    margin-left: 20px;
    max-width: auto;
    width: 100%;
}

/* ---------- booking list pane ---------- */
.booking-list {
    flex: 0 0 600px; /* fixed width */
    height: calc(100vh - 320px); /* full viewport minus heading/filters */
    max-height: calc(100vh - 120px); /* shorter top offset */
    height: calc(80vh); /* full viewport minus heading/filters */
    max-height: calc(90vh); /* shorter top offset */
    overflow-y: auto;
    background: #ffffff;
    border: 3px solid #c4d5a3;
    border-radius: 10px;
    padding: 18px 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    position: sticky;
    top: 90px; /* distance from top heading */
    z-index: 50;
}

/* booking list header */
.booking-list-heading {
    font-size: 2rem;
    font-weight: 600;
    color: #233b82;
    margin-bottom: 14px;
    text-align: center;
}

/* list container – hide horizontal scroll & white background */
.booking-ids {
    overflow-y: auto;
    overflow-x: hidden;
    background: transparent;
    padding-right: 4px;
    padding-bottom: 8px;
}

/* ---------- main section (filters + slots) ---------- */
.main-area {
    flex: 1 1 auto; /* take remaining width */
    min-width: 0; /* allow flex-shrink */
    padding-right: 5%;
}

/* ---------- slot grid tweaks ---------- */
.slot {
    min-width: 110px;
    min-height: 85px;
    font-size: .85rem;
}

/* ---------------------------------------
   Mobile / tablet: stack vertically
   --------------------------------------- */
@media (max-width: 1024px) {
    .layout {
        flex-direction: column;
    }

    .booking-list {
        position: static;
        height: auto;
        width: 100%;
    }

    .main-area {
        width: 100%;
    }
}

/* -------- booking-ID items (AMES brand colours) -------- */
.booking {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    padding: 8px 10px;
    cursor: grab;
    background: #c4d5a3; /* AMES light green */
    color: #604B3D; /* AMES brown */
    border: 1px solid #9db7e1; /* subtle blue outline */
    border-radius: 6px;
    transition: background .2s, color .2s;
}

.booking:hover {
    background: #604B3D; /* invert on hover */
    color: #c4d5a3;
}

.booking:active {
    cursor: grabbing;
}

/* icon size */
.booking .icon,
.pill .icon {
    font-size: .8rem;
}

.draggable-booking {
    cursor: grab;
    color: #233b82;
    font-weight: 600;
}

/* spinner for slot carrier update 
.slot-spinner {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    padding: 6px 10px;
    z-index: 10;
    font-size: 20px;
    color: #333;
}*/

.slot-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    font-size: 38px; /* much bigger */
    color: #2951b6;
    box-shadow: 0 0 18px 0 #d2e3fc;
    pointer-events: none;
}

.slot-spinner i {
    font-size: 2.5em;
    animation: spin 0.7s linear infinite;
}

.slot {
    position: relative;
}

/* make booking table font smaller */
#bookingTable,
#bookingTable th,
#bookingTable td {
    font-size: 12px !important; /* or try 11px for even smaller */
}

/* Remove top margin from first slot group heading */
.main-area .slots-container:first-child h3 {
    margin-top: 0 !important;
}

/* Remove extra padding/margin above slots if any */
.main-area, .slot-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Datatable get the entries per page label above the dropdown, just like how the Search label is above the search box */
#bookingTable_length label {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.25em !important;
}

#bookingTable_length label select {
    margin-top: 0.25em !important;
}

/* the booking info and slot info popup table data */
.leftColumnInfoPopup {
    text-align: right;
    font-weight: 500;
    color: #4A4A4A;
    padding-right: 1em;
}

.rightColumnInfoPopup {
    text-align: left;
    font-weight: 600;
    color: #604B3D;
}

.tableInfoPopup {
    width: 100%;
    font-size: 1rem;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.divInfoPopup {
    border: 1px solid #eee;
    border-radius: 7px;
    padding: 10px;
    margin-bottom: 6px;
    background: #c4d5a3;
}
