/* Glasfaser Management System CSS */

/* General Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.8;
    color: #333;
    background-color: #f5f5f5;
    overflow-x: hidden; /* prevent horizontal scroll/zoom issues */
}

main, header, nav {
    overflow-x: hidden;
}

html {
    -webkit-text-size-adjust: 100%; /* avoid iOS auto-zooming text */
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: left;
    width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #2c3e50;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 22px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    text-align: center;
    margin: 20px 0;
}

h3 {
    font-size: 18px;
}

p {
    margin-bottom: 15px;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header & Footer */
header {
    background-color: #3498db;
    color: #fff;
    padding: 25px 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    width: 100%;
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: center;
    margin: 0;
    margin-right: auto;
    padding-left: 5px;
}

.logo img {
    height: 60px;
    margin-right: 30px;
}

.logo h1 {
    color: #fff;
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.5px;
}

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

.username {
    margin-right: 10px;
    font-weight: 600;
}

.btn-logout {
    background-color: #e74c3c;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
}

.btn-logout:hover {
    background-color: #c0392b;
    text-decoration: none;
}

nav {
    background-color: #2980b9;
    padding: 10px 0;
}

nav .container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-menu {
    display: flex;
    flex-wrap: nowrap;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: max-content;
}

.nav-menu li {
    margin-right: 20px;
    flex: 0 0 auto;
}

.nav-menu li:first-child {
    margin-left: 5px;
}

.nav-menu li a {
    color: #ecf0f1;
    font-weight: 500;
    padding: 8px 0;
    display: block;
}

.nav-menu li a:hover {
    color: #3498db;
    text-decoration: none;
}

.nav-menu li a.active {
    border-bottom: 3px solid #3498db;
    color: #3498db;
}

/* Mobile header fixes to avoid clipping/overflow */
@media (max-width: 768px) {
    header .container {
        flex-wrap: wrap;
        gap: 8px;
    }
    .logo img {
        height: 44px;
        margin-right: 12px;
    }
    .logo h1 {
        font-size: 18px;
        line-height: 1.2;
    }
    .user-info {
        margin-left: auto;
        margin-right: 5px;
    }
    nav .container {
        padding: 0 12px;
        overflow-x: auto;
    }
    .nav-menu li {
        margin-right: 12px;
    }
    .btn-logout {
        padding: 6px 10px;
        font-size: 13px;
    }
}

footer {
    background-color: #3498db;
    color: #ecf0f1;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* Main Content */
main {
    padding: 30px 0;
    width: 100%;
}

main.container {
    max-width: 1600px;
    width: 100%;
    padding: 30px 20px;
    box-sizing: border-box;
}

/* Login Page */
.login-page {
    background-color: #ecf0f1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.login-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    padding: 30px;
    width: 400px;
    max-width: 100%;
    position: relative;
    z-index: 2;
}

.login-logo {
    width: 180px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 10px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.login-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.btn-login {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    width: 100%;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
}

.btn-login:hover {
    background-color: #2980b9;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    min-width: 150px;
}

.btn:hover {
    background-color: #2980b9;
    text-decoration: none;
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-warning {
    background-color: #f39c12;
}

.btn-warning:hover {
    background-color: #d35400;
}

.btn-success {
    background-color: #2ecc71;
}

.btn-success:hover {
    background-color: #27ae60;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

textarea {
    height: 100px;
    resize: vertical;
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
}

.radio-group {
    margin-top: 10px;
}

.radio-label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
}

/* Dashboard */
.dashboard-widgets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    width: 100%;
    margin: 0 auto 25px auto;
    max-width: 1600px;
    box-sizing: border-box;
}

/* Dashboard structure for larger screens */
@media (min-width: 1200px) {
    .dashboard-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Diese Klasse verwenden, wenn zwei Container nebeneinander angezeigt werden sollen */
.two-columns-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto 25px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

@media (min-width: 992px) {
    .two-columns-container {
        grid-template-columns: 1fr 1.2fr;
    }
}

/* Explicitly make full-width widgets for the bottom sections */
.full-width-widget {
    width: 100% !important;
    grid-template-columns: 1fr !important;
    max-width: 1600px !important;
    margin: 0 auto 25px auto !important;
    box-sizing: border-box !important;
    padding: 0 20px !important;
    display: block !important;
}

.full-width-widget .widget {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Override for full-width widgets to match top container width */
main.container .full-width-widget {
    width: 100% !important;
    margin: 0 auto 25px auto !important;
    max-width: 1600px !important;
    padding: 0 20px !important;
}

/* Ensure full-width widget content uses full width */
.full-width-widget .widget-content {
    width: 100% !important;
    max-width: none !important;
}

/* Full-width appointment controls */
.full-width-widget .appointment-controls {
    width: 100% !important;
    max-width: none !important;
}

/* Full-width appointments container */
.full-width-widget .appointments-container {
    display: block !important;
    grid-template-columns: none !important;
    width: 100% !important;
}

/* Full-width table view */
.full-width-widget #appointments-table-view {
    width: 100% !important;
    max-width: none !important;
}

/* Full-width table */
.full-width-widget #appointments-table {
    width: 100% !important;
    max-width: none !important;
    min-width: 100% !important;
    table-layout: fixed !important;
}

.widget {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 25px;
    margin-bottom: 0; /* Remove bottom margin since we're using grid gap */
    width: 100%;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.tab-content {
    display: none;
    flex: 1;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.widget:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

.widget h3 {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 20px;
    color: #2980b9;
    font-weight: 700;
}

.widget-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-add-appointment {
    min-width: auto;
    padding: 8px 14px;
}

@media (max-width: 768px) {
    .widget-header-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    .btn-add-appointment {
        width: 100%;
        text-align: center;
    }
}

.widget-footer {
    margin-top: 20px;
    text-align: right;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    justify-content: flex-start;
    margin: 0 0 15px 0;
    width: 100%;
    padding: 0;
}

.tab-btn {
    background-color: transparent;
    border: none;
    padding: 10px 20px 10px 0;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    text-align: left;
    margin-right: 20px;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: fixed;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    min-width: 100%;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    hyphens: auto;
}

.data-table th {
    font-weight: 600;
    background-color: #f4f6f8;
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
}

.data-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-table tr:hover {
    background-color: #f0f7ff;
}

.appointments-table-wrapper,
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-green {
    background-color: #2ecc71;
}

.status-yellow {
    background-color: #f39c12;
}

.status-red {
    background-color: #e74c3c;
}

.status-blue {
    background-color: #3498db;
}

.status-orange {
    background-color: #e67e22;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Check In/Out Buttons */
.check-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.started-at, 
.complete-info {
    width: 100%;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
    word-wrap: break-word;
    box-sizing: border-box;
    max-width: 100%;
    display: block;
    flex: 1;
}

/* Appointments */
.appointments-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    min-height: 300px;
    width: 100%;
}

.appointments-sidebar {
    background-color: #f9f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-left: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.appointment-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.appointment-back-btn {
    display: none;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 600;
    gap: 8px;
    align-items: center;
    cursor: pointer;
}

.appointment-close-btn {
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: none;
}

.mobile-appointment-action {
    display: none;
    margin-bottom: 12px;
}

.mobile-appointment-action .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.appointment-modal-backdrop {
    display: none;
}

.appointment-form {
    margin-top: 15px;
}

.appointment-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.appointment-card {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 15px;
    padding-left: 25px;
    width: calc(33.333% - 10px);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.appointment-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.appointment-card.active {
    box-shadow: 0 0 0 2px #3498db;
}

.appointment-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 5px;
    height: 100%;
}

.appointment-card.status-green:before {
    background-color: #2ecc71;
}

.appointment-card.status-yellow:before {
    background-color: #f39c12;
}

.appointment-card.status-red:before {
    background-color: #e74c3c;
}

.appointment-card.status-blue:before {
    background-color: #3498db;
}

.card-date {
    font-weight: 600;
    margin-bottom: 5px;
}

.card-time {
    color: #666;
    margin-bottom: 10px;
}

.card-address {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 5px;
}

.card-team {
    font-size: 12px;
    color: #666;
}

/* Service Records */
.service-records-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.appointment-list {
    background-color: #f9f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-left: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.appointment-detail {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

@media (min-width: 992px) {
    .service-records-container {
        grid-template-columns: 320px 1fr;
    }
}

/* Mobile layout for service records */
@media (max-width: 768px) {
    .service-records-container {
        grid-template-columns: 1fr !important;
    }
    .appointment-list {
        margin-left: 0 !important;
    }
    .detail-header {
        grid-template-columns: 1fr !important;
    }
    .appointment-detail {
        padding: 16px !important;
    }
}

.detail-header {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.detail-service,
.detail-documents {
    margin-top: 25px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Prevent overflow of file input/buttons on small screens */
.inline-form {
	flex-wrap: wrap;
}

.appointment-list,
.appointment-detail {
	max-width: 100%;
	overflow-x: hidden;
}

/* Notifications */
.notifications-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.notifications-sidebar {
    background-color: #f9f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-left: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.notifications-banner {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.notification-item {
    background-color: white;
    border-radius: 5px;
    padding: 15px;
    padding-left: 25px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.notification-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 5px;
    height: 100%;
    background-color: #f39c12;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.notification-date {
    font-size: 12px;
    color: #666;
}

.notification-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.notification-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.notification-close-btn {
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: none;
}

.mobile-notification-action {
    display: none;
    margin-bottom: 12px;
}

.mobile-notification-action .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.notification-modal-backdrop {
    display: none;
}

@media (min-width: 992px) {
    .notifications-container {
        grid-template-columns: 320px 1fr;
    }
}

@media (max-width: 900px) {
    .notifications-container {
        grid-template-columns: 1fr;
    }
    .notifications-sidebar {
        display: none;
        margin-left: 0;
    }
    .notifications-sidebar.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1200;
        background: #fff;
        overflow-y: auto;
        padding: 18px 16px 28px;
        max-width: 100%;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }
    .notification-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #f0f2f5;
    }
    .notification-modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1190;
    }
    .notification-modal-backdrop.show {
        display: block;
    }
    .mobile-notification-action {
        display: block;
    }
    body.modal-open {
        overflow: hidden;
    }
}

.notification-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    width: 150px;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #2ecc71;
}

.read-status {
    font-size: 12px;
    color: #666;
}

.btn-confirm-notification {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* Teams */
.teams-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.teams-sidebar {
    background-color: #f9f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-left: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.team-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    padding-left: 25px;
    position: relative;
    overflow: hidden;
}

.team-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    width: 5px;
    height: 100%;
    background-color: #3498db;
}

.team-name {
    margin-bottom: 5px;
}

.team-meta {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.team-members {
    list-style: none;
    margin: 0;
    padding: 0;
}

.team-members li {
    margin-bottom: 5px;
    padding: 5px;
    background-color: #f8f9fa;
    border-radius: 3px;
}

.team-actions {
    margin-top: 15px;
    text-align: right;
}

/* Map */
.map-container {
    margin-top: 30px;
    width: 100%;
}

#appointments-map {
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    height: 500px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    gap: 8px;
}

.pagination a {
    display: inline-block;
    padding: 8px 14px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background-color: #e9e9e9;
    transform: translateY(-2px);
}

.pagination a.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Filter controls */
.filter-controls {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    box-sizing: border-box;
    width: 100%;
}

.filter-controls > * {
    margin-bottom: 0 !important;
}

.filter-controls #load-data-btn {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
    font-weight: 500;
}

.filter-controls #load-data-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Card View for Appointments */
.appointment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.appointment-card-alt {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    padding: 18px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-left: 5px solid #3498db;
}

.appointment-card-alt:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.appointment-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.appointment-date-time {
    font-weight: 700;
    color: #2c3e50;
    font-size: 15px;
}

.appointment-team-badge {
    background-color: #e9f7fe;
    color: #3498db;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.appointment-time {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.appointment-time i,
.appointment-address i {
    width: 16px;
    text-align: center;
    margin-right: 5px;
    color: #95a5a6;
}

.appointment-address {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
    flex: 1;
    line-height: 1.5;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.appointment-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.appointment-card-alt .btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.appointment-card-alt .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* View toggle buttons */
.view-toggle {
    display: flex;
    justify-content: flex-end;
    grid-column: span 2;
}

.view-toggle-btn {
    padding: 8px 15px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    cursor: pointer;
    min-width: 100px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.view-toggle-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.view-toggle-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.view-toggle-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn:hover:not(.active) {
    background-color: #e9e9e9;
}

/* Summary stats */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background-color: #f9f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 18px 15px;
    text-align: center;
    transition: all 0.2s ease;
    border-top: 3px solid #3498db;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card:nth-child(1) {
    border-top-color: #3498db;
}

.stat-card:nth-child(2) {
    border-top-color: #2ecc71;
}

.stat-card:nth-child(3) {
    border-top-color: #f39c12;
}

.stat-card:nth-child(4) {
    border-top-color: #e74c3c;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
}

/* Data display modes */
.hidden {
    display: none !important;
}

/* Data summary */
.data-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

@media (max-width: 768px) {
    .data-summary {
        grid-template-columns: 1fr;
    }
}

.summary-item {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.summary-label {
    font-weight: 600;
    color: #555;
    margin-right: 8px;
}

.summary-value {
    color: #2c3e50;
    font-weight: 700;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .dashboard-widgets {
        flex-direction: column;
    }
    
    .widget {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-select, 
    .view-toggle {
        margin-bottom: 10px;
    }
    
    .appointment-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        flex-direction: column;
    }
    
    .stat-card {
        width: 100%;
    }
}

/* Responsive table layout for mobile (manager dashboard) */
@media (max-width: 768px) {
    /* Force manager tables into stacked cards (like employee mobile) */
    .responsive-table {
        border-collapse: separate !important;
        border-spacing: 0 !important;
        width: 100% !important;
        display: block;
        overflow: visible;
    }
    .responsive-table colgroup,
    .responsive-table thead {
        display: none !important;
    }
    .responsive-table tbody {
        display: block;
        width: 100%;
    }
    .responsive-table tr {
        display: block;
        margin: 0 0 14px 0;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    .responsive-table td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 12px 14px;
        border: none;
        border-bottom: 1px solid #f2f2f2;
        gap: 6px;
        font-size: 14px;
        line-height: 1.45;
    }
    .responsive-table td:last-child {
        border-bottom: none;
        align-items: flex-start;
    }
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        text-align: left;
        min-width: 90px;
        display: block;
        font-size: 12px;
        letter-spacing: 0.1px;
        opacity: 0.9;
        margin-bottom: 2px;
    }
    .responsive-table .status-badge {
        margin-left: 0;
        align-self: flex-start;
    }
    .responsive-table .loading-indicator,
    .responsive-table .error-message {
        justify-content: center;
    }
    /* Space inside manager widgets */
    .appointments-container,
    .widget-content {
        padding-left: 0;
        padding-right: 0;
    }
    .appointment-summary {
        padding: 0 4px;
    }
    .appointments-view {
        padding-left: 4px;
        padding-right: 4px;
    }
}

/* Address autocomplete */
.address-suggestions {
    position: absolute;
    z-index: 1000;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    display: flex;
    align-items: center;
}

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

.suggestion-item:hover {
    background-color: #f0f7ff;
}

.addr-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

.addr-text {
    flex-grow: 1;
    white-space: normal;
    line-height: 1.4;
}

/* Additional improvements */
#appointments-map .leaflet-popup-content {
    font-size: 14px;
    line-height: 1.5;
}

#appointments-map .leaflet-popup-content strong {
    color: #34495e;
}

/* Additional address autocomplete styles */
.loading-suggestions, 
.no-results, 
.error-message {
    padding: 12px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.error-message {
    color: #e74c3c;
}

.no-results {
    color: #7f8c8d;
}

/* Appointments für Mitarbeiter */
.employee-view {
    display: block;
}

.appointments-content.full-width {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.employee-header {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.employee-info {
    margin-top: 10px;
    color: #666;
}

.employee-info p {
    margin: 0;
    font-size: 15px;
}

/* Auto-fit für Karte im Mitarbeiter-Modus */
.employee-view .map-container {
    margin-top: 30px;
}

.employee-view #appointments-map {
    height: 500px;
}

/* KPI Overview Cards */
.kpi-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    max-width: 1600px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    padding: 0 20px;
}

@media (max-width: 900px) {
    .appointments-container {
        display: block;
        grid-template-columns: 1fr;
    }

    .appointments-sidebar {
        display: none;
        margin-left: 0;
    }

    .appointments-sidebar.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1200;
        background: #fff;
        overflow-y: auto;
        padding: 18px 16px 28px;
        max-width: 100%;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }

    .appointment-sidebar-header {
        position: sticky;
        top: 0;
        padding-bottom: 10px;
        margin-bottom: 10px;
        background: #fff;
        z-index: 1;
    }

    .appointment-back-btn {
        display: inline-flex;
    }

    .appointment-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #f0f2f5;
    }

    .appointment-modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1190;
    }

    .appointment-modal-backdrop.show {
        display: block;
    }

    .mobile-appointment-action {
        display: block;
    }

    body.modal-open {
        overflow: hidden;
    }
}

@media (min-width: 992px) {
    .teams-container {
        grid-template-columns: 320px 1fr;
    }
}

.team-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.team-close-btn {
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: none;
}

.mobile-team-action {
    display: none;
    margin-bottom: 12px;
}

.mobile-team-action .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.team-modal-backdrop {
    display: none;
}

@media (max-width: 900px) {
    .teams-container {
        grid-template-columns: 1fr;
    }
    .teams-sidebar {
        display: none;
        margin-left: 0;
    }
    .teams-sidebar.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1200;
        background: #fff;
        overflow-y: auto;
        padding: 18px 16px 28px;
        max-width: 100%;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    }
    .team-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #f0f2f5;
    }
    .team-modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1190;
    }
    .team-modal-backdrop.show {
        display: block;
    }
    .mobile-team-action {
        display: block;
    }
    body.modal-open {
        overflow: hidden;
    }
}

