/* General Style */
html, body { 
    height: 100%; 
}

body { 
    font-family: 'Open Sans', sans-serif; 
    margin: 0; 
    background-color: #f9f9f9; 
    color: #333;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex-grow: 1;
    max-width: 1300px; /* Dodaj max-width */
    margin: 0 auto; /* Dodaj wyśrodkowanie */
    padding: 0 10px; /* Dodaj padding */
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Arrange children vertically */
}

h1 { 
    color: #222; 
    text-align: center; 
    margin-top: 0;
    margin-bottom: 0; 
}

h2 {
    color: #222; /* Ciemny kolor tekstu */
    text-align: center; /* Wyśrodkowanie */
    margin-top: 20px; /* Margines górny */
    margin-bottom: 15px; /* Margines dolny */
    font-size: 28px; /* Rozmiar czcionki, nieco mniejszy niż domyślny H1 */
    font-weight: 600; /* Pogrubienie */
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 10px;
}

#app-container {
    /* Container for the whole app */
}

/* Layout Grid */
#main-content-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr; /* Adjusted ratio */
    gap: 25px;
    max-width: 1300px;
    margin: 10px auto;
    padding: 0 10px;
    /* min-height removed for flexibility */
}

/* Form Styles */
form {
    background-color: #fff;
    padding: 25px;
    border-radius: 6px;
    /* Enhanced shadow for forms */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    height: 480px; /* Fixed height */
    overflow-y: auto;
    position: relative;
    width: 100%; /* Ensure form takes full available width */
    box-sizing: border-box; /* Include padding in width calculation */
}

label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 600; /* Slightly bolder */
}

input[type="text"], 
input[type="number"], 
input[type="file"],
select { 
    width: 100%; 
    padding: 5px; 
    margin-bottom: 10px; 
    border: 1px solid #ccc; 
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="date"],
input[type="time"] {
    padding: 4px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="range"] {
    width: 100%;
}

button { 
    background-color: #007bff; 
    color: white; 
    padding: 12px 18px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.1s ease; /* Added transitions */
    /* Subtle 3D effect for buttons */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
}

button:hover { 
    background-color: #0056b3; 
    box-shadow: 0 6px 10px rgba(0,0,0,0.15), 0 2px 5px rgba(0,0,0,0.12); /* Enhanced shadow on hover */
    transform: translateY(-1px); /* Slight lift effect */
}

button:active {
    transform: translateY(0); /* Press effect */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.08);
}

/* Specific Groups */
.form-group { 
    margin-bottom: 10px; 
}

.km-input-group {
    display: flex;
    align-items: center;
    gap: 10px; /* Adjust as needed */
    margin-bottom: 5px; /* To match form-group spacing */
}
.km-input-group label {
    margin-bottom: 0; /* Override default label margin */
    flex-shrink: 0; /* Prevent label from shrinking */
    display: inline-flex; /* Ensure it behaves as inline-flex */
}
.km-input-group select {
    width: auto; /* Override 100% width */
    min-width: 60px; /* Ensure it's wide enough */
    flex-shrink: 0; /* Prevent select from shrinking */
    flex-grow: 0; /* Prevent select from growing */
    display: inline-flex; /* Ensure it behaves as inline-flex */
}

.aid-station-buttons-group {
    display: flex;
    gap: 10px;
}

#open_manual_entry_modal, #open_csv_upload_modal, #export_csv_button {
    flex-grow: 1;
    font-size: 14px;
    background-color: #6c757d; /* Secondary button color */
}
#open_manual_entry_modal:hover, #open_csv_upload_modal:hover {
    background-color: #5a6268;
}

.gpx-label-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align items to the start */
    gap: 10px; /* Add a gap between the label and the input */
    margin-bottom: 10px;
}

.file-input-group input[type="file"] {
    width: auto;
    margin-bottom: 10;
}

.file-input-group button {
    display: block;
    width: 100%;
}

/* Custom File Input Styling */
.custom-file-input {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    background-color: #fff;
    box-sizing: border-box;
    width: 100%; /* Changed to 100% width */
    max-width: 310px;
    margin-bottom: 10px;
    text-overflow: ellipsis;
}

