body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7fc;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 20px;
}

#app {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 20px 30px;
    width: 90%;
    max-width: 640px;
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

header h1 {
    color: #0056b3; 
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* Settings header now uses the default header styles */
/* #settings-view header {
    margin-bottom: 0; 
} */

.gear-icon {
    font-size: 1.6em;
}

.back-icon {
    font-size: 2em; /* Increased size */
    font-weight: bold; /* Make it bolder */
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

button:disabled, .disabled-button {
    background-color: #b0b0b0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.7;
}

.action-button {
    font-weight: 600;
    min-width: 100px;
}

#start-button {
    background-color: #28a745;
}

#start-button:hover {
    background-color: #218838;
}

#stop-button {
    background-color: #dc3545;
}

#stop-button:hover {
    background-color: #c82333;
}

#settings-button {
    background-color: transparent;
    color: #6c757d;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    box-shadow: none;
}

#settings-button:hover {
    background-color: transparent;
    color: #5a6268;
    transform: none;
    box-shadow: none;
}

#back-button {
    background-color: transparent;
    color: #6c757d;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    padding: 0;
    margin-left: 15px;
    box-shadow: none;
}

#back-button:hover {
    background-color: transparent;
    color: #5a6268;
    transform: none;
    box-shadow: none;
}

.small-button {
    padding: 5px 10px;
    font-size: 0.9em;
}

h2, h3, h4 {
    color: #007bff;
    margin-top: 0;
    margin-bottom: 15px;
}

h2 {
    font-size: 1.4em;
    border-bottom: 1px solid #e7f3ff;
    padding-bottom: 5px;
}

h3 {
    font-size: 1.2em;
}

h4 {
    font-size: 1.1em;
}

.input-group {
    margin-bottom: 20px;
}

.input-group:nth-child(5) {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.input-group input[type="number"],
.input-group input[type="text"],
.input-group select {
    width: calc(100% - 22px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus,
.input-group select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.profile-selector {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    padding: 0;
    margin-top: 5px;
}

.profile-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    padding-left: 2px;
}

.main-profile-name {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #0056b3;
    border-radius: 8px;
    background-color: #e7f3ff;
    color: #0056b3;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.main-profile-name:hover {
    background-color: #d1e7ff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.button-group button {
    flex: 1;
}

.button-container {
    position: relative;
    margin-bottom: 20px;
    width: 100%;
}

#result-view {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #e7f3ff;
    border-left: 5px solid #007bff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#result-view h2 {
    margin-top: 0;
    color: #0056b3;
    border-bottom: none;
}

#result-view p {
    margin: 8px 0;
    font-size: 1.1em;
}

#result-view span {
    font-weight: bold;
    color: #0056b3;
}

.charging-curve-container {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.charging-curve-container h3 {
    margin-top: 5px;
    margin-bottom: 10px;
    text-align: center;
}

canvas {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
}

#current-settings-display {
    margin-top: 20px;
    font-size: 0.9em;
    color: #666;
    text-align: center;
    border-top: 1px dashed #ccc;
    padding-top: 15px;
}

#current-settings-display span {
    font-weight: bold;
    color: #333;
}

#settings-view {
    /* border-top: 2px solid #e0e0e0; */ /* Removed top border */
    padding-top: 0; /* Remove top padding */
    margin-top: 0; /* Remove top margin */
}

.profiles-list {
    display: flex;
    margin-bottom: 20px;
}

.profiles-list select {
    flex-grow: 1;
    margin-right: 10px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    height: 150px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.profile-actions button {
    margin-bottom: 5px;
}

.charging-curve-table {
    margin-bottom: 20px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

th, td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f1f1f1;
    font-weight: 600;
}

td input {
    width: 90%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.segment-actions {
    display: flex;
    justify-content: space-around;
}

.segment-actions button {
    padding: 3px 8px;
    font-size: 0.8em;
    min-width: auto;
}

.preview-curve-container {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.preview-curve-container h4 {
    text-align: center;
    margin-bottom: 10px;
}

.help-text {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 15px;
}

#profile-edit-container {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.profile-name-container {
    flex-grow: 1;
    margin: 0 10px;
    text-align: center;
    cursor: pointer;
}

.profile-name {
    display: inline-block;
    font-size: 1.2em;
    font-weight: bold;
    color: #0056b3;
    padding: 8px 15px;
    border: 2px solid #0056b3;
    border-radius: 8px;
    background-color: #e7f3ff;
    min-width: 60%;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    padding: 0;
    min-width: auto;
}

.delete-button {
    background-color: #dc3545;
}

.delete-button:hover {
    background-color: #c82333;
}

.add-button {
    background-color: #007bff;
}

.add-button:hover {
    background-color: #0056b3;
}

.profile-dropdown {
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin-top: 5px;
    box-sizing: border-box;
}

.profile-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.profile-option:hover {
    background-color: #e7f3ff;
}

.profile-option.selected-profile {
    background-color: #d1e7ff;
    font-weight: bold;
}

/* Make sure the name container has correct positioning */
.profile-name-container {
    position: relative;
}

/* Buttons in der Profileinstellungen */
.profile-actions-buttons button {
    flex: 1;
    font-size: 1.1em;
    font-weight: bold;
    padding: 12px;
}

#cancel-profile-button {
    background-color: #dc3545;
}

#cancel-profile-button:hover {
    background-color: #c82333;
}

.save-button {
    background-color: #28a745;
}

.save-button:hover {
    background-color: #218838;
}

.full-width-button {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
}

.full-width-button.stop {
    background-color: #dc3545;
}

.full-width-button.stop:hover {
    background-color: #c82333;
}

.full-width-slider {
    width: 100%;
    margin-bottom: 10px;
}

.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    font-weight: bold;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 10;
}

#result-view table {
    width: 100%;
    margin-top: 10px;
}

#result-view table td {
    padding: 8px 0;
    vertical-align: top;
}

#result-view table td:first-child {
    font-weight: bold;
    width: 180px; /* Adjust as needed */
}

/* Die alten Back-Button Stile wurden bereits ersetzt */

@media (min-width: 769px) {
    .save-button {
        width: auto;
        padding: 12px 20px; /* Adjusted vertical padding to match */
        margin: 10px 0;
    }
    #cancel-profile-button {
        margin: 10px 0; /* Add same margin to cancel button */
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 10px;
        padding-bottom: 20px;
    }
    
    #app {
        width: 95%;
        padding: 15px 20px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    h2 {
        font-size: 1.2em;
    }
    
    .profiles-list {
        flex-direction: column;
    }
    
    .profiles-list select {
        margin-right: 0;
        margin-bottom: 10px;
        height: 120px;
    }
    
    .profile-actions {
        flex-direction: row;
    }
    
    .profile-actions button {
        margin-right: 5px;
        margin-bottom: 0;
    }
    
    table {
        font-size: 0.9em;
    }
    
    th, td {
        padding: 6px 4px;
    }
}
