
body,html {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    height: 100%;
    overflow: hidden;
    min-width: 266px;
    color:#000!important;
    background-color:#f1f1f1!important;
}

body {
    display: flex;
    flex-direction: column;
}

table{
    border-collapse:collapse;
    border-spacing:0;
    width:100%;
    display:table
}

td,th{
    padding:6px 8px;
    display:table-cell;
    text-align:left;
    vertical-align:top;
    /* width:100% */
}
th:first-child,td:first-child{
    padding-left:16px
}
tr{
    border-bottom:1px solid #ddd
}

a {
    color: #000;
}
a:hover {
    color: #444;
}

#page-content-wrapper {
    flex: 1;
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: column;
}

#map{
    height:100%;
    width:100%;
}

.rotated-icon {
            transform-origin: center;
        }

#time-bar {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: min(25vh, 200px); /* More dynamic height - 25% of viewport or max 200px */
  min-height: 120px; /* Ensure minimum usable height */
  background: linear-gradient(180deg, white 70%, #f5f5f5 70%);
  border-top: 1px solid #ddd;
  user-select: none; /* Prevent text selection */
  cursor: grab; /* Default cursor */
  box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
  z-index: 100; /* Ensure timeline is above most elements */
}

.timebar-line {
    position: absolute;
    top: 0;
    height: 25%; /* 1/3 of the bar's height */
    width: 3px;
    background-color: black;
    opacity: 0.3;
}

.timebar-product {
    position: absolute;
    top: 0;
    height: 70%; /* Most of the bar's height */
    width: 6px;
    background-color: grey;
    z-index: 2;
    transition: transform 0.2s ease;
}

.timebar-product:hover {
    cursor: pointer;
}

.timebar-purchase-interval {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: blue;
    opacity: 0.7;
    border-left: 6px solid blue;
    border-right: 6px solid blue;
    border-top: none;
    border-bottom: none;
    z-index: 1 !important; /* Below product lines (z-index: 2) */
    transition: opacity 0.2s ease, transform 0.2s ease;
    min-width: 8px;
}

.timebar-purchase-interval:hover {
    cursor: pointer;
}

.timebar-present-time {
    position: absolute !important;
    top: 0 !important;
    height: 100% !important;
    width: 2px !important;
    background-color: #000 !important;
    z-index: 10 !important;
}

.timebar-current-time {
    position: absolute !important;
    top: 0 !important;
    height: 100% !important;
    width: 2px !important;
    background-color: #FF0000 !important;
    z-index: 11 !important;
}

.timebar-now-button {
    position: absolute !important;
    top: 8px !important;
    right: 15px !important;
    padding: 8px 16px !important;
    background: #000 !important;
    color: white !important;
    border: 2px solid #333 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4) !important;
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 350 !important;
    margin: 0 !important;
    outline: none !important;
    transition: background 0.2s ease, transform 0.2s ease;
}

.timebar-now-button:hover {
    background: #333 !important;
    transform: translateY(-1px);
}

.timebar-min-time,
.timebar-max-time {
    /* Position and layout handled by inline styles in timebar.js */
    font-size: 14px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    z-index: 250 !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
    font-weight: bold !important;
    transition: background 0.2s ease;
}

.timebar-min-time:hover,
.timebar-max-time:hover {
    background: rgba(240,240,240,0.95) !important;
}

.timebar-date-input {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    padding: 12px !important;
    background: white !important;
    border: 2px solid #333 !important;
    border-radius: 8px !important;
    z-index: 300 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}

.timebar-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.5) !important;
    z-index: 299 !important;
}

.timebar-controls {
    position: absolute !important;
    top: 8px !important;
    right: 15px !important;
    display: flex !important;
    gap: 8px !important;
    z-index: 250 !important; /* Even higher than before */
    background: rgba(255,255,255,0.98) !important; /* More opaque */
    padding: 8px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; /* Stronger shadow */
    border: 2px solid #ddd !important; /* Thicker border */
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.timebar-now-button {
    padding: 8px 16px !important;
    background: #000 !important;
    color: white !important;
    border: 2px solid #333 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: bold !important;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4) !important;
    transition: background 0.2s ease !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 350 !important;
    position: absolute !important;
    top: 8px !important;
    right: 15px !important;
}

.timebar-now-button:hover {
    background: #333 !important;
    transform: translateY(-1px);
}



/* Popup z-index styling */
.ais-statistics-popup,
.purchase-statistics-popup {
    z-index: 9999 !important;
}

.ais-statistics-popup .maplibregl-popup-content,
.purchase-statistics-popup .maplibregl-popup-content,
.ais-statistics-popup .maplibregl-popup-tip,
.purchase-statistics-popup .maplibregl-popup-tip {
    z-index: 9999 !important;
}

/* Better word wrapping for popup tables */
.ais-statistics-popup .maplibregl-popup-content table,
.purchase-statistics-popup .maplibregl-popup-content table {
    table-layout: fixed;
    width: 100%;
}

.ais-statistics-popup .maplibregl-popup-content table td,
.purchase-statistics-popup .maplibregl-popup-content table td {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
}

.timebar-label {
  position: absolute;
  top: 75%; /* Position in the grey area */
  font-size: 11px;
  text-align: center;
  transform: translateX(-50%);
  color: #666;
  pointer-events: none; /* Allow mouse events to pass through */
  white-space: nowrap;
}

#time-bar.dragging {
  cursor: grabbing; /* Cursor while dragging */
}

header {
    /* flex: 1; */
    background-color: #333;
    color: #fff;
    padding: 10px 0;
    text-align: center;
    box-sizing: border-box;
}