.gpx-label-input-wrapper label {
    flex-shrink: 0; /* Prevent label from shrinking */
}

.custom-file-input:hover {
    border-color: #007bff;
}

.custom-file-input span {
    flex-grow: 1;
    padding: 0;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-file-input .choose-file-button {
    flex-shrink: 0;
    background-color: #007bff;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 8px; /* Added margin to the right of the button */
    width: auto; /* Override 100% width */
}

.custom-file-input .choose-file-button:hover {
    background-color: #0056b3;
}

/* Map and Profile */
.map-and-profile-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Reduced gap */
    padding-top: 10px;
}

.grid-span-2 {
    grid-column: 1 / -1; /* Spans from the first column line to the last */
}

#map-container {
    height: 450px; /* Fixed height */
    background-color: #e9e9e9;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#gpx-summary-container {
    text-align: center;
    padding: 0;
    margin: 0;
    line-height: 0.3;
}

#elevation-profile-container {
    text-align: center;
    display: none; /* Controlled by JS */
    margin-top: 20px; /* Space below map/form */
    box-sizing: border-box;
    overflow: hidden;
}

#gpxChart {
    width: 100%;
    max-width: 100%; /* Ensure it doesn't exceed parent width */
    height: 200px; /* Spłaszczony wykres */
    display: block;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Output/Download Section */
.output-section { 
    margin-top: 30px; 
    padding: 20px; 
    background-color: #fff; 
    border-radius: 6px; 
    /* Enhanced shadow for output section */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 600px; 
    margin: 30px auto; 
}
.output-section h2 { 
    color: #222; 
}
.output-section a { 
    display: inline-block; 
    background-color: #007bff; 
    color: white; 
    padding: 10px 15px; 
    border-radius: 4px; 
    text-decoration: none; 
    margin-right: 10px; 
    margin-bottom: 10px; 
}
.output-section a:hover { 
    background-color: #0056b3; 
}
.error-message { 
    color: #dc3545; 
    font-weight: bold; 
    margin-top: 10px; 
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    padding-top: 0px; /* Further reduced padding-top */
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto; /* Reduced margin */
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    border-radius: 6px;
    position: relative;
    /* Enhanced shadow for modal content */
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Table styles for modal */
#aid-station-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    /* Subtle shadow for the table itself */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
#aid-station-table th, #aid-station-table td {
    border: 1px solid #ddd;
    padding: 4px 8px; /* Reduced vertical padding */
    text-align: left;
}
#aid-station-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}
#aid-station-table input[type="text"],
#aid-station-table input[type="number"] {
    width: 100%;
    padding: 6px;
    border: none; /* Removed border */
    border-radius: 0; /* Removed border-radius */
    box-sizing: border-box;
    margin-bottom: 0;
    background-color: transparent; /* Ensure no background color */
}
#aid-station-table input[type="text"]:focus,
#aid-station-table input[type="number"]:focus {
    outline: none; /* Remove focus outline */
}
#aid-station-table button.remove-station-row {
    padding: 5px 10px;
    font-size: 14px;
    margin-bottom: 0;
    background-color: #dc3545; /* Red for delete */
}
#aid-station-table button.remove-station-row:hover {
    background-color: #c82333;
}

/* Time Input Group Styles */
.time-input-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-selectors {
    display: flex;
    align-items: center;
    gap: 5px; /* For spacing between selects */
}

.time-selectors select {
    width: auto; /* Override the 100% width */
    min-width: 60px; /* Give them a bit of space */
    margin-bottom: 0; /* Remove default bottom margin */
}

/* Label-Value Group for Sliders */
.label-value-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-value-group label {
    margin-bottom: 0; /* Remove bottom margin from label inside this group */
}

.label-value-group span {
    font-weight: 600;
    font-size: 1.1em;
}

/* Header Styles */
.main-header {
     padding: 5px 0; /* Vertical padding */
     background-color: #f9f9f9;
     border-bottom: 1px solid #bbb; /* More prominent line */
     position: sticky;
     top: 0;
     z-index: 1000;
}
.main-header .header-grid {
    display: grid;
    grid-template-columns: 200px 1fr 200px; /* Lewa i prawa kolumna 200px, środkowa zajmuje resztę */
    align-items: center;
    gap: 20px; /* Odstęp między kolumnami */
    border: none;
}

 

