html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* GLOBAL BACKGROUND */
.admin-bg {
    background: #111;
    color: white;
    font-family: Arial, sans-serif;
}

/* MAIN CONTAINER */
.admin-container {
    width: 95%;
    margin: auto;
    padding-top: 20px;
min-height: 100vh;      /* ⭐ makes it fill the full page */
    display: flex;          /* ⭐ allows vertical stretching */
    flex-direction: column; /* ⭐ keeps top-box above middle-row */
}

/* TOP BOX */
.top-box {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    padding: 10px 20px;
 margin-top: 5px;
    text-align: center;
}
.top-box h1 {
    font-size: 18px;
    color: white;
    margin: 0;
    letter-spacing: 0.5px;
}

.middle-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}
.left-column {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.left-box,
.right-box,
.center-bottom-box {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
}

.right-box {
    flex:0.8 ;
}

/* CENTER COLUMN */
.center-column {
    flex: 2;
    display: block;
    flex-direction: column;
justify-content: space-between;
    gap: 20px;
}

/* CENTER TOP BOX */
.center-top-box {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    padding: 20px;
}

/* CENTER BOTTOM BOX */
.center-bottom-box {
    flex: 1;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    padding: 10px;
}

/* MAP */
#adminMap {
    width: 100%;
    height: 400px; /* ⭐ visible height */
    border-radius: 10px;
}
.left-box, .right-box {
    min-height: 500px; /* ⭐ makes them longer */
}

/* GENERAL CELL FIX — SHORTER FIELDS */
.left-box input,
.right-box input,
.left-box select,
.right-box select,
.left-box .cell,
.right-box .cell {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212,175,55,0.3);
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* FORCE SHORT HEIGHT */
.left-box input,
.right-box input,
.left-box select,
.right-box select {
    height: 28px !important;
    padding: 4px 6px !important;
    font-size: 13px !important;
    margin-bottom: 6px !important;
}

.left-box textarea,
.right-box textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212,175,55,0.3);
    padding: 10px 12px;
    border-radius: 6px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}
/* PREMIUM STYLE FOR SELECT DROPDOWNS */
.left-box select,
.right-box select,
.mode-selector select {
    background: rgba(0,0,0,0.35);                 /* dark premium */
    border: 1px solid rgba(212,175,55,0.35);      /* soft gold border */
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    color: white;
    width: 00%;
    box-sizing: border-box;
    font-size: 14px;
}
.left-box,
.right-box {
    min-width: 280px;
}

.left-box label,
.right-box label {
    color: white;
    font-size: 13px;
    margin-bottom: 4px;
    display: block;
}

