/* Reset i główne style układu */
:root {
    --base-font-size: 12px;
    --header-height: 30px;
    --footer-height: 12px;
}

body, html {
    background-color: black;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;    
    overflow: hidden;
}

header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    z-index: 1002;
    margin: 0;
    padding: 0;
}

#map {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 12px;
    z-index: 1;
    width: auto;
    height: auto;
    background-color: #000000;
}

footer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;    
    background-color: black;
    color: white;
    text-align: right;
    padding: 2px 2px;
    font-family: Arial, sans-serif;
	font-size: var(--footer-height);
    font-weight: bold;
    z-index: 1001;
    margin: 0;
    box-sizing: border-box;
}

#top-controls-container {
    display: none;
}

/* Style podstawowych elementów */
a {
    color: #1978cf;
}

a:hover {
    color: #fff;
}

p {			
    text-align: center;
    font: arial-black;
}

h2, h3, h4 {
    white-space: nowrap;
    margin: 1em 0 0 0;
}

h3 a, h3 a:hover {
    text-decoration: none;
}

ul {
    font-size: .85em;
    margin: 0;
    padding: 0;
}

li {
    margin: 0 0 2px 18px;
}

label {    
    color: black;
    text-align: left;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: var(--base-font-size);
    font-weight: bold;
}

span {    
    color: black;
    text-align: left;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: var(--base-font-size);
    font-weight: bold;
}

/* Kontenery i kontrolki wyszukiwania */
#search-container { 			
    position: relative;
    flex: 1;
    width: auto;
    height: var(--header-height);
    background: black;
    border-radius: 0px;            
    font-family: Arial, sans-serif;
    font-size: var(--base-font-size);
    font-weight: regular;
    display: flex;
    align-items: center;
    gap: calc(var(--base-font-size) * 0.15);
    padding: 0 calc(var(--base-font-size) * 0.1);
    box-sizing: border-box;
    margin: 0;
}

#footer-container { 			
    position: relative;
    flex: 1;
    width: 100%; /* Zmień z auto na 100% */
    height: var(--footer-height);
    background: black;
    border-radius: 0px;            
    font-family: Arial, sans-serif;
    font-size: var(--base-font-size);
    font-weight: regular;
    display: flex;
    justify-content: flex-end; /* Dodaj to, aby wyrównać do prawej */
    text-align: right;    
    gap: calc(var(--base-font-size) * 0.15);
    padding: 0 calc(var(--base-font-size) * 0.1);
    box-sizing: border-box;
    margin: 0;
}


#search-input {            
    width: 100%;
	margin-top: 1px;
    max-width: calc(100% - 6vw);
    min-width: 25%;			
    padding: calc(var(--base-font-size) * 0.15);
    height: 25px;
    border: none;
    border-radius: calc(var(--base-font-size) * 0.3);
    font-size: var(--base-font-size);
    font-weight: bold;
    flex: 1;
    box-sizing: border-box;
}

#clear-search-button {
    padding: 0px;
    height: 26px;
    width: calc(var(--base-font-size) * 1);
    border: none;
    background: #0078A8;
    color: red;
    border-radius: calc(var(--base-font-size) * 0.375);
    cursor: pointer;
    font-size: var(--base-font-size);
    font-weight: bold;
    flex-shrink: 0;
}

#search-button, #toggle-search-container-button {
    padding: 0px;
    height: 26px;
    width: calc(var(--base-font-size) * 5);
    border: none;
    background: #0078A8;
    color: white;
    border-radius: calc(var(--base-font-size) * 0.375);
    cursor: pointer;
    font-size: var(--base-font-size);
    font-weight: extra-bold;
    flex-shrink: 0;
}

#download-apk-button {
    padding: 0px;
    height: 26px;
    width: calc(var(--base-font-size) * 7);
    border: none;
    background: #0078A8;
    color: white;
    border-radius: calc(var(--base-font-size) * 0.375);
    cursor: pointer;
    font-size: var(--base-font-size); /* Nowy rozmiar czcionki */
    font-weight: normal; /* Pogrubienie */
    font-family: Arial, sans-serif; /* Rodzina czcionek */    
    letter-spacing: 0px; /* Odstępy między literami */
    
    
    /* Pozostałe istniejące style */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
}

#search-button:hover,
#clear-results-button:hover,
#toggle-search-container-button:hover,
#download-apk-button:hover {
    background: #005f8a;			
}

#search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: calc(var(--base-font-size) * 0.125);
    background: white;
    border: 1px solid #ccc;
    border-radius: calc(var(--base-font-size) * 0.375);
    padding: calc(var(--base-font-size) * 0.625);
    font-size: var(--base-font-size);
    font-weight: bold;
    visibility: hidden;
    opacity: 0;
    position: fixed;
    top: calc(var(--header-height) + 0.5em);
    left: calc(var(--base-font-size) * 0.625);
    right: auto;
    width: calc(100% - 20vw - 2 * var(--base-font-size) * 0.625);
    z-index: 1001;
    transition: opacity 0.2s ease;
}