.grid-col-left,
.grid-col-right,
.grid-col-center {
    /* Możesz tutaj dodać minimalną szerokość, jeśli potrzebujesz, aby zmieściły się bez zawijania */
    /* np. min-width: 150px; */
    border: none;
}

.grid-col-center {
    text-align: center; /* Wyśrodkowanie zawartości (H1) */
}

.logo-container .logo-img {
    max-height: 45px; /* Adjusted height */
    width: auto;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px; /* Increased space between menu items */
}

.main-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 16px;
    transition: color 0.2s ease-in-out;
}

.main-nav a:hover {
    color: #007bff;
}

.grid-col-center h1 a {
    text-decoration: none;
    color: inherit; /* Inherit color from h1 */
}

/* Footer Styles */
.main-footer {
    padding: 10px 0; /* Vertical padding */
    margin-top: auto; /* Pushes footer to the bottom in a flex container */
    background-color: #f8f9fa;
    border-top: 1px solid #e7e7e7;
    position: sticky;
    bottom: 0;
    z-index: 1000;
}


.main-footer .container {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

.main-footer .container p {
    margin: 0; /* Usuń domyślne marginesy paragrafu */
    line-height: 1; /* Zmniejsz wysokość linii do minimum */
}


/* Styling for the results table */
.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th, .results-table td {
    border-bottom: 1px solid #ddd;
    padding: 6px 8px; /* Adjusted padding */
    text-align: left;
}

.results-table th {
}

/* Specific styling for the 'Punkt' column (assuming it's the first column) */
.results-table th:nth-child(1),
.results-table td:nth-child(1) {
    min-width: 150px; /* Adjust as needed */
    white-space: nowrap; /* Prevent text wrapping */
}

/* Tooltip Styles */
.info-tooltip-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left: 5px; /* Space between label and icon */
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #007bff; /* Blue background for the icon */
    color: white;
    /* font-size: 12px; */
    /* font-weight: bold; */
    font-family: 'Material Icons';
    cursor: pointer;
    user-select: none; /* Prevent text selection */
}

.tooltip-content {
    visibility: hidden; /* Hidden by default */
    width: 300px; /* Adjusted width */
    background-color: #e6e3e3;
    color: #000000;
    text-align: center;
    border-radius: 3px;
    padding: 4px 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%; /* Position the tooltip above the icon */
    left: 50%;
    margin-left: -70px; /* Center the tooltip based on new width */
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    font-size: 1em !important; /* Slightly smaller font size */
    line-height: 1.2em;
}

/* Arrow for the tooltip */
.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

/* Show the tooltip on hover */
.info-tooltip-wrapper:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.detail-level-selectors {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between dropdowns */
}

.detail-level-selectors select {
    width: auto; /* Adjust width based on content */
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.9em;
}

.detail-level-selectors label {
    white-space: nowrap; /* Prevent label from wrapping */
    margin-right: 5px;
}

/* Loading Modal Styles */
#loadingModal .modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 20px;
    max-width: 300px; /* Smaller width for loading modal */
}

.loader {
    border: 8px solid #f3f3f3; /* Light grey */
    border-top: 8px solid #007bff; /* Blue */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1.5s linear infinite;
}

#loadingMessage {
    font-size: 1.2em;
    font-weight: 600;
    color: #555;
}

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

