/* public/css/modal.css */

/* Modal Styles */
.meteolab-modal {
    display: none;
    position: fixed;
    z-index: 999999; /* Zwiększamy z-index */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.meteolab-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 1200px;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.meteolab-modal.active {
    display: block !important; /* Modal stanie się widoczny */
}

.meteolab-modal-close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.meteolab-modal-close:hover {
    color: #000;
}

/* Authentication Section */
.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.auth-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    opacity: 0.6;
}

.auth-tab.active {
    opacity: 1;
    border-bottom: 2px solid #2271b1;
}

.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Configuration Section */
.config-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
}

.map-section {
    position: relative;
}

#sensor-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 4px;
    overflow: hidden;
}

#cart-stats {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.datalogger-selection {
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cart-sensors {
    display: flex;
    flex-wrap: wrap; /* Umożliwia zawijanie wierszy */
    gap: 20px; /* Przerwa między elementami */
    justify-content: space-between; /* Rozsuwa elementy równomiernie */
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 0;
}

.cart-item {
    display: flex;
    flex-direction: column; /* Elementy wewnątrz każdego produktu (zdjęcie, nazwa, status) ułożone pionowo */
    align-items: center;
    justify-content: center; /* Wyśrodkowanie wertykalne */
    padding: 10px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
    min-height: 130px; /* Minimalna wysokość */
    box-sizing: border-box;
    text-align: center;
}


.cart-item-image {
    max-width: 70px;
    max-height: 70px;
    margin-bottom: 10px;
}

.cart-item-name {
    font-weight: bold;
    margin: 5px 0;
}

.cart-item-status {
    font-size: 0.9em;
    color: #666;
}

.checkout-button.needs-config {
    background-color: #f0ad4e !important;
    border-color: #eea236 !important;
}

.checkout-button.needs-config:hover {
    background-color: #ec971f !important;
    border-color: #d58512 !important;
}

/* Sensor List Items */
.sensor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
}

.sensor-item:hover {
    background: #f8f9fa;
}

.sensor-info {
    flex: 1;
}

.sensor-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.sensor-status {
    font-size: 0.9em;
    color: #666;
}

.sensor-actions {
    display: flex;
    gap: 10px;
}

/* Datalogger Selection Styles */
#datalogger-select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}












.cart-stats-section {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
    overflow-y: hidden; /* Ukrywa przewijanie na głównym kontenerze */
    height: 100%;
}

.sensors-list {
    flex: 1;
    overflow-y: auto; /* Umożliwia przewijanie listy sensorów */
    padding: 10px 0;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    margin-top: 20px; /* Dodaje odstęp nad przyciskami */
}

.cart-actions button {
    width: 100%;
    max-width: 200px;
    padding: 10px;
    margin: 5px 0;
    font-size: 16px;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
}

/* Default style for "Dodaj stację" button (disabled) */
#add-datalogger {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    position: relative;
}

/* Style when the "Dodaj stację" button is enabled */
#add-datalogger.enabled {
    background-color: #28a745;
    color: #fff;
    cursor: pointer;
}

/* Tooltip for disabled "Dodaj stację" button */
#add-datalogger:not(.enabled):hover::after {
    content: "Aby dodać stację, w koszyku musi znajdować się stacja.";
    width: 100%;
    position: absolute;
    bottom: 110%;
    left: 0;
    background-color: #333;
    color: #fff;
    padding: 5px;
    border-radius: 4px;
    font-size: 14px;
    white-space: normal;
    text-align: center;
    box-sizing: border-box;
    z-index: 1;
}


/* Styl dla przycisku "Zapisz konfigurację" */
#save-cart {
    background-color: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
}

#save-cart:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}













/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Styles */
@media (max-width: 768px) {
    .config-container {
        grid-template-columns: 1fr;
    }

    #sensor-map {
        height: 300px;
    }

    .meteolab-modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }

    .auth-form {
        padding: 0 20px;
    }
}


/* popup stacji na mapie */
.station-popup {
    font-family: Arial, sans-serif;
    font-size: 14px;
    max-width: 250px;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: #333;
    background-color: #f9f9f9;
    line-height: 1.5;
}

.station-popup h3 {
    font-size: 16px;
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.station-popup p {
    margin: 5px 0;
}

.station-popup ul {
    list-style-type: none;
    padding-left: 0;
    margin: 5px 0;
}

.station-popup ul li {
    padding: 3px 0;
    border-bottom: 1px solid #e0e0e0;
}

.station-popup ul li:last-child {
    border-bottom: none;
}

.station-popup select {
    width: 100%;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-top: 10px;
}

.station-popup button {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.station-popup button:hover {
    background-color: #2980b9;
}



/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000; /* Ensure it overlays everything */
}

.loading-content {
    text-align: center;
    font-size: 20px;
    animation: fadeIn 1.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* Stylowanie wiadomości w zakładce Rejestracja */
#register-form.auth-form {
    text-align: center;
    font-size: 16px;
    padding: 20px;
}

#register-form.auth-form p {
    margin-bottom: 10px;
}

#register-form.auth-form a {
    color: #007bff;
    text-decoration: none;
}

#register-form.auth-form a:hover {
    text-decoration: underline;
}





/* Modal Styles */
.modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Dla poprawy centrowania */
}

.modal-content {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    border-radius: 8px;
    text-align: center;
    z-index: 1001;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Dodanie cienia dla lepszego wyglądu */
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}