/* Inputs */
.left-box input,
.right-box input {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(212,175,55,0.35);
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* Selects */
.left-box select,
.right-box select {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(212,175,55,0.35);
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}
.left-box,
.right-box {
    min-width: 300px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.coordinates-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.coordinates-row input {
    background: rgba(0,0,0,0.35);
    color: #ffffff;
    border: 1px solid #2979FF;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
}
.device-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* GLOBAL device-row rule (affects ALL rows) */
.device-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* ROW 1: Device Name + Serial Number (equal width) */
.device-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* ROW 2: Location longer than Add Device */
.device-row-bottom {
    display: grid;
    grid-template-columns: 2fr 1fr;   /* Location = bigger */
    gap: 8px;
    margin-bottom: 10px;
}

/* Inputs */
.device-row input {
    height: 28px;
    padding: 4px 6px;
    font-size: 13px;
    background: rgba(0,0,0,0.35);
    border: 1px solid #2979FF;
    border-radius: 4px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* GLOBAL device-row rule (affects ALL rows) */
.device-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* ROW 1: Device Name + Serial Number (equal width) */
.device-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* ROW 2: Location longer than Add Device */
.device-row-bottom {
    display: grid;
    grid-template-columns: 2fr 1fr;   /* Location = bigger */
    gap: 8px;
    margin-bottom: 10px;
}

/* Inputs */
.device-row input {
    height: 28px;
    padding: 4px 6px;
    font-size: 13px;
    background: rgba(0,0,0,0.35);
    border: 1px solid #2979FF;
    border-radius: 4px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* Add Device button */
.add-device-wrapper button {
    height: 28px;
    width: 100%;
    background: rgba(41,121,255,0.45);
    border: 1px solid #2979FF;
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

/* Add Device button */
.add-device-wrapper button {
    height: 28px;
    width: 100%;
    background: rgba(41,121,255,0.45);
    border: 1px solid #2979FF;
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

/* Blue border for ALL device fields */
.device-row input {
    height: 28px !important;
    padding: 4px 6px !important;
    font-size: 13px !important;
    background: rgba(0,0,0,0.35);
    border: 1px solid #2979FF;      /* BLUE BORDER */
    border-radius: 4px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* Add Device button */
.add-device-wrapper button {
    height: 28px;
    width: 100%;
    background: rgba(41,121,255,0.45);
    border: 1px solid #2979FF;      /* BLUE BORDER */
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

/* ROW 1: Sensor Name + Serial Number (equal width) */
.sensor-row-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* ROW 2: Location longer than Add Sensor */
.sensor-row-bottom {
    display: grid;
    grid-template-columns: 2fr 1fr;   /* Location = bigger */
    gap: 8px;
    margin-bottom: 10px;
}

/* Sensor inputs */
.sensor-row input {
    height: 28px;
    padding: 4px 6px;
    font-size: 13px;
    background: rgba(0,0,0,0.35);
    border: 1px solid #2979FF;   /* blue border */
    border-radius: 4px;
    color: white;
    width: 100%;
    box-sizing: border-box;
}

/* Add Sensor button */
.add-sensor-wrapper button {
    height: 28px;
    width: 100%;
    background: rgba(41,121,255,0.45);
    border: 1px solid #2979FF;   /* blue border */
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}
.middle-row {
    flex: 1;   /* ⭐ fills all remaining vertical space */
}

#saveNewCustomer {
    height: 28px;
    width: 100%;
    background: rgba(41,121,255,0.45);
    border: 1px solid #2979FF;
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
}
/* COLUMN TITLE SIZE FIX */


/* Center column: Overview + Customer Map */
.center-top-box h2,
.center-bottom-box h2 {
    font-size: 15px !important;
}

/* Right column: Create New Customer */
.right-box h2 {
    font-size: 15px !important;
}
/* ⭐ MAKE ALL CELLS BLUE BORDER */
.left-box input,
.right-box input,
.left-box select,
.right-box select,
.left-box textarea,
.right-box textarea,
.cell,
.coordinates-row input,
.device-row input,
.sensor-row input {
    border: 1px solid #2979FF !important;
}
/* ⭐ Make Mode Selector Blue Border */
.mode-selector select {
    border: 1px solid #2979FF !important;
}
.device-section h3,
.sensor-section h3,
.new-customer-title {
    color: white !important;
}
.device-section h3,
.sensor-section h3 {
    font-size: 13px !important;
    color: white !important;
    margin-bottom: 6px;
}
.device-list-item,
.sensor-list-item {
    background: rgba(0,0,0,0.35);
    border-left: 3px solid #2979FF;
    padding: 4px 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #ddd;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.device-list-item,
.sensor-list-item {
    background: rgba(0,0,0,0.25);
    border-left: 3px solid #2979FF;
    padding: 3px 6px;
    margin-bottom: 4px;
    border-radius: 3px;
    font-size: 11px;
    color: #ccc;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}
.device-list-item strong,
.sensor-list-item strong {
    color: white;
    font-size: 12px;
    font-weight: normal;
}
/* MOVE ADD DEVICE + ADD SENSOR UP */
.right-box .device-section,
.right-box .sensor-section {
    margin-top: 4px !important;
}
/* TIGHTEN TITLES AND INPUT ROWS */
.right-box h3 {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
}

.device-row-top,
.device-row-bottom,
.sensor-row-top,
.sensor-row-bottom {
    margin-bottom: 4px !important;
}
.device-row-top,
.sensor-row-top {
    display: flex;
    flex-direction: row;
    gap: 10px;          /* space between inputs */
}

.device-row-top input,
.sensor-row-top input {
    flex: 1;            /* all inputs same width */
    min-width: 0;       /* prevents overflow */
    height: 32px;       /* consistent height */
    font-size: 14px;    /* consistent text size */
    padding: 5px 8px;   /* clean spacing inside */
}

/* TIGHTEN DEVICE + SENSOR LIST SPACING */
#deviceContainer,
#sensorContainer {
    margin-top: 4px !important;
}
/* MOVE ADD DEVICE + ADD SENSOR HIGHER */
.right-box .device-section,
.right-box .sensor-section {
    margin-top: 2px !important;
    padding-top: 0px !important;
}

#adminMode {
    max-width: 260px;
    display: block;
    margin-bottom: 10px;
}

#admin-customer-select {
    max-width: 280px;
    display: block;
    margin-bottom: 10px;
}

.existing-left {
    flex: 1;
}

.device-sensor-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.device-column,
.sensor-column {
    flex: 1;
    max-height: 350px;
    overflow-y: auto;
}
.empty-cell {
    height: 120px;          /* adjust height as you want */
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    margin: 15px 0;
}
.existing-two-column {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex: 1; 
    align-items: flex-start;
}

.existing-left {
    flex: 1;
}

.existing-right {
    flex: 1;
    border-left: 1px solid rgba(255,255,255,0.25);
    padding-left: 15px;
    background: rgba(255,255,255,0.05);
    align-self: flex-start;
}
.existing-left,
.existing-right {
    flex: 1;
    min-width: 0;   /* ⭐ allows flexbox to make them truly equal */
}
#existingDeviceList,
#existingSensorList {
font-size: 12px;      
line-height: 1.2;   
}
.list-item {
    font-size: 10px;    
    padding: 3px 6px;  
    line-height: 1.2
}
.existing-right h3 {
color: #ff9900;
    text-shadow: 0 0 6px rgba(255,153,0,0.4);

font-size: 12px;     /* smaller */
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.mode-selector {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border: 1px solid rgba(255,153,0,0.45);
    border-radius: 8px;
    background: rgba(0,0,0,0.35);
    box-sizing: border-box;

    /* Positioning improvements */
    margin-top: -10px;     /* moves the box upward */
    margin-bottom: 15px;   /* keeps spacing below */
}

.mode-selector label {
    font-size: 14px;
    color: #ff9900;   /* orange to match */
}
.add-device-box,
.add-sensor-box {
    margin-top: 10px;
    padding: 4px 6px;   /* SUPER SMALL PADDING */
    border: 1px solid rgba(255,153,0,0.45);
    border-radius: 6px; /* slightly smaller radius */
    background: rgba(0,0,0,0.35);
}

.add-device-box h4,
.add-sensor-box h4 {
    color: #ff9900;
    font-size: 11px;     /* smaller title */
    margin-bottom: 4px;  /* minimal spacing */
}

.add-device-box input,
.add-sensor-box input {
    width: 100%;
    padding: 3px 5px;    /* ULTRA SMALL INPUT HEIGHT */
    margin-bottom: 2px;  /* minimal spacing between inputs */
    border-radius: 4px;  /* smaller radius */
    border: 1px solid rgba(255,153,0,0.45);
    background: rgba(0,0,0,0.45);
    color: white;
}
.add-device-box button,
.add-sensor-box button {
    width: 100%;
    padding: 8px;
    background: #ff9900;
    border: none;
    border-radius: 6px;
    color: black;
    font-weight: 600;
    cursor: pointer;
}
.left-box {
    display: block !important;
}
.right-column {
    flex: 1;
}

.existing-customer-box,
.map-box,
.right-box {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 10px;
    padding: 20px;
}
.right-box {
    max-height: 450px;   /* adjust to your taste */
    overflow-y: auto;    /* scroll inside if content exceeds height */
}
.map-box {
    height: 350px;
}

#adminMap {
    width: 100%;
    height: 100%;
    border-radius: 10px;
}
/* NEW CUSTOMER DEVICE + SENSOR BOXES — ULTRA COMPACT */
.new-add-device-box,
.new-add-sensor-box {
    margin-top: 2px; /* ⭐ no space between sections */
    padding: 4px; /* ⭐ very small padding */
    border: 1px solid rgba(41,121,255,0.65);
    border-radius: 4px;
    background: rgba(0,0,0,0.40);
}

/* Titles — smaller */
.new-add-device-box h4,
.new-add-sensor-box h4 {
    color: white;
    font-size: 13px; /* smaller */
    margin-bottom: 3px; /* tighter */
}

/* Rows — tighter */
.new-device-row-top,
.new-device-row-bottom,
.new-sensor-row-top,
.new-sensor-row-bottom {
    display: flex;
    gap: 4px; /* tighter spacing */
    margin-bottom: 3px; /* reduce height */
}

/* Inputs — smaller height */
.new-add-device-box input,
.new-add-sensor-box input {
    flex: 1;
    padding: 3px; /* smaller */
    height: 24px; /* ⭐ reduced height */
    border-radius: 4px;
    border: 1px solid rgba(41,121,255,0.45);
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 11px; /* smaller font */
}

/* Buttons — same height as inputs */
#addNewDeviceBtn,
#addNewSensorBtn {
    height: 24px; /* ⭐ same height as inputs */
    padding: 0 10px; /* horizontal only */
    background: #2979ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* smaller font */
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

#addNewDeviceBtn:hover,
#addNewSensorBtn:hover {
    background: #5393ff;
}

/* Save button */
#saveNewCustomer {
    margin-top: 8px;
    padding: 6px 12px;
    background: #2979ff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.right-column input {
    margin-bottom: 1px !important; /* ⭐ almost no spacing */
}

#saveNewCustomer:hover {
    background: rgba(41,121,255,0.65);
}
.new-customer-label {
    font-size: 16px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.new-customer-label span {
    font-weight: 400;
}

.existing-header {
    font-size: 14px;     
    font-weight: 600;     
    color: #ff9900;      
    margin-bottom: 10px;  
    display: block;
}

.existing-header span {
    font-size: 12px;      /* slightly smaller sub-label */
    font-weight: 400;
    margin-left: 4px;
}
.device-item.selected,
.sensor-item.selected {
    background-color: rgba(255, 225, 225, 0.15);
    border-left: 4px solid #ffffff;
    padding-left: 8px;
    transition: background-color 0.2s ease, border-left 0.2s ease;
}
#deleteSelectedItemBtn {
    background-color: rgba(211, 47, 47, 0.25);
    border: 2px solid #D32F2F;
    color: #ffffff;
    padding: 6px 12px; /* narrower */
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s ease;

    width: fit-content;   /* ⭐ forces the button to shrink */
    display: inline-block; /* ⭐ prevents stretching */
}
.delete-customer-wrapper {
    margin: 12px 0; 
    display: flex;
    justify-content: flex-start;
}

#deleteExistingCustomerBtn {
    background-color: rgba(211, 47, 47, 0.25);
    border: 2px solid #D32F2F;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s ease;
    width: fit-content;
}

#deleteExistingCustomerBtn:hover {
    background-color: rgba(211, 47, 47, 0.35);
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.6);
}
.left-box h2.existing-header {
    font-size: 14px !important;
    font-weight: 400 !important;   /* removes bold */
    color: #ff9900;
    margin-bottom: 10px;
}
.existing-header span {
    font-size: 12px !important;
    font-weight: 300 !important;
}