/* Dropdown Button */
.dropbtn {
    padding: 16px;
    font-size: 16px;
    border: none;
    cursor: pointer;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

/* Links inside the dropdown */
.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {
    background-color: #f1f1f1;
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
    display: block;
}/* --- Responsive Design Adjustments --- */

/* General adjustments for smaller screens */
@media (max-width: 1300px) {
    body {
        font-size: 16px; /* Adjust base font size for readability on mobile */
    }

    .results-table th:nth-child(1),
    .results-table td:nth-child(1),
    .results-table th:nth-child(2),
    .results-table td:nth-child(2) {
        min-width: unset; /* Allow columns to shrink */
        white-space: normal; /* Allow text to wrap */
    }

    h1 {
        font-size: 2em; /* Slightly smaller h1 */
    }

    h2 {
        font-size: 1.5em; /* Slightly smaller h2 */
    }

    .content-wrapper {
        padding: 0 15px; /* More padding on sides for smaller screens */
    }

    /* Main content grid - switch to single column */
    #main-content-grid {
        grid-template-columns: 1fr; /* Stack columns vertically */
        gap: 20px; /* Adjust gap */
        padding: 0; /* Remove horizontal padding */
    }

    /* Form and Map container height adjustments */
    form {
        height: auto; /* Remove fixed height */
        max-height: none; /* Ensure no max-height constraint */
        overflow-y: visible; /* Allow content to expand */
        padding: 5px; /* Adjust padding */
    }

    #map-container {
        height: 300px; /* Reduce map height for mobile */
    }

    /* Header grid - stack elements */
    .main-header .header-grid {
        grid-template-columns: 1fr; /* Stack all header elements */
        gap: 10px; /* Reduce gap */
        text-align: center; /* Center content */
    }

    .grid-col-left,
    .grid-col-right,
    .grid-col-center {
        text-align: center; /* Ensure all columns are centered */
    }

    .main-nav ul {
        justify-content: center; /* Center navigation items */
        flex-wrap: wrap; /* Allow navigation items to wrap */
        gap: 15px; /* Adjust gap */
    }

    /* Table responsiveness - allow horizontal scrolling */
    /* Apply this to a wrapper around your tables if they are not already wrapped */
    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%; /* Use more width on smaller screens */
        margin: 10px auto; /* Adjust margin */
        padding: 10px; /* Adjust padding */
    }

    #aid-station-table th, #aid-station-table td {
        padding: 8px 5px; /* Adjust table cell padding */
        font-size: 0.9em; /* Slightly smaller font in tables */
    }

    /* Time input group - allow wrapping */
    .time-input-group {
        flex-direction: column; /* Stack label and inputs */
        align-items: flex-start; /* Align items to the start */
    }

    .time-selectors {
        width: 100%; /* Take full width */
        justify-content: space-between; /* Distribute space */
        margin-top: 5px; /* Add some space from label */
    }

    .time-selectors select {
        flex-grow: 1; /* Allow selects to grow */
        min-width: unset; /* Remove min-width constraint */
    }

    /* Custom file input adjustments */
    .custom-file-input {
        flex-direction: column; /* Stack button and file name */
        align-items: flex-start;
        max-width: 100%; /* Use full width */
    }

    .custom-file-input .choose-file-button {
        width: 100%; /* Make button full width */
        margin-right: 0;
        margin-bottom: 10px; /* Space between button and file name */
    }

    .custom-file-input span {
        width: 100%; /* Make span full width */
        text-align: center; /* Center file name */
    }

    /* Tooltip adjustments for smaller screens */
    .tooltip-content {
        width: 250px; /* Smaller width for tooltips */
        left: 50%;
        margin-left: -125px; /* Center the tooltip */
        bottom: 100%; /* Position above */
    }

    .tooltip-content::after {
        left: 50%;
        margin-left: -5px;
    }

    /* Buttons */
    button {
        padding: 10px 15px; /* Slightly smaller padding for buttons */
        font-size: 14px; /* Slightly smaller font for buttons */
    }

    /* SEO description section */
    .seo-description-section {
        padding: 15px; /* Adjust padding */
    }
}

/* Further adjustments for very small mobile screens (e.g., iPhone SE) */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .results-table th:nth-child(1),
    .results-table td:nth-child(1),
    .results-table th:nth-child(2),
    .results-table td:nth-child(2) {
        min-width: unset; /* Allow columns to shrink */
        white-space: normal; /* Allow text to wrap */
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.3em;
    }

    .content-wrapper {
        padding: 0 10px;

    }

    #main-content-grid {
        gap: 15px;
        padding: 0; /* Remove horizontal padding */
    }

    #map-container {
        height: 250px; /* Even smaller map height */
    }

    .modal-content {
        width: 98%;
        margin: 5px auto;
        padding: 10px;
    }

    #aid-station-table th, #aid-station-table td {
        padding: 6px 3px;
        font-size: 0.85em;
    }

    .time-selectors select {
        font-size: 0.9em;
    }

    button {
        padding: 8px 12px;
        font-size: 13px;
    }
}