body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #333;
    -webkit-text-size-adjust: 100%;
}

#stundenzettel-container {
    width: 100%;
    max-width: 210mm;
    min-height: 297mm;
    padding: 10mm 15mm 20mm;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

header h1 {
    text-align: center;
    text-decoration: underline;
    font-size: 24px;
    margin-bottom: 10px;
}

.info-fields {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.info-fields .field {
    display: flex;
    align-items: center;
}

.info-fields label {
    margin-right: 10px;
}

#name-input,
#month-input {
    border: none;
    border-bottom: 1px solid black;
    width: 200px;
    font-size: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

th,
td {
    border: 1px solid black;
    padding: 2px 4px;
    text-align: center;
    font-size: 13px;
    color: #666;
    vertical-align: middle;
    position: relative;
}

th {
    background-color: #f2f2f2;
    color: #333;
}

.tag {
    width: 8%;
    color: #333;
    position: relative;
}
.zeit {
    width: 18%;
}
.gesamt {
    width: 20%;
}

td input[type="time"] {
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 90%;
    font-family: Arial, sans-serif;
    font-size: 13px;
    text-align: center;
    background-color: transparent;
    color: #333;
    vertical-align: middle;
    box-sizing: border-box;
    padding: 1px;
    height: 20px;
    line-height: 18px;
    margin: 0;
}

.daily-total {
    background-color: #e9e9e9;
    font-weight: bold;
    color: #333;
}

footer {
    margin-top: auto;
}

.totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 50px;
    font-size: 16px;
}

.total-field {
    margin-left: 40px;
    text-align: right;
}

.total-field span {
    display: inline-block;
    min-width: 60px;
    padding: 0 5px;
    border-bottom: 1px solid black;
}

.total-field span:first-child {
    border-bottom: none;
}

.signatures {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
}

.signature-box {
    width: 45%;
    border-top: 1px solid black;
    padding-top: 5px;
    font-size: 12px;
}

.controls {
    margin-top: 20px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

#hourly-rate {
    width: 80px;
    padding: 5px;
    font-size: 16px;
}

#export-pdf,
#save-current-sheet,
#clear-form,
#help-button,
.saved-sheet-item button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

#export-pdf:hover,
#save-current-sheet:hover,
#clear-form:hover,
#help-button:hover,
.saved-sheet-item button:hover {
    background-color: #0056b3;
}

#clear-form {
    background-color: #6c757d;
}

#clear-form:hover {
    background-color: #5a6268;
}

.saved-sheet-item button.delete-btn {
    background-color: #dc3545;
}

.saved-sheet-item button.delete-btn:hover {
    background-color: #c82333;
}

.saved-sheet-item button.rename-btn {
    background-color: #ffc107;
    color: #333;
}

.saved-sheet-item button.rename-btn:hover {
    background-color: #e0a800;
}

#copyright-notice {
    margin-top: 25px;
    font-size: 14px;
    color: #888;
    text-align: center;
}

#copyright-notice a {
    color: #555;
    text-decoration: none;
}

#copyright-notice a:hover {
    text-decoration: underline;
}

#saved-sheets-container {
    margin-top: 20px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 210mm;
    box-sizing: border-box;
}

#saved-sheets-container h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 20px;
    color: #333;
}

#saved-sheets-list {
    list-style: none;
    padding: 0;
}

.saved-sheet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.saved-sheet-item:last-child {
    border-bottom: none;
}

.saved-sheet-item .sheet-name {
    flex-grow: 1;
    font-size: 16px;
    color: #555;
    margin-right: 10px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-sheet-item .sheet-name.editable {
    border-bottom: 1px dashed #ccc;
}

.saved-sheet-item .saved-at-timestamp {
    font-size: 12px;
    color: #888;
    margin-left: 10px;
    white-space: nowrap;
}

.saved-sheet-item button {
    font-size: 14px;
    padding: 6px 12px;
    margin-left: 8px;
}

.duplicate-row-btn {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 1;
    font-size: 18px;
    color: #28a745;
    cursor: pointer;
    margin-left: 5px;
    vertical-align: middle;
    transition: transform 0.1s ease-in-out;
}

.duplicate-row-btn:hover {
    transform: scale(1.1);
}

.duplicate-row-help {
    font-size: 0.8em;
    color: #666;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
}

/* General Modal Styles (for both Help and Custom Dialog) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    display: flex; /* Use flex for internal layout (nav + body) */
    flex-direction: column;
}

.modal-content h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.modal-content h3 {
    color: #007bff;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-content ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-content ul ul {
    list-style-type: circle;
    margin-left: 20px;
    margin-top: 5px;
}