.top-box {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;

    padding: 10px 15px;   /* smaller padding */
    margin-bottom: 20px;

    box-shadow: 0 4px 18px rgba(0,0,0,0.25); /* smaller shadow */
}
.admin-bg {
    background: linear-gradient(135deg, #141414, #1f1f1f);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Admin logout icon */
.admin-bg .logout-icon {
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 9999;
}

.admin-bg .logout-icon:hover {
  transform: scale(1.15);
}

/* Admin header layout */
.admin-bg .admin-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: relative;
  z-index: 1;
}

/* Prevent title from overlapping icon */
.admin-bg .admin-header h1 {
  margin: 0;
  padding: 0;
}
/* Hide old logout button ONLY in admin */
.admin-bg .logout-btn {
  display: none !important;
}
.admin-bg .admin-header h1 {
  margin: 0;
  padding: 0;
  line-height: 1;
}
/* ⭐ Main logout icon */
.main-bg .logout-icon {
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 9999;
}

.main-bg .logout-icon:hover {
  transform: scale(1.15);
}

/* ⭐ Main header layout */
.main-bg .main-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: relative;
  z-index: 1;
}

/* ⭐ Right group (icon + logo) */
.main-bg .right-group {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
}

/* ⭐ Prevent title overlap */
.main-bg .main-header .header-title {
  margin: 0;
  padding: 0;
  line-height: 1;
}

/* ⭐ Hide old logout button ONLY in main dashboard */
.main-bg .logout-btn {
  display: none !important;
}