/* KD Buchungskalender Styles */

.kd-calendar-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: 'Roboto', Arial, sans-serif;
}

/* Navigation */
.kd-calendar-navigation {
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
}

.kd-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.kd-nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.kd-nav-button {
    background: #851a1e;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border: 1px solid #851a1e;
    border-radius: 0;
    font-weight: bold;
    font-family: 'Roboto', Arial, sans-serif;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap;
}

.kd-nav-button:hover {
    background: white;
    color: #851a1e;
    text-decoration: none;
}

.kd-nav-button.disabled {
    background: #f0f0f0;
    color: #999;
    border-color: #ddd;
    cursor: not-allowed;
    pointer-events: none;
}

.kd-nav-today {
    font-size: 14px;
    padding: 8px 16px;
}

.kd-current-week {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-align: center;
    min-width: 250px;
    margin-bottom: 5px;
}

/* Calendar Grid */
.kd-calendar-grid {
    display: grid;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

/* No appointments message */
.kd-no-appointments {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 5px;
}

.kd-calendar-header {
    display: grid;
    background: #f8f9fa;
    font-weight: bold;
    border-bottom: 2px solid #ddd;
}

.kd-calendar-row {
    display: grid;
    border-bottom: 1px solid #eee;
}

.kd-calendar-row:last-child {
    border-bottom: none;
}

/* Grid columns - dynamic based on working days */
.kd-calendar-header,
.kd-calendar-row {
    grid-template-columns: 80px repeat(var(--working-days-count, 5), 1fr);
}

/* Time column */
.kd-time-column,
.kd-time-cell {
    background: #f8f9fa;
    border-right: 2px solid #ddd;
    padding: 15px 10px;
    text-align: center;
    font-weight: bold;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kd-time-cell {
    font-size: 14px;
    min-height: 60px;
}

/* Day columns */
.kd-day-column {
    padding: 10px;
    text-align: center;
    border-right: 1px solid #eee;
    position: relative;
}

.kd-day-column:last-child {
    border-right: none;
}

.kd-day-column.kd-today {
    background: #fff3cd;
    font-weight: bold;
}

.kd-day-column.kd-today::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #856404;
}

.kd-day-name {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.kd-today .kd-day-name {
    color: #856404;
}

.kd-day-date {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.kd-today .kd-day-date {
    color: #856404;
}

/* Public holidays */
.kd-day-column.kd-holiday {
    background: #fce4ec;
}

.kd-day-column.kd-holiday .kd-day-name,
.kd-day-column.kd-holiday .kd-day-date {
    color: #c62828;
}

.kd-holiday-name {
    font-size: 10px;
    color: #c62828;
    font-weight: bold;
    margin-top: 2px;
    line-height: 1.2;
}

.kd-appointment-cell.kd-holiday {
    background: #fce4ec;
}

/* Appointment cells */
.kd-appointment-cell {
    padding: 8px;
    border-right: 1px solid #eee;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.kd-appointment-cell:last-child {
    border-right: none;
}

/* Today highlight for appointment cells */
.kd-appointment-cell.kd-today {
    background-color: rgba(255, 243, 205, 0.3);
}

/* Available appointment */
.kd-appointment-cell.kd-available {
    background: #f0f8f0;
}

.kd-appointment-cell.kd-available.kd-today {
    background: linear-gradient(135deg, #f0f8f0 0%, #fff3cd 100%);
}

.kd-appointment-cell.kd-available:hover {
    background: #e8f5e8;
}

/* Booked appointment */
.kd-appointment-cell.kd-booked {
    background: #f8e6e7;
}

.kd-appointment-cell.kd-booked.kd-today {
    background: linear-gradient(135deg, #f8e6e7 0%, #fff3cd 100%);
}

/* Unavailable appointment */
.kd-appointment-cell.kd-unavailable {
    background: #f5f5f5;
    color: #999;
}

.kd-appointment-cell.kd-unavailable.kd-today {
    background: linear-gradient(135deg, #f5f5f5 0%, #fff3cd 100%);
}

/* Expired appointment */
.kd-appointment-cell.kd-expired {
    background: #f8f9fa;
    color: #6c757d;
}

.kd-appointment-cell.kd-expired.kd-today {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff3cd 100%);
}

/* Book button */
.kd-book-button {
    background: #1e7e34;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.kd-book-button:hover {
    background: #155724;
}

/* Status labels */
.kd-status {
    font-size: 12px;
    font-weight: bold;
    padding: 6px 8px;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 4px;
}

.kd-booked .kd-status {
    background: #851a1e;
    color: white;
}

.kd-unavailable .kd-status {
    background: #6c757d;
    color: white;
}

/* Member info */
.kd-member-info {
    font-size: 10px;
    margin-top: 4px;
    color: #666;
    line-height: 1.2;
}

/* Responsive design */
@media (max-width: 768px) {
    .kd-calendar-container {
        padding: 10px;
        overflow-x: auto;
    }

    .kd-nav-buttons {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    .kd-nav-center {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 200px;
        order: 0;
    }

    .kd-nav-prev {
        order: -1;
        flex-shrink: 0;
    }

    .kd-nav-next {
        order: 1;
        flex-shrink: 0;
    }

    .kd-current-week {
        min-width: auto;
        margin: 0 0 8px 0;
        font-size: 14px;
        text-align: center;
    }

    .kd-nav-button {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .kd-nav-today {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Mobile calendar grid */
    .kd-calendar-grid {
        min-width: 600px;
        overflow-x: auto;
    }

    .kd-calendar-header,
    .kd-calendar-row {
        grid-template-columns: 70px repeat(var(--working-days-count, 5), 1fr);
        min-width: 600px;
    }

    .kd-time-column,
    .kd-time-cell {
        padding: 8px 5px;
        font-size: 11px;
        min-width: 70px;
    }

    .kd-day-column {
        padding: 8px 4px;
        min-width: 80px;
    }

    .kd-day-name {
        font-size: 12px;
    }

    .kd-day-date {
        font-size: 10px;
    }

    .kd-appointment-cell {
        padding: 6px 4px;
        min-height: 60px;
        min-width: 80px;
    }

    .kd-book-button {
        padding: 6px 8px;
        font-size: 10px;
        white-space: nowrap;
    }

    .kd-status {
        font-size: 10px;
        padding: 2px 4px;
    }

    .kd-member-info {
        font-size: 8px;
    }
}

@media (max-width: 640px) {
    .kd-calendar-grid {
        min-width: 500px;
    }

    .kd-calendar-header,
    .kd-calendar-row {
        grid-template-columns: 60px repeat(var(--working-days-count, 5), 1fr);
        min-width: 500px;
    }

    .kd-time-column,
    .kd-time-cell {
        min-width: 60px;
        font-size: 10px;
        padding: 6px 3px;
    }

    .kd-day-column {
        min-width: 70px;
        padding: 6px 2px;
    }

    .kd-appointment-cell {
        min-width: 70px;
        padding: 4px 2px;
        min-height: 50px;
    }

    .kd-book-button {
        padding: 4px 6px;
        font-size: 9px;
    }
}

/* Small mobile screens - stack navigation */
@media (max-width: 480px) {
    .kd-nav-buttons {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .kd-nav-center {
        order: -1;
        margin-bottom: 10px;
        min-width: auto;
    }

    .kd-nav-prev,
    .kd-nav-next {
        order: 0;
        align-self: stretch;
    }

    .kd-current-week {
        font-size: 13px;
        margin-bottom: 5px;
    }

    .kd-nav-button {
        padding: 10px;
        font-size: 13px;
    }

    .kd-nav-today {
        padding: 6px 12px;
        font-size: 11px;
        align-self: center;
        max-width: 120px;
    }
}

/* Horizontal scroll hint for mobile */
@media (max-width: 768px) {
    .kd-calendar-container::before {
        content: '← Wischen zum Blättern →';
        display: block;
        text-align: center;
        font-size: 12px;
        color: #666;
        margin-bottom: 10px;
        font-style: italic;
    }
}

/* Admin Booking Modal Styles */
.kd-admin-booking-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.kd-admin-booking-modal-content {
    background-color: #fefefe;
    margin: 3% auto;
    border: none;
    border-radius: 5px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: adminModalSlideIn 0.3s ease;
}

@keyframes adminModalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.kd-admin-booking-modal-header {
    padding: 20px;
    background: #851a1e;
    color: white;
    border-radius: 5px 5px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kd-admin-booking-modal-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
}

.kd-close-admin-modal {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.kd-close-admin-modal:hover {
    opacity: 0.7;
}

.kd-admin-booking-modal-body {
    padding: 25px;
}

.kd-booking-details .kd-detail-row {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.kd-booking-details .kd-detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.kd-booking-details .kd-detail-row strong {
    color: #333;
    font-weight: 600;
}

.kd-booking-details .kd-description {
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #0073aa;
    line-height: 1.6;
}

.kd-checkbox-wrap {
    display: flex;
    gap: 15px;
}

.kd-checkbox-wrap span {
    flex-basis: max-content;
}

.kd-checkbox-wrap label {
    flex: 1;
    font-size: 15px;
    font-weight: normal !important;
    margin: 0 !important;
    user-select: none;
}

@media (max-width: 600px) {
    .kd-admin-booking-modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .kd-admin-booking-modal-header {
        padding: 15px;
    }

    .kd-admin-booking-modal-header h3 {
        font-size: 18px;
    }

    .kd-admin-booking-modal-body {
        padding: 20px;
    }
}

/* Auth / Login Form Styles */
.kd-auth-container {
    max-width: 450px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Roboto', Arial, sans-serif;
}

.kd-auth-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kd-auth-form h2 {
    margin: 0 0 10px 0;
    color: #851a1e;
    font-size: 24px;
    text-align: center;
}

.kd-auth-description {
    color: #666;
    text-align: center;
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.5;
}

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

.kd-auth-form .kd-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.kd-auth-form .kd-form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.kd-auth-form .kd-form-group input:focus {
    outline: none;
    border-color: #851a1e;
    box-shadow: 0 0 0 3px rgba(133, 26, 30, 0.1);
}

.kd-auth-form .kd-form-actions {
    margin-top: 25px;
}

.kd-auth-submit {
    width: 100%;
    padding: 14px 20px;
    background: #851a1e;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.kd-auth-submit:hover {
    background: #6a1518;
}

.kd-auth-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.kd-form-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    border: 1px solid #f5c6cb;
}

/* User Info Bar */
.kd-user-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 40px !important;
    border: 1px solid #e0e0e0;
}

.kd-user-info {
    color: #333;
    font-size: 14px;
}

.kd-logout-link {
    color: #851a1e;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 12px;
    border: 1px solid #851a1e;
    border-radius: 4px;
    transition: all 0.3s;
}

.kd-logout-link:hover {
    background: #851a1e;
    color: white;
    text-decoration: none;
}

/* Readonly input styling */
.kd-readonly,
input.kd-readonly {
    background-color: #f5f5f5 !important;
    color: #666 !important;
    cursor: not-allowed;
}

/* Responsive Auth Form */
@media (max-width: 480px) {
    .kd-auth-container {
        padding: 10px;
    }

    .kd-auth-form {
        padding: 20px;
    }

    .kd-auth-form h2 {
        font-size: 20px;
    }

    .kd-user-info-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .kd-user-info {
        font-size: 13px;
    }
}