#search-results.visible {
    visibility: visible;
    opacity: 1;
}

#search-results div {
    padding: calc(var(--base-font-size) * 0.125);
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

#search-results div:hover {
    background-color: #f0f0f0;
} 

/* Style linków i popupów */
.pdf-link {
    color: #d32f2f !important;
    text-decoration: none;
    font-weight: bold;
}

.pdf-link:hover {
    color: #b71c1c !important;
    text-decoration: underline;
}

.image-link {
    color: #2e7d32 !important;
    text-decoration: none;
    font-weight: bold;
}

.image-link:hover {
    color: #1b5e20 !important;
    text-decoration: underline;
}

.leaflet-popup-content {
    line-height: 1.4;
}

.leaflet-popup-content a {
    color: #1976d2;
}

/* Narzędzia do rysowania */
.leaflet-control-layers-drawing {
    border-top: 1px solid #ccc;
    margin-top: calc(var(--base-font-size) * 1);
    padding-top: calc(var(--base-font-size) * 1);
    line-height: 1.2;
}

.leaflet-control-layers-drawing label {
    font-weight: bold;
    display: block;
    margin-bottom: calc(var(--base-font-size) * 0.75);
    color: #333;
    line-height: 1.2;
}

.drawing-tools {
    font-size: var(--base-font-size);
    line-height: 1.1;
}

.mode-switcher {
    margin-bottom: calc(var(--base-font-size) * 0.75);
    padding: calc(var(--base-font-size) * 0.375);
    background-color: #f5f5f5;
    border-radius: calc(var(--base-font-size) * 0.375);
    line-height: 1.1;
}

.mode-switcher span {
    font-weight: bold;
    margin-right: calc(var(--base-font-size) * 0.5);
    font-size: var(--base-font-size);
    line-height: 1.1;
}

.mode-switcher label {
    display: inline-block;
    margin: 0 calc(var(--base-font-size) * 0.375) 0 0;
    font-weight: normal;
    font-size: calc(var(--base-font-size) * 0.875);
    line-height: 1.1;
    vertical-align: middle;
}

.mode-switcher input[type="radio"] {
    margin: 0 calc(var(--base-font-size) * 0.125) 0 0;
    transform: scale(0.7);
    vertical-align: middle;
}

.drawing-controls {
    margin: calc(var(--base-font-size) * 0.5) 0;
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--base-font-size) * 0.25);
    line-height: 1;
}

.drawing-controls button {
    padding: calc(var(--base-font-size) * 0.375) calc(var(--base-font-size) * 0.75);
    margin: 0;
    font-size: calc(var(--base-font-size) * 0.875);
    border: 1px solid #ccc;
    background-color: #f8f8f8;
    border-radius: calc(var(--base-font-size) * 0.375);
    cursor: pointer;
    flex: 1;
    min-width: 45px;
    line-height: 1.1;
    height: 22px;
}

.drawing-controls button:hover {
    background-color: #e8e8e8;
}

.drawing-controls button.active {
    background-color: #4CAF50;
    color: white;
    border-color: #45a049;
}

.drawing-settings {
    margin: calc(var(--base-font-size) * 0.5) 0;
    display: flex;
    align-items: center;
    gap: calc(var(--base-font-size) * 0.5);
    flex-wrap: wrap;
    line-height: 1.1;
}

.drawing-settings label {
    display: flex;
    align-items: center;
    font-size: calc(var(--base-font-size) * 0.875);
    font-weight: normal;
    margin: 0;
    gap: calc(var(--base-font-size) * 0.25);
    line-height: 1.1;
}

.drawing-settings input[type="color"] {
    width: 22px;
    height: 16px;
    border: none;
    border-radius: calc(var(--base-font-size) * 0.25);
    cursor: pointer;
}

.drawing-settings input[type="range"] {
    width: 55px;
    height: 16px;
}

/* Drawing Tool Button Colors */
.btn-draw { 
    background-color: #2196F3 !important; 
    color: white !important; 
}

.btn-erase { 
    background-color: #f44336 !important; 
    color: white !important; 
}

.btn-undo { 
    background-color: #ff9800 !important; 
    color: white !important; 
}

.btn-clear { 
    background-color: #f44336 !important; 
    color: white !important; 
}

.btn-save { 
    background-color: #4CAF50 !important; 
    color: white !important; 
}

.btn-load { 
    background-color: #9C27B0 !important; 
    color: white !important; 
}

.btn-clear-storage { 
    background-color: #795548 !important; 
    color: white !important; 
}

.btn-calibration { 
    background-color: #607D8B !important; 
    color: white !important; 
}

.btn-export { 
    background-color: #00BCD4 !important; 
    color: white !important; 
}

.btn-clear-state { 
    background-color: #e91e63 !important; 
    color: white !important; 
    font-weight: bold !important;
    border: 2px solid #ad1457 !important;
    width: 100% !important;
    margin: 0.4vw 0 !important;
}

.btn-clear-state:hover { 
    background-color: #c2185b !important; 
    border-color: #880e4f !important;
}

