/* 
 * General CSS for OpenGTS - Modern UI Theme 2.0
 * Updated styling for a cleaner, more contemporary look
 */

:root {
  --primary-color: #3498db;
  --primary-hover: #2980b9;
  --secondary-color: #2ecc71;
  --secondary-hover: #27ae60;
  --text-color: #333333;
  --light-text: #777777;
  --light-bg: #f5f5f5;
  --border-color: #e0e0e0;
  --header-bg: #f8f9fa;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --transition: all 0.3s cubic-bezier(.25,.8,.25,1);
  --content-width: 100%;  /*800px; Adjusted for better fit */
}

/* Base styles */
BODY { 
    background-color: #FFFFFF;
    margin: 0; 
    font-size: 10pt; 
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    line-height: 1.4;
}

/* Typography */
H1, H2, H3, H4 { 
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-weight: 500;
    margin: 0.5em 0;
    color: #2c3e50;
}

H1 { font-size: 22pt; }
H2 { font-size: 18pt; }
H3 { font-size: 15pt; }
H4 { font-size: 13pt; }

/* Links */
A {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

A:hover { 
    color: var(--primary-hover);
    text-decoration: underline;
}

SPAN.spanLink {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

SPAN.spanLink:hover { 
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Form elements */
FORM {
    margin: 0;
}

HR {
    margin: 10px 0;
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
}

HR.noMargin {
    margin: 0;
}

TD { 
    font-size: 10pt; 
    font-family: 'Segoe UI', Roboto, 'Open Sans', sans-serif;
    padding: 4px;
}

/* Form controls */
INPUT, SELECT, TEXTAREA { 
    font-size: 10pt; 
    font-family: 'Segoe UI', Roboto, 'Open Sans', sans-serif;
    padding: 1px 1px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    transition: var(--transition);
    box-sizing: border-box;
}

INPUT:focus, SELECT:focus, TEXTAREA:focus { 
    background-color: #FFFFD6;
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
}

/* Buttons */
button, input[type="button"], input[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition);
}

button:hover, input[type="button"]:hover, input[type="submit"]:hover {
    background-color: var(--primary-hover);
}

/* Tables */
table {
    border-collapse: collapse;
}

/* Main layout tables */
table.bodyTable {
    width: 100%;
    height: 100%;
}

/* Content tables */
table.contentTable, 
table.contentMapTable, 
table.reportMapTable, 
table.reportTable {
    max-width: var(--content-width);
    margin: 0 auto;
    border-collapse: collapse;
    width: auto !important;
}

table.dataTable {
    box-shadow: var(--shadow);
    border-radius: 4px;
    overflow: hidden;
}

table.dataTable th {
    background-color: var(--header-bg);
    border-bottom: 2px solid var(--border-color);
    padding: 8px;
    text-align: left;
    font-weight: 600;
}

table.dataTable td {
    border-bottom: 1px solid var(--border-color);
    padding: 8px;
}

table.dataTable tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Navigation and Menu Bar Styles */
#TableRow_Navigation {
    text-align: center;
}

#TableRow_Navigation td {
    text-align: center;
}

#TableRow_Navigation table {
    width: auto !important;
    max-width: var(--content-width);
    margin: 0 auto;
}

.navBar, .navBarClear {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 15px;
    color: var(--text-color);
}

.navBarClear {
    background-color: transparent;
}