/* Appointment filters */
.appointments-filter {
    margin-bottom: 16px;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #e2e6ea;
    border-radius: 10px;
}

.filter-fields {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-fields .form-group {
    margin: 0;
}

.filter-dates {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-sep {
    color: #6c757d;
    font-weight: 600;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-actions form {
    display: flex;
    gap: 8px;
}

.filter-mobile-btn {
    display: none;
}

.filter-modal {
    display: none;
}

.filter-modal.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1400;
}

.filter-modal-backdrop {
    display: none;
}

.filter-modal-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1395;
}

.filter-modal-content {
    position: absolute;
    inset: auto 12px 12px 12px;
    top: 70px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    padding: 16px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 1401;
}

.filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.filter-modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}

.filter-modal-form .form-group {
    margin-bottom: 12px;
}

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

.filter-modal-actions .btn {
    flex: 1;
}

.filter-mobile-trigger {
    display: none;
    margin: 12px 0;
}

@media (max-width: 900px) {
    .filter-bar {
        display: none;
    }
    .filter-mobile-trigger {
        display: inline-flex;
    }
    .filter-mobile-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .appointments-filter {
        position: relative;
    }
    .filter-modal {
        display: none;
    }
}

@media (max-width: 1200px) {
    .kpi-overview {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-overview {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    transition: all 0.3s ease;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: #3498db;
    font-size: 24px;
}

.kpi-card:nth-child(1) .kpi-icon {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.kpi-card:nth-child(2) .kpi-icon {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.kpi-card:nth-child(3) .kpi-icon {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.kpi-card:nth-child(4) .kpi-icon {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    line-height: 1.2;
}

.kpi-value.high {
    color: #2ecc71;
}

.kpi-value.medium {
    color: #f39c12;
}

.kpi-value.low {
    color: #e74c3c;
}

.kpi-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 600;
    margin-bottom: 5px;
}

.kpi-meta {
    font-size: 12px;
    color: #95a5a6;
}

.kpi-progress {
    margin-top: 10px;
    font-size: 12px;
    color: #7f8c8d;
}

.kpi-progress .progress-bar {
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    margin-bottom: 5px;
    width: 100%;
}

.kpi-progress .progress {
    height: 100%;
    background: #3498db;
    border-radius: 3px;
}

/* Quick Action Buttons */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    padding: 15px;
    height: 100px;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #2c3e50;
    border: 1px solid #f0f0f0;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #3498db;
    border-color: #3498db;
}

.quick-action-btn i {
    font-size: 24px;
    margin-bottom: 10px;
    color: #3498db;
}

.quick-action-btn span {
    font-size: 14px;
    font-weight: 500;
}

/* Date filter styles */
.date-filter {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.date-filter-form {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.date-filter .form-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    width: 100%;
}

.date-filter label {
    margin-right: 10px;
    font-weight: bold;
}

.date-filter input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex-grow: 1;
}

/* Quick date navigation */
.quick-date-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.quick-date-nav span {
    font-weight: bold;
    margin-right: 5px;
}

.date-btn {
    display: inline-block;
    padding: 6px 12px;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.date-btn:hover {
    background-color: #e0e0e0;
    text-decoration: none;
}

.date-btn.active {
    background-color: #4a89dc;
    color: white;
    border-color: #3a79cc;
}

/* Employee appointment container styles */
.appointments-content.full-width {
    width: 100%;
}

.employee-header {
    margin-bottom: 20px;
}

.route-optimization-controls {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Verbesserte Darstellung für Mitarbeiter */
.employee-view .route-optimization-controls {
    background-color: #f9f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.employee-view #route-date-selector {
    flex-grow: 1;
    max-width: 300px;
}

.employee-view #optimize-route-btn {
    background-color: #4a89dc;
    border-color: #3a79cc;
}

.employee-view #optimize-route-btn:hover {
    background-color: #3a79cc;
}

#route-info {
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

/* Loading indicator styles */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.loading-indicator i {
    margin-right: 8px;
    color: #4a89dc;
}

/* Error message styles */
.error-message {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
}

.error-message i {
    margin-right: 8px;
}

/* Improved table styling for dynamic content */
.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Enhanced widget content */
.widget-content {
    position: relative;
}

/* Tabs styling improvements */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 14px;
}

.tab-btn:hover {
    background-color: #f8f9fa;
}

.tab-btn.active {
    border-bottom-color: #4a89dc;
    color: #4a89dc;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* View toggle controls */
.view-toggle {
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
}

@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .view-toggle {
        justify-content: flex-start;
        margin-left: 0;
    }
}

/* View Mode Selector */
.view-mode-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.view-mode-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

.view-mode-selector input[type="radio"] {
    margin: 0;
}

/* Date Controls */
.date-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.day-controls,
.month-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.month-controls select {
    min-width: 120px;
}

.hidden {
    display: none !important;
}

/* Filter Controls Layout */
.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.filter-controls .date-controls {
    flex-wrap: wrap;
}

/* Enhanced Data Summary */
.data-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 5px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.summary-label {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
}

.summary-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #495057;
}

/* Pagination Styles */
.pagination-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-info {
    margin-right: 15px;
    padding: 8px 12px;
    font-size: 0.9em;
    color: #6c757d;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.pagination-btn {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    text-decoration: none;
    color: #007bff;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.pagination-btn:hover {
    color: #0056b3;
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.pagination-btn.active {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.pagination-btn.active:hover {
    background-color: #0056b3;
    border-color: #004085;
}

/* Loading and Error States */
.loading-indicator {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

.loading-indicator i {
    margin-right: 8px;
}

.error-message {
    color: #d32f2f !important;
    text-align: center;
    padding: 20px;
    background-color: #ffebee;
    border-radius: 4px;
}

.error-message i {
    margin-right: 8px;
}

/* Responsive Design for Filter Controls */
@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
    }
    
    .date-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .day-controls,
    .month-controls {
        flex-direction: column;
    }
    
    .view-mode-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .data-summary {
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination {
        justify-content: center;
        gap: 3px;
    }
    
    .pagination-info {
        width: 100%;
        text-align: center;
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Appointment Controls Styling */
.appointment-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    width: 100%;
    box-sizing: border-box;
}

.view-mode-selector {
    display: flex;
    gap: 15px;
}

.view-mode-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
    color: #495057;
    transition: color 0.2s ease;
}

.view-mode-selector label:hover {
    color: #007bff;
}

.view-mode-selector input[type="radio"] {
    accent-color: #007bff;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.week-navigation,
.month-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.week-display,
.month-display {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-btn {
    background: #007bff;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.nav-btn:active {
    transform: translateY(0);
}

.nav-btn i {
    font-size: 12px;
}

/* Appointment Summary */
.appointment-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.period-info {
    flex: 1;
}

.period-display h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.period-dates {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.appointment-stats {
    display: flex;
    gap: 20px;
}

.appointment-stats .stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    min-width: 70px;
}

.appointment-stats .stat-value {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 3px;
    color: white;
}

.appointment-stats .stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
    color: white;
}

/* View Controls */
.view-controls {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

.view-toggle {
    display: flex;
    background: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.view-toggle-btn.active {
    background: #007bff;
    color: white;
}

.view-toggle-btn i {
    font-size: 12px;
}

/* Appointments Container */
.appointments-container {
    min-height: 300px;
    width: 100%;
}

.appointments-view {
    display: none;
    width: 100%;
}

.appointments-view.active {
    display: block;
    width: 100%;
}

/* Ensure full width for appointment table view */
#appointments-table-view {
    width: 100%;
    overflow-x: auto;
}

#appointments-table {
    width: 100%;
    min-width: 800px; /* Minimum width to prevent over-compression */
}

/* Enhanced table responsive behavior */
@media (max-width: 1200px) {
    #appointments-table {
        min-width: 700px;
    }
}

@media (max-width: 768px) {
    #appointments-table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 900px) {
    .data-table.responsive thead {
        display: none;
    }
    
    .data-table.responsive,
    .data-table.responsive tbody,
    .data-table.responsive tr,
    .data-table.responsive td {
        display: block;
        width: 100%;
    }

    .data-table.responsive {
        box-shadow: none;
        border-radius: 0;
        background: transparent;
    }

    .data-table.responsive tr {
        margin-bottom: 14px;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        overflow: hidden;
    }

    .data-table.responsive td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
        border-bottom: 1px solid #f1f3f5;
        font-size: 14px;
    }

    .data-table.responsive td:last-child {
        border-bottom: none;
    }

    .data-table.responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        min-width: 110px;
        flex: 0 0 110px;
        white-space: normal;
    }

    .data-table.responsive td[data-label="Aktionen"] {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .data-table.responsive td[data-label="Aktionen"] .btn {
        margin-right: 8px;
    }

    .data-table.responsive td[data-label="Aktionen"] form {
        display: inline-block;
    }
}

/* Loading States */
.loading-row td,
.loading-card {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loading-indicator i {
    animation: spin 1s linear infinite;
}

/* Enhanced Appointment Cards */
.appointment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.appointment-card-enhanced {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 20px;
    transition: all 0.3s ease;
    border-left: 4px solid #007bff;
    position: relative;
    overflow: hidden;
}

.appointment-card-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

@media (max-width: 768px) {
    .appointment-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 6px 0;
    }
    .appointment-card-enhanced {
        padding: 16px;
        border-radius: 14px;
    }
    .appointment-card-enhanced .card-address {
        line-height: 1.45;
    }
}

.appointment-card-enhanced.status-green {
    border-left-color: #28a745;
}

.appointment-card-enhanced.status-yellow {
    border-left-color: #ffc107;
}

.appointment-card-enhanced.status-red {
    border-left-color: #dc3545;
}

.appointment-card-enhanced.status-blue {
    border-left-color: #007bff;
}

.card-header-enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.card-date-time {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.card-status-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-status-badge.status-green {
    background: #d4edda;
    color: #155724;
}

.card-status-badge.status-yellow {
    background: #fff3cd;
    color: #856404;
}

.card-status-badge.status-red {
    background: #f8d7da;
    color: #721c24;
}

.card-status-badge.status-blue {
    background: #d1ecf1;
    color: #0c5460;
}

.card-content-enhanced {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6c757d;
}

.card-info-row i {
    width: 16px;
    text-align: center;
    color: #adb5bd;
}

.card-address {
    font-weight: 500;
    color: #495057;
}

.card-team {
    color: #007bff;
    font-weight: 500;
}

/* Enhanced Pagination */
.pagination-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination a,
.pagination button {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #007bff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
}

.pagination a:hover,
.pagination button:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination a.active,
.pagination button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .appointment-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .date-navigation {
        justify-content: center;
    }
    
    .appointment-summary {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .appointment-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .appointment-grid {
        grid-template-columns: 1fr;
    }
    
    .week-display,
    .month-display {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .view-mode-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .appointment-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

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

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Employee appointments table specific styling */
#employee-appointments-table {
    width: 100%;
    min-width: 800px;
}

@media (max-width: 1200px) {
    #employee-appointments-table {
        min-width: 700px;
    }
}

@media (max-width: 768px) {
    #employee-appointments-table {
        min-width: 600px;
        font-size: 13px;
    }
}

/* Fix widget content to ensure full width */
.widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Ensure appointment controls don't restrict width */
.appointment-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    width: 100%;
    box-sizing: border-box;
}

/* Additional fix for table containers */
.widget .data-table {
    width: 100% !important;
    table-layout: fixed;
}

/* Ensure no max-width restrictions on table containers */
.appointments-container,
.appointments-view,
#appointments-table-view,
#employee-appointments-table {
    max-width: none !important;
    width: 100% !important;
}