/* Kontrolki mapy Leaflet */
.leaflet-control-mapcentercoord-icon {
  background: url(images/MapCenterCoordIcon1.svg) 30% 30% no-repeat;
  margin: -38px 0 0 -38px;
  width: 25px;
  height: 25px;
  left: 0%;
  top: 0%;
  content: '';
  display: block;
  position: absolute;
  z-index: 1000;
}

.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
	cursor: crosshair;
}

.leaflet-container .leaflet-control-mapcentercoord {
  bottom: 0px;
  left: 0px;
}

.leaflet-control-map-center-coord-container {
    margin-bottom: 0px;
    margin-left: 0px;
}

.leaflet-bottom.leaflet-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.leaflet-control-scale {
    margin-bottom: calc(var(--base-font-size) * 0.625);
    margin-left: calc(var(--base-font-size) * 0.625);
}

/* Style dla systemu logowania */
.auth-btn {
    padding: 0px;
    height: 26px;
    width: calc(var(--base-font-size) * 5);
    border: none;
    background: #28a745;
    color: white;
    border-radius: calc(var(--base-font-size) * 0.375);
    cursor: pointer;
    font-size: var(--base-font-size);
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
}

.auth-btn:hover {
    background: #218838;
}

.logout-btn {
    background: #dc3545;
    width: calc(var(--base-font-size) * 5.5);
}

.logout-btn:hover {
    background: #c82333;
}

.user-info {
    display: none;
    align-items: center;
    gap: calc(var(--base-font-size) * 0.5);
    flex-shrink: 0;
}

#userEmail {
    color: white;
    font-size: calc(var(--base-font-size) * 0.9);
    font-weight: bold;
    white-space: nowrap;
}

/* Style dla modala logowania */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover {
    color: black;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: var(--base-font-size);
}

.error-message {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    border: 1px solid #ffcdd2;
    font-size: calc(var(--base-font-size) * 0.9);
}

.login-btn {
    width: 100%;
    padding: 10px;
    background-color: #0078A8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--base-font-size);
    font-weight: bold;
}

.login-btn:hover {
    background-color: #005f8a;
}

.login-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #e3f2fd;
    border-radius: 4px;
    font-size: calc(var(--base-font-size) * 0.8);
    color: #333;
}

.login-info p {
    margin: 0;
    text-align: left;
}

/* Style dla statystyk logowań */
.login-stats-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10001;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

.login-stats-container.visible {
    display: block;
}

.stats-section h4 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #0078A8;
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #0078A8;
}

.stat-label {
    font-weight: bold;
    color: #555;
}

.stat-value {
    font-weight: bold;
    color: #0078A8;
    font-size: 1.2em;
}

.recent-logins {
    margin: 20px 0;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.recent-logins h5 {
    margin-bottom: 10px;
    color: #333;
}

.login-record {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.login-time {
    font-size: 0.9em;
    color: #666;
}

.login-email {
    font-weight: bold;
    color: #333;
}

.stats-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.stats-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    flex: 1;
}

.stats-btn {
    background: #0078A8;
    color: white;
}

.stats-btn:hover {
    background: #005f8a;
}

.clear-btn {
    background: #dc3545;
}

.clear-btn:hover {
    background: #c82333;
}

/* Przycisk otwierający statystyki */
#showStatsButton {
    padding: 0px;
    height: 26px;
    width: 15px;
    border: none;
    background: #28a745;
    color: white;
    border-radius: calc(var(--base-font-size) * 0.375);
    cursor: pointer;
    font-size: var(--base-font-size);
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
}

#showStatsButton:hover {
    background: #5a2d91;
}

/* Responsywność */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-actions {
        flex-direction: column;
    }
    
    #showStatsButton {
        flex: 1;
        margin: 0;
        min-width: 15px;
        font-size: calc(var(--base-font-size) * 0.9);
    }
}

/* Responsywność dla przycisków logowania */
@media (max-width: 768px) {
    .auth-btn {
        flex: 1;
        margin: 0;
        min-width: 60px;
        font-size: calc(var(--base-font-size) * 0.9);
    }
    
    .user-info {
        flex-direction: column;
        gap: calc(var(--base-font-size) * 0.25);
    }
    
    #userEmail {
        font-size: calc(var(--base-font-size) * 0.8);
    }
}
/* Media queries - responsywność */

    

@media (max-width: 768px) {	
    
    #search-container {
        width: 100%;
        flex: 1 1 100%;
        height: auto;
        padding: calc(var(--base-font-size) * 0.25) calc(var(--base-font-size) * 0.1);
        gap: calc(var(--base-font-size) * 0.1);
        min-width: 25%;
    }     
    
    #search-input {
        width: 100%;
        flex: 1 1 100%;
        margin-bottom: 0;
        max-width: 100%;
        min-width: 25%;
    }
    
    #clear-search-button {
        flex: 1;
        margin: 0;
        min-width: 15px;
    }    
	#download-apk-button{
        flex: 1;
        margin: 0;
        min-width: 75px;
    }    
    #search-button {
        flex: 1;
        margin: 0;
        min-width: 45px;
    }    
}
