/* General Body and Typography */
body {
    font-family: 'Montserrat', sans-serif;
    font-size: 11pt;
    margin: 0;
    background-color: #f9f9f9;
}

h1 {
    margin-bottom: 5px;
}

a {
    color: #d1b95b;
    text-decoration: none;
    font-size: 14px;
}

a:hover {
    text-decoration: underline;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: 10px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 30px;
}

.header-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: #333;
    white-space: nowrap;
}

.language-select {
    font-size: 10pt;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.logout-icon {
    text-decoration: none;
    font-size: 1.8em;
    color: #333;
    line-height: 1;
}

.header-divider {
    border: none;
    height: 2px;
    background-color: #d1b95b;
    margin: 20px 0;
}

.main-content {
    padding: 0 10px 20px 10px;
    height: calc(100vh - 85px); /* Adjust based on header height */
    overflow-y: auto;
    overflow-x: auto; /* Enable horizontal scrolling on the main content area */
}

/* --- Filter and Search Controls --- */
.filter-container {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

.filter-group-left, .filter-group-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-wrapper {
    position: relative;
    flex: 1 1 60%; /* Allow growing and shrinking, with a base size of 60% */
    min-width: 200px; /* Ensure it doesn't get too small */
}

#searchInput, #monthInput, #yearInput, select#monthInput {
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 11pt;
    box-sizing: border-box;
    height: 40px; /* Enforce a consistent height */
}

#searchInput {
    width: 100%;
    padding: 10px 30px 10px 15px; /* Make space for the icon */
}

.filter-container select#monthInput {
    width: auto; /* Let the dropdown size to its content */
    padding: 0 10px;
}

#yearInput {
    max-width: 100px;
}

.clear-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 20px;
    display: none; /* Hidden by default */
}

/* --- Dropdown List Styling --- */
select option {
    background-color: #f9f9f9;
}

/* --- Buttons --- */
.save-button {
    display: inline-block;
    text-decoration: none;
    color: black;
    background-color: #d1b95b;
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-size: 11pt;
    box-sizing: border-box;
}

.save-button:hover {
    background-color: #b8a24b;
}

.revert-button {
    display: inline-block;
    text-decoration: none;
    color: black;
    background-color: #e0e0e0; /* Light gray */
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: 500;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 11pt;
    box-sizing: border-box;
}
.revert-button:hover {
    background-color: #d0d0d0;
}

.delete-button {
    display: inline-block;
    text-decoration: none;
    color: white;
    background-color: #D32F2F; /* Red for destructive action */
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-size: 11pt;
    box-sizing: border-box;
}
.delete-button:hover {
    background-color: #B71C1C;
}

.back-button {
    display: inline-block;
    text-decoration: none;
    color: black;
    background-color: #e0e0e0; /* Light gray */
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: 500;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 11pt;
    box-sizing: border-box;
    white-space: nowrap;
}
.back-button:hover {
    background-color: #d0d0d0;
}

/* --- Customer List Table (index.php) --- */
.customer-table {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table-container {
    overflow-x: auto; /* This is the key for horizontal scrolling */
    width: 100%;
}

.customer-table-body {
    max-height: 65vh; /* Set a max height relative to the viewport */
    overflow-y: auto; /* Add a vertical scrollbar when content overflows */
}

.customer-table-header, .customer-table-row {
    display: flex;
    background-color: #fff;
    border-bottom: 1px solid #eee; /* Add a thin line between rows */
}

.customer-table-row:last-child {
    border-bottom: none;
}

.customer-table-row:nth-child(even) {
    background-color: #f9f9f9;
}

.customer-table-header {
    font-weight: bold;
    background-color: #f2f2f2;
    position: sticky; /* Make the header sticky */
    top: 0; /* Stick to the top of the container */
    z-index: 10; /* Ensure it's above the scrolling content */
    color: #333;
}

.customer-cell {
    box-sizing: border-box; /* Ensure padding is included in the width */
    padding: 12px 15px;
    text-align: left; /* Default to left alignment */
    white-space: nowrap; /* Prevent text from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add '...' if content is too long */
    min-width: 100px; /* Give all cells a minimum width */
}

.details-row {
    background-color: #fafafa;
    padding: 15px 20px 15px 60px; /* Indent to align with content */
    border-bottom: 1px solid #ddd;
    font-size: 0.9em;
}

.expand-cell {
    width: 40px !important; /* Fixed width for the expander cell */
    text-align: center;
    padding-left: 5px;
    padding-right: 5px;
}

.expand-icon {
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    color: #777;
}

/* Define specific widths for each column */
.customer-cell:nth-child(2) { width: 250px; flex-shrink: 0; } /* Customer */
.customer-cell:nth-child(3) { width: 150px; flex-shrink: 0; } /* Responsible */
.customer-cell:nth-child(4) { width: 150px; flex-shrink: 0; } /* Holding */
.customer-cell:nth-child(5) { width: 150px; flex-shrink: 0; } /* Owner */
.customer-cell:nth-child(6),
.customer-cell:nth-child(7),
.customer-cell:nth-child(8),
.customer-cell:nth-child(9) { width: 100px; text-align: center; flex-shrink: 0; } /* Status and Report Icons */
.customer-cell:nth-child(10) { width: 150px; flex-shrink: 0; } /* Report Type */
.customer-cell:nth-child(11){ width: 100px; text-align: center; flex-shrink: 0; } /* Action */

.status-cell {
    text-align: center;
}

.customer-table .action-cell {
    position: sticky;
    right: 0;
    background-color: #fff; /* Default background for odd rows */
    border-left: 1px solid #ddd; /* Add a separator line */
}

.customer-table-header .action-cell {
    background-color: #f2f2f2; /* Match header background */
}

.customer-table-row:nth-child(even) .action-cell {
    background-color: #f9f9f9; /* Match even row background */
}

#tables-container {
    max-height: 70vh; /* Adjust this value as needed */
    overflow-y: auto;
    padding: 2px; /* Add a little space for the scrollbar */
}