/* Force full width for appointment management sections */
.full-width-widget .appointment-summary,
.full-width-widget .view-controls,
.full-width-widget .pagination-container {
    width: 100% !important;
    max-width: none !important;
}

/* Remove any flex constraints that might limit width */
.full-width-widget .widget {
    display: block !important;
}

.full-width-widget .widget-content {
    display: block !important;
}

/* Ensure uniform full-width layout across dashboard rows */
.kpi-overview,
.two-columns-container,
.full-width-widget {
    max-width: none !important;
    width: 100% !important;
}

/* Add consistent side padding like quick-actions */
.kpi-overview,
.two-columns-container,
.full-width-widget {
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

/* Compact filter-controls on larger screens */
@media (min-width: 992px) {
    .filter-controls {
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        margin-bottom: 15px !important;
        padding: 10px 15px !important;
    }

    .filter-controls .date-controls {
        flex-direction: row !important;
        align-items: center !important;
    }

    .filter-controls .day-controls,
    .filter-controls .month-controls {
        flex-direction: row !important;
    }

    .filter-controls select,
    .filter-controls input[type="date"] {
        min-width: unset !important;
        width: auto !important;
    }

    .filter-controls #load-data-btn {
        margin-left: auto !important;
    }
}

/* Employee Dashboard Specific Styles */
.time-tracking-widget {
    max-height: 200px;
    min-height: unset !important;
    margin-bottom: 0 !important;
}