/* Menu Bar Styles */
.menuBar {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.menuBar table {
    width: auto !important;
    margin: 0 auto;
}

/* Main content container */
.pageContentTable {
    max-width: var(--content-width);
    margin: 0 auto;
    width: auto !important;
}

/* Content cells */
.contentCell, .contentTopMenuCell, .contentTrackMapCell {
    padding: 15px;
    background-color: white;
    border-radius: 4px;
    box-shadow: var(--shadow);
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* Calendar styles */
.calendarTable {
    max-width: 100%;
    width: auto !important;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0 auto;
    min-width: 250px; /* Ensure minimum width for calendar */
}

.calendarHeader {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 8px;
}

.calendarHeaderCell, .calendarCell {
    width: 14.28%;
    box-sizing: border-box;
    padding: 4px;
    overflow: visible; /* Changed from hidden to visible */
    text-overflow: clip;
    white-space: normal; /* Changed from nowrap to normal */
}

.calendarHeaderCell {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
}

.calendarToday {
    background-color: #fffde7;
    font-weight: bold;
}

.calendarSelected {
    background-color: var(--secondary-color);
    color: white;
}

/* Calendar container */
.calendarDiv {
    max-width: 100%;
    overflow: visible; /* Changed from hidden to visible */
    box-sizing: border-box;
    min-width: 250px; /* Ensure minimum width */
}

/* Map control elements */
.mapControlCell {
    background-color: white;
    border-radius: 4px;
    box-shadow: var(--shadow);
    padding: 4px;
    padding-left: 8px; /* Increased left padding to prevent overlap with map */
    margin: 5px;
    overflow-y: auto;
}



/* Make all inputs in the map control more compact */
.mapControlCell input[type="text"] {
    padding: 2px 4px;
    height: 20px;
    font-size: 9pt;
}


/* Compact legend in map control */
.mapControlCell .legendContainer {
    padding: 4px;
}

.mapControlCell .legendHeader {
    padding: 4px 0;
    font-size: 9pt;
    margin-bottom: 3px;
}

.mapControlCell .legendItem {
    margin: 4px 0;
    font-size: 8pt;
}

/* Device list styles */
.deviceListTable { 
    width: 100%; 
    font-size: 10pt; 
    border: 1px solid var(--border-color); 
    margin-top: 0;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

.deviceListHeader { 
    padding: 6px; 
    border-bottom: 1px solid var(--border-color); 
    background-color: var(--header-bg); 
    font-weight: bold; 
    margin-top: 0; 
    position: sticky; 
    top: 0; 
    z-index: 10;
}

.deviceListRow { 
    padding: 4px; 
    cursor: pointer;
    transition: var(--transition);
}

.deviceListRow:hover { 
    background-color: var(--light-bg);
}

.deviceListCell { 
    padding: 4px 6px;
}

.deviceListHeader-refresh { 
    text-align: right;
}

.deviceListRefreshBtn { 
    cursor: pointer; 
    font-weight: bold; 
    color: var(--primary-color);
}

.deviceIgnitionOn { 
    width: 27px; 
    height: 27px; 
    display: inline-block;
    background-image: url('../images/ign_on.png'); 
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
   /* cursor: help; */
}

.deviceIgnitionOff { 
    width: 27px; 
    height: 27px; 
    display: inline-block;
    background-image: url('../images/ign_off.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
   /* cursor: help; */
}

/* Navigation and tabs */
.tabContainer {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.tabButton {
    padding: 10px 15px;
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--light-text);
    transition: var(--transition);
    cursor: pointer;
}

.tabButton:hover {
    color: var(--primary-color);
}

.tabButton.selected {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* Status indicators */
.statusIndicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

/* Legend styles */
.legendContainer {
    background-color: white;
    border-radius: 4px;
    padding: 8px;
    box-shadow: var(--shadow);
}

.legendHeader {
    font-weight: bold;
    text-align: center;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

.legendItem {
    display: flex;
    align-items: center;
    margin: 3px 0;
}

/* Popup info styles */
.popupInfo {
    background-color: white;
    border-radius: 4px;
    padding: 10px;
    box-shadow: var(--shadow);
    max-width: 300px;
}

.popupHeader {
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
    margin-bottom: 5px;
}

/* Banner table */
.bannerTable {
    max-width: var(--content-width);
    margin: 0 auto;
    width: auto !important;
}

/* Report page styling */
.reportContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 100%;
    margin-bottom: 20px;
}

.reportOptionsContainer {
    flex: 1;
    min-width: 300px;
    max-width: 100%;
}

.reportCalendarContainer {
    flex: 0 0 auto;
    max-width: 100%;
    margin-right: 20px;
}

/* Form layout improvements */
.reportForm {
    max-width: 100%;
    margin-bottom: 15px;
}

.reportForm label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.reportForm input[type="text"],
.reportForm select {
    width: 100%;
    max-width: 300px;
    margin-bottom: 10px;
}

.reportForm input[type="radio"] {
    margin-right: 5px;
    vertical-align: middle;
}

/* Fix for report options that might overflow */
.reportRadioOption {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.reportRadioOption input[type="radio"] {
    margin-top: 3px;
}

.reportRadioOption label {
    margin-left: 5px;
    flex: 1;
}

/* Fix for calendar in reports */
#rptCal_fr, #rptCal_to {
    max-width: 100%;
    overflow: visible; /* Changed from hidden to visible */
    min-width: 250px; /* Ensure minimum width */
}

/* Make sure the calendar container doesn't overflow */
#calDiv {
    max-width: 100%;
    overflow: visible; /* Changed from hidden to visible */
    box-sizing: border-box;
    min-width: 250px; /* Ensure minimum width */
}

/* Report form elements */
.reportForm select,
.reportForm input[type="text"],
.reportForm input[type="submit"] {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-light);
    transition: all 0.2s ease;
}

.reportForm input[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-weight: bold;
    padding: 8px 15px;
    border: none;
}

.reportForm input[type="submit"]:hover {
    background-color: var(--secondary-color);
}

/* Report radio options */
.reportRadioOption {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.reportRadioOption:hover {
    background-color: rgba(71, 163, 218, 0.1);
}

.reportRadioOption input[type="radio"] {
    margin-top: 3px;
    margin-right: 8px;
}

.reportRadioOption label {
    cursor: pointer;
}

/* Format message element */
#formatMsgElem {
    display: block;
    padding: 8px;
    margin-top: 10px;
    border-radius: 4px;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
}

/* Device search styling */
#deviceSearchInput {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    margin-top: 0; /* Ensure it starts from the top */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 10pt;
    transition: var(--transition);
}

#deviceSearchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
    outline: none;
}

/* Device selector styles */
.devSelectorDiv { 
    display: block; 
    height: calc(100vh - 300px); /* Limit height to viewport minus header/footer space */
    overflow-y: auto; 
    margin-top: 0; 
}

.devSelectorTableList { 
    height: auto; /* Changed from fixed height */
    max-height: calc(100vh - 350px); /* Limit max height relative to viewport */
    overflow-y: auto; 
    border: 1px solid var(--border-color); 
    border-radius: 4px;
}

.devSelectorRowHeader { 
    background-color: var(--header-bg); 
    position: sticky; 
    top: 0; 
    z-index: 10; 
}

.devSelectorColHeader { 
    padding: 6px; 
    font-weight: bold; 
    text-align: left; 
    font-size: 9pt;
}

.devSelectorRowData { 
    cursor: pointer; 
    height: 28px; 
    max-height: 28px;
}

.devSelectorRowData:hover { 
    background-color: var(--light-bg);
}

.devSelectorColData { 
    padding: 4px 6px; 
    font-size: 9pt; 
    height: 28px; 
    max-height: 28px; 
    overflow: hidden;
}

.deviceChooserInput { 
    width: 100%; 
    padding: 8px; 
    margin-bottom: 10px; 
    border: 1px solid var(--border-color); 
    border-radius: 4px;
}

/* Map table styles */
.contentMapTable {
    height: calc(100vh - 200px); /* Limit height to viewport minus header space */
    max-height: calc(100vh - 200px);
    overflow: hidden; /* Prevent overflow */
}

.contentTrackMapCell {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}


/* Make buttons and button text in same line with other content 
asta strica latimea coloanei cu calandarul !!
.mapControlCell table tr td {
    white-space: nowrap;
}
*/
/* Apply specific sizing to all map control buttons */
.mapControlCell input[type="button"],
.mapControlCell button,
#mapUpdateButton, 
#mapLastButton, 
#mapAutoUpdateButton,
#mapReplayButton,
#gotoAddressButton,
#pingDeviceButton {
    padding: 2px 5px !important;
    height: auto !important;
    font-size: 9pt !important;
    margin: 2px !important;
    line-height: 1.2 !important;
}