.detail-table-header, .detail-table-row {
    align-items: flex-start;
    border-bottom: 1px solid #ddd;
    background-color: #fff;
    display: flex;
}

.detail-table-row:last-child {
    border-bottom: none;
}

.detail-table-header {
    font-weight: bold;
    background-color: #f2f2f2;
    color: #333;
}

.detail-cell {
    padding: 8px 12px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Define specific widths for each column in the detail table */
.detail-cell:nth-child(1) { flex: 0 0 70px; }   /* Aktiv */
.detail-cell:nth-child(2) { flex: 0 0 90px; }  /* Sortierung */
.detail-cell:nth-child(3) { flex: 1 1 auto; }   /* Text - let it take remaining space */
.detail-cell:nth-child(4) { flex: 0 0 160px; }  /* Typ */
.detail-cell:nth-child(5) { flex: 0 0 160px; }  /* Datum */
.detail-cell:nth-child(6) { flex: 0 0 80px; }   /* Action */

.detail-table .action-cell {
    position: sticky;
    right: 0;
    background-color: #f2f2f2; /* Default background for header */
}

.detail-table-row .action-cell {
    background-color: #fff; /* Specific background for data rows */
}
.detail-cell input, .detail-cell select, .detail-cell textarea {
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 11pt;
}

.detail-cell input[type=number],
.detail-cell input[type=date],
.detail-cell select {
    height: 32px; /* Enforce consistent height for single-line inputs and selects */
}

.detail-cell input[type=checkbox] {
    /* Reset browser default appearance */
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 1.3em;
    height: 1.3em;
    cursor: pointer;
}

/* Style for the checked state of the checkbox */
.detail-cell input[type=checkbox]:checked {
    background-color: #d1b95b;
    border-color: #b8a24b;
    /* Use an embedded SVG for the checkmark for cross-browser compatibility */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

/* --- Action Cells (Both Tables) --- */
.action-cell {
    text-align: center;
}

.action-icon {
    font-size: 1.5em;
    color: #d1b95b;
    text-decoration: none;
}

.new-row {
    background-color: #e6ffe6; /* Light green background for new rows */
}

/* --- Detail Group Headers --- */
.group-header {
    padding: 15px 12px 0 12px;
    background-color: #fff;
}
.group-header h3 {
    margin: 0 0 5px 0;
}
.group-divider {
    border: 0;
    border-top: 1px solid #eee;
}

/* --- Overlays --- */
#error-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #D32F2F; /* A nice shade of red */
    color: white;
    padding: 16px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    max-width: 400px;
}

#loader-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.spinner {
    border: 8px solid #f3f3f3; /* Light grey */
    border-top: 8px solid #d1b95b;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

/* --- Login Page Styling --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
}

.login-tile {
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background-color: #fff;
    color: #3c4043;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .2s, box-shadow .2s;
}

.login-button:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.google-icon {
    width: 18px;
    height: 18px;
    margin-right: 12px;
}

.login-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.login-logo {
    height: 40px;
    max-width: 150px;
}

.login-title {
    font-size: 22px;
    font-weight: 400;
    color: #202124;
    margin-bottom: 30px;
}

#unsaved-changes-overlay,
#delete-confirm-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.confirm-dialog {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
}

.confirm-dialog h3 {
    margin-top: 0;
}

.confirm-dialog-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}