.container {
    /* flex: 1; */
    display: flex;
    flex-direction: column;
    height: 100vh;
}

main {
    flex: 1;
    /* position: fixed; */
    /* flex-basis: 20%; */
    height: 200%;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto; /* Allows scrolling if content overflows */
}

/* main {
    margin: 20px auto;
    padding: 20px;
    width: 80%;
    max-width: 600px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} */

form {
    display: flex;
    flex-direction: column;
}

form p {
    margin: 10px 0;
}

label {
    font-weight: bold;
    margin: 10px 0;
}

input[type="text"],
input[type="password"],
textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

input[type="submit"],
button {
    padding: 10px 15px;
    margin: 2px 10px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

input[type="submit"]:hover,
button:hover {
    background-color: #555;
}

.flashes {
    list-style: none;
    padding: 0;
}

.flashes li {
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.flashes li.success {
    background-color: #d4edda;
    color: #155724;
}

.flashes li.danger {
    background-color: #f8d7da;
    color: #721c24;
}

.top-panel, header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333;
    color: white;
    padding: 0px 10px;
    /* position: fixed; */
    width: 100%;
    top: 0;
    /* z-index: 1000; */
}
.top-panel .logo {
    display: flex;
    align-items: center;
}
.top-panel .logo img {
    height: 20px;
    margin-right: 10px;
}
.top-panel .actions {
    display: flex;
    align-items: center;
}
.top-panel .actions button, .top-panel .actions a {
    background-color: #444;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    margin-left: 20px;
    margin-right: 20px;
}
.sidebar {
    height: 100%;
    width: 250px;
    max-width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #797979;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 20%;
    z-index: 1001;
    display: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.sidebar a {
    padding: 10px 15px;
    text-decoration: none;
    font-size: 18px;
    color: white;
    display: block;
    transition: 0.3s;
}
.sidebar a:hover {
    background-color: #575757;
}

.sidebar .close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: white;
}
.main-content {
    margin-top: 60px;
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto; /* Allows scrolling within the main-content */
    box-sizing: border-box;
    flex-direction: column;
    display: flex;
    align-items: left;
}

.narrow-content {
    max-width: 500px;
}


/* style for the profile editing page
/* Style all input fields to be grey by default */
/* .account input[type="text"], .account input[type="email"], .account input[type="password"], .account textarea {
    background-color: #f0f0f0; /* Light grey */
    /* color: black; */
    /* border: 1px solid #ccc; */
    /* padding: 10px; */
    /* transition: background-color 0.3s ease;
} */

/* Change to white when the field is focused */
/* .account input[type="text"]:focus, .account input[type="email"]:focus, .account input[type="password"]:focus, .account textarea:focus {
    background-color: white;
} */

/* Keep the username field grey and make it look non-editable */
input[readonly], input[readonly]:focus {
    background-color: #e0e0e0; /* Slightly darker grey */
    color: #888; /* Lighter text color */
    cursor: not-allowed; /* Change cursor to indicate it's not editable */
}


#map {
  position: relative;
  z-index: 100;
}

.mapboxgl-ctrl-top-left, .maplibregl-ctrl-top-left {
  z-index: 9999 !important;
  pointer-events: auto !important;
}
.mapboxgl-ctrl-group {
  z-index: 10000 !important;
  pointer-events: auto !important;
}

/* Popup styling */
#deckgl-popup {
  display: none;
  position: absolute;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
  padding: 24px;
  z-index: 10000;
  max-width: 80vw;
  max-height: 60vh;
  overflow: auto;
}

/* Arrow styling */
#deckgl-popup-connector {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 10001;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #fff;
}

/* Spinner animation */
@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}

#layer-toggle {
  position: absolute;
  z-index: 10001;
  /* top/right set inline or here */
}
#layer-toggle .maplibregl-ctrl-icon {
  font-size: 1.3em;
  background: white;
  border: none;
  outline: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
}
#layer-toggle .maplibregl-ctrl-icon.active,
#layer-toggle .maplibregl-ctrl-icon:active {
  opacity: 1;
  background: #e6e6e6;
}
#layer-toggle .maplibregl-ctrl-icon:hover {
  opacity: 1;
}

/* New modular map styles */
.deckgl-popup {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 16px;
  max-width: 400px;
  z-index: 1000;
}

.deckgl-popup table {
  margin: 0;
  font-size: 14px;
}

.deckgl-popup td {
  padding: 4px 8px;
  word-wrap: break-word;
}

.timebar-line {
  position: absolute;
  width: 1px;
  height: 100%;
  background: #888;
}

.timebar-label {
  position: absolute;
  top: 100%;
  font-size: 12px;
  color: #666;
  transform: translateX(-50%);
  margin-top: 4px;
}

.timebar-product {
  position: absolute;
  width: 2px;
  height: 100%;
  background: #888;
  opacity: 0.7;
}

#time-bar {
  position: relative;
  height: 30px;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  cursor: grab;
}

#time-bar.dragging {
  cursor: grabbing;
}

.purchase-popup-content {
  min-width: 200px;
}

.purchase-popup-content table {
  margin-bottom: 10px;
}

.purchase-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.purchase-btn:hover {
  background: #0056b3;
}

.error-popup {
  background: #f8d7da;
  color: #721c24;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #f5c6cb;
}

#error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #f44336;
  color: white;
  padding: 12px;
  border-radius: 4px;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #ccc;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#layer-toggle button { font-weight: bold; font-size: 12px; }