.modal-content p {
    margin-bottom: 10px;
    line-height: 1.5;
}


.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
}

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

/* Custom Alert/Confirm specific styles */
.small-modal {
    max-width: 400px;
    text-align: center;
}

.small-modal #dialog-message {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #333;
    font-weight: normal;
}

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

.dialog-button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.confirm-button {
    background-color: #007bff;
    color: white;
}

.confirm-button:hover {
    background-color: #0056b3;
}

.cancel-button {
    background-color: #6c757d;
    color: white;
}

.cancel-button:hover {
    background-color: #5a6268;
}

/* Toast Notification Styles */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: rgba(50, 50, 50, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    max-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    pointer-events: all;
    font-size: 0.9em;
    line-height: 1.4;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Toast type specific colors */
.toast.success {
    background-color: rgba(40, 167, 69, 0.9);
}

.toast.error {
    background-color: rgba(220, 53, 69, 0.9);
}

.toast.info {
    background-color: rgba(23, 162, 184, 0.9);
}

/* Help Modal specific styles (new navigation) */
.modal-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    gap: 5px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.modal-nav .nav-button {
    background-color: #f2f2f2;
    color: #333;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 5px 5px 0 0; /* Rounded top corners */
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.9em;
    white-space: nowrap; /* Prevent button text from wrapping */
}

.modal-nav .nav-button:hover {
    background-color: #e0e0e0;
}

.modal-nav .nav-button.active {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    border-bottom: 3px solid #0056b3; /* Highlight active tab */
}

.modal-nav .nav-button.active:hover {
    background-color: #0056b3;
}

.modal-body {
    flex-grow: 1; /* Allow body to take available space */
    padding-top: 10px; /* Space between nav and content */
}

.modal-section {
    display: none; /* Hide all sections by default */
}

.modal-section.active {
    display: block; /* Show active section */
}

.modal-section h3 {
    text-align: center;
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #333; /* Make section titles clearer */
}

.modal-section ul, .modal-section ol, .modal-section dl {
    margin-bottom: 20px;
}

.modal-section dt {
    font-weight: bold;
    margin-top: 10px;
    color: #333;
}

.modal-section dd {
    margin-left: 20px;
    margin-bottom: 5px;
    color: #555;
}


/* Styles applied when preparing for PDF export */
.pdf-export-view {
    width: 210mm !important;
    height: 297mm !important;
    padding: 10mm 15mm 20mm !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.pdf-export-view input[type="time"] {
    border: 1px solid transparent !important;
    background-color: white !important;
    color: black !important;
    padding: 1px !important;
    height: 20px !important;
    line-height: 18px !important;
    vertical-align: middle !important;
    box-shadow: none !important;
}

.pdf-export-view .duplicate-row-btn,
.pdf-export-view .duplicate-row-help,
.pdf-export-view .modal,
.pdf-export-view #toast-container {
    display: none !important;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    #stundenzettel-container {
        padding: 15px;
        min-height: 0;
    }

    header h1 {
        font-size: 20px;
    }

    .info-fields {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #name-input,
    #month-input {
        width: 100%;
    }

    th,
    td {
        font-size: 11px;
        padding: 2px;
    }

    td input[type="time"] {
        width: 100%;
        font-size: 11px;
    }

    .totals {
        flex-direction: column;
        align-items: flex-end;
        gap: 10px;
        margin-bottom: 30px;
    }

    .total-field {
        margin-left: 0;
        font-size: 14px;
    }

    .signatures {
        flex-direction: column;
        gap: 30px;
    }

    .signature-box {
        width: 100%;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
    }

    .saved-sheet-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .saved-sheet-item button {
        margin-left: 0;
        width: 100%;
    }

    /* Modal adjustments for smaller screens */
    .modal-content {
        width: 95%;
        padding: 15px;
        max-height: 95vh;
    }

    .close-button {
        font-size: 24px;
        top: 5px;
        right: 10px;
    }

    .dialog-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .dialog-button {
        width: 100%;
    }

    /* Toast adjustment for smaller screens */
    #toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: unset;
    }

    .toast {
        max-width: unset;
        width: auto;
    }

    /* Help modal navigation on small screens */
    .modal-nav {
        flex-direction: column;
        gap: 0;
    }

    .modal-nav .nav-button {
        border-radius: 0;
        border-bottom: 1px solid #ddd;
        width: 100%;
        text-align: left;
    }

    .modal-nav .nav-button.active {
        border-left: 5px solid #0056b3;
        border-bottom: 1px solid transparent; /* Override bottom border from general rule */
    }
}