.time-tracking-widget .check-buttons {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: flex-start;
    text-align: left;
}

.time-tracking-widget .started-at,
.time-tracking-widget .complete-info {
    padding: 15px;
    margin-bottom: 0;
    overflow: hidden;
    word-wrap: break-word;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    display: block;
    flex: 1;
    background-color: transparent;
    padding-left: 0;
    padding-right: 0;
}

/* Specific styling for elements inside complete-info */
.time-tracking-widget .complete-info p {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.3;
}

.time-tracking-widget .complete-info p:last-child {
    margin-bottom: 0;
}

.time-tracking-widget .complete-info .status-badge {
    display: inline-block;
    padding: 5px 10px;
    font-size: 12px;
    min-width: 100px;
    margin-top: 5px;
}

/* Ensure employee dashboard uses proper layout */
.employee-dashboard .dashboard-widgets {
    grid-template-columns: 1fr !important;
    margin-bottom: 20px;
}

.employee-dashboard .full-width-widget {
    margin-top: 30px !important;
    clear: both !important;
}

/* Mobile responsiveness for employee dashboard */
@media (max-width: 768px) {
    .time-tracking-widget {
        max-height: unset;
    }
}

/* Single Widget Container for Employee Dashboard */
.single-widget-container {
    display: block !important;
    width: 100% !important;
    max-width: 1600px !important;
    margin: 0 auto 40px auto !important;
    box-sizing: border-box !important;
    padding: 0 20px !important;
    clear: both !important;
}

.single-widget-container .widget {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
} 

/* Mobile bottom sheet for appointment details */
#appointment-detail-sheet {
	position: fixed;
	inset: 0;
	z-index: 1000;
}
#appointment-detail-sheet .sheet-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.35);
	opacity: 0;
	transition: opacity .2s ease;
}
#appointment-detail-sheet .sheet-panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -70%;
	background: #fff;
	border-top-left-radius: 12px;
	border-top-right-radius: 12px;
	box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
	max-height: 70%;
	display: flex;
	flex-direction: column;
	transition: bottom .2s ease;
}
#appointment-detail-sheet.open .sheet-backdrop {
	opacity: 1;
}
#appointment-detail-sheet.open .sheet-panel {
	bottom: 0;
}
#appointment-detail-sheet .sheet-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid #eee;
}
#appointment-detail-sheet .sheet-close {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
#appointment-detail-sheet .sheet-content {
	padding: 12px 16px 16px 16px;
	overflow-y: auto;
}
#appointment-detail-sheet .sheet-section {
	margin-bottom: 12px;
}
#appointment-detail-sheet .kv {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 0;
}
#appointment-detail-sheet .kv .k {
	color: #6c757d;
	min-width: 90px;
}
#appointment-detail-sheet .kv .v {
	text-align: right;
}
#appointment-detail-sheet .docs .doc-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 0;
	border-bottom: 1px dashed #eee;
}
#appointment-detail-sheet .doc-name {
	flex: 1;
	padding-right: 10px;
}
#appointment-detail-sheet .doc-actions {
	white-space: nowrap;
}
#appointment-detail-sheet .sheet-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	padding-top: 8px;
	border-top: 1px solid #eee;
}

/* Responsive: Employee appointments table as stacked cards on mobile */
@media (max-width: 768px) {
	/* Remove forced min-width to avoid overflow */
	#employee-appointments-table {
		min-width: 0 !important;
		width: 100% !important;
		table-layout: auto !important;
		overflow-x: hidden !important;
	}
	/* Hide table header and display rows as blocks */
	#employee-appointments-table thead {
		position: absolute !important;
		left: -10000px !important;
		top: -10000px !important;
		height: 0 !important;
		overflow: hidden !important;
		display: none !important;
	}
	#employee-appointments-table,
	#employee-appointments-table tbody,
	#employee-appointments-table tr,
	#employee-appointments-table td {
		display: block;
		width: 100%;
	}
	#employee-appointments-table tr {
		background: #fff;
		border: 1px solid #e9ecef;
		border-radius: 10px;
		box-shadow: 0 2px 8px rgba(0,0,0,0.06);
		margin: 12px 0;
		padding: 8px 10px;
	}
	#employee-appointments-table td {
		border: none;
		border-bottom: 1px solid #f1f3f5;
		position: relative;
		padding: 10px 12px 10px 120px; /* space for label */
		min-height: 42px;
		white-space: normal;
		word-wrap: break-word;
	}
	#employee-appointments-table td:last-child {
		border-bottom: none;
		padding-bottom: 6px;
	}
	/* Label shown before each value */
	#employee-appointments-table td::before {
		content: attr(data-label);
		position: absolute;
		left: 12px;
		top: 50%;
		transform: translateY(-50%);
		font-weight: 600;
		color: #6c757d;
		min-width: 90px;
		text-align: left;
	}
	/* Make action buttons wrap nicely */
	#employee-appointments-table td[data-label="Aktion"] .btn {
		min-width: auto;
	}
	#employee-appointments-table td[data-label="Aktion"] {
		padding-top: 12px;
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		padding-left: 12px; /* action buttons don't need big label space */
	}
	#employee-appointments-table td[data-label="Aktion"]::before {
		position: static;
		transform: none;
		display: block;
		margin-bottom: 6px;
	}
}

/* Generic stacked table pattern for mobile (opt-in via .stack-table) */
@media (max-width: 768px) {
	.stack-table {
		min-width: 0 !important;
		width: 100% !important;
		table-layout: auto !important;
		overflow-x: hidden !important;
	}
	.stack-table thead {
		display: none !important;
	}
	.stack-table,
	.stack-table tbody,
	.stack-table tr,
	.stack-table td {
		display: block;
		width: 100%;
	}
	.stack-table tr {
		background: #fff;
		border: 1px solid #e9ecef;
		border-radius: 10px;
		box-shadow: 0 2px 8px rgba(0,0,0,0.06);
		margin: 12px 0;
		padding: 8px 10px;
	}
	.stack-table td {
		border: none;
		border-bottom: 1px solid #f1f3f5;
		position: relative;
		padding: 10px 12px 10px 120px;
		min-height: 42px;
		white-space: normal;
		word-wrap: break-word;
	}
	.stack-table td:last-child {
		border-bottom: none;
		padding-bottom: 6px;
	}
	.stack-table td::before {
		content: attr(data-label);
		position: absolute;
		left: 12px;
		top: 50%;
		transform: translateY(-50%);
		font-weight: 600;
		color: #6c757d;
		min-width: 90px;
		text-align: left;
	}
}

/* Extra small devices */
@media (max-width: 360px) {
	.stack-table td {
		padding-left: 100px;
		min-height: 38px;
	}
	.stack-table td::before {
		min-width: 80px;
	}
}

/* Fix overlapping info buttons in documents table */
#documents-table td[data-label="Nachweistyp"] {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#documents-table td[data-label="Nachweistyp"] .btn {
    padding: 4px 8px;
    margin: 0;
    line-height: 1.2;
}

@media (max-width: 768px) {
    /* Reflow documents table rows into label/value/action columns */
    #documents-table.stack-table tr {
        display: block;
        padding: 10px 12px;
        margin: 12px 0;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    #documents-table.stack-table td {
        display: grid;
        grid-template-columns: minmax(100px, 130px) 1fr auto;
        gap: 6px;
        align-items: start;
        border: none;
        border-bottom: none;
        position: static;
        padding: 8px 0;
        min-height: auto;
        text-align: left;
    }
    #documents-table.stack-table td::before {
        content: attr(data-label);
        grid-column: 1;
        position: static;
        transform: none;
        margin: 0;
        font-weight: 600;
        color: #6c757d;
    }
    /* Nachweistyp: label left, value middle, info button right */
    #documents-table td[data-label="Nachweistyp"] .btn {
        grid-column: 3;
        justify-self: end;
    }
    /* Status: label left, badge right */
    #documents-table td[data-label="Status"] > * {
        grid-column: 3;
        justify-self: end;
    }
    /* Datei: label left, action right */
    #documents-table td[data-label="Datei"] > * {
        grid-column: 3;
        justify-self: end;
        margin-top: 0;
    }
}