
.tg-wrap {
    --tg-accent: #d56823;
    --tg-accent-hover: #b95418;
    --tg-text: #333;
    --tg-muted: #777;
    --tg-line: #e4e4e4;
    --tg-green: #2d7a45;
    --tg-green-bg: #edf7f0;
    --tg-orange-bg: #fff2e9;

    width: 100%;
    max-width: 100%;
    color: var(--tg-text);
    font-size: 16px;
    line-height: 1.5;
}

.tg-wrap * { box-sizing: border-box; }

.tg-section {
    margin: 0 0 42px;
    padding: 0 0 34px;
    border-bottom: 1px solid var(--tg-line);
}

.tg-list-section {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.tg-section-title { margin-bottom: 22px; }

.tg-section-title h3 {
    margin: 0 0 5px;
    padding: 0;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 600;
}

.tg-section-title p {
    margin: 0;
    color: var(--tg-muted);
    font-size: 15px;
}

.tg-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.25fr) minmax(150px, .7fr) auto;
    gap: 18px;
    align-items: end;
    max-width: 800px;
}

.tg-field label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
}

.tg-field input[type="text"],
.tg-field input[type="time"],
.tg-wrap #loginform input[type="text"],
.tg-wrap #loginform input[type="password"] {
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 13px;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    background: #fff;
    color: var(--tg-text);
    font: inherit;
    font-size: 16px;
    box-shadow: none;
}

.tg-input-wrap { position: relative; }
.tg-input-wrap input { padding-right: 48px !important; cursor: pointer; }

.tg-calendar-button {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 44px;
    height: 44px;
    border: 0;
    border-left: 1px solid #ddd;
    border-radius: 0 3px 3px 0;
    background: #f7f7f7;
    color: #666;
    font-size: 18px;
    cursor: pointer;
}

.tg-primary,
.tg-wrap #wp-submit {
    height: 46px;
    padding: 0 20px;
    border: 1px solid var(--tg-accent);
    border-radius: 4px;
    background: var(--tg-accent);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.tg-primary:hover,
.tg-wrap #wp-submit:hover {
    background: var(--tg-accent-hover);
    border-color: var(--tg-accent-hover);
}

.tg-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.tg-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: collapse;
    table-layout: auto;
}

.tg-table th {
    padding: 10px 9px;
    border-bottom: 1px solid #cfcfcf;
    color: #666;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.tg-table td {
    padding: 14px 9px;
    border-bottom: 1px solid var(--tg-line);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

.tg-table th:first-child,
.tg-table td:first-child { padding-left: 0; }

.tg-table th:last-child,
.tg-table td:last-child {
    padding-right: 0;
    text-align: right;
}

.tg-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.tg-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.tg-status-free {
    color: var(--tg-green);
    background: var(--tg-green-bg);
}

.tg-status-booked {
    color: #a6531e;
    background: var(--tg-orange-bg);
}

.tg-contact-link {
    color: inherit;
    text-decoration: none;
    word-break: break-word;
}

.tg-contact-link:hover {
    color: var(--tg-accent);
    text-decoration: underline;
}

.tg-delete,
.tg-release {
    padding: 6px 11px;
    border-radius: 4px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.tg-delete {
    border: 1px solid #ccc;
    color: #555;
}

.tg-delete:hover {
    color: #9a3a2c;
    border-color: #9a3a2c;
}

.tg-release {
    border: 1px solid var(--tg-accent);
    color: var(--tg-accent);
}

.tg-release:hover {
    background: #fff7f1;
    color: var(--tg-accent-hover);
    border-color: var(--tg-accent-hover);
}

.tg-message {
    margin: 0 0 24px;
    padding: 12px 14px;
    border-left: 3px solid;
    font-size: 15px;
}

.tg-message-success {
    background: var(--tg-green-bg);
    border-color: var(--tg-green);
}

.tg-message-error {
    background: #fff0ef;
    border-color: #b44339;
}

.tg-empty,
.tg-intro { margin: 0; color: var(--tg-muted); }
.tg-muted { color: #999; }

.tg-login { max-width: 460px; }
.tg-wrap #loginform { margin-top: 20px; }
.tg-wrap #loginform p { margin: 0 0 15px; }
.tg-wrap #loginform label {
    display: block;
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
}

/* Datepicker */
#ui-datepicker-div {
    display: none;
    width: 308px;
    padding: 10px;
    border: 1px solid #d7d7d7;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0,0,0,.15);
    z-index: 999999 !important;
    font-size: 14px;
}

.ui-datepicker-header {
    position: relative;
    min-height: 40px;
    margin-bottom: 6px;
    text-align: center;
}

.ui-datepicker-title {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding-top: 4px;
}

.ui-datepicker-title select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
}

.ui-datepicker-prev,
.ui-datepicker-next {
    position: absolute;
    top: 5px;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.ui-datepicker-prev { left: 0; }
.ui-datepicker-next { right: 0; }

.ui-datepicker-prev::after,
.ui-datepicker-next::after {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: #555;
    font-size: 21px;
}

.ui-datepicker-prev::after { content: "‹"; }
.ui-datepicker-next::after { content: "›"; }

.ui-datepicker-prev span,
.ui-datepicker-next span { display: none; }

.ui-datepicker table { width: 100%; border-collapse: collapse; }
.ui-datepicker th { padding: 5px 2px; text-align: center; color: #777; font-size: 12px; }
.ui-datepicker td { padding: 2px; }

.ui-datepicker td a,
.ui-datepicker td span {
    display: block;
    padding: 7px 4px;
    border-radius: 3px;
    color: #333;
    text-align: center;
    text-decoration: none;
}

.ui-datepicker td a:hover { background: #f2f2f2; }
.ui-datepicker .ui-datepicker-current-day a { background: var(--tg-accent, #d56823); color: #fff; }
.ui-datepicker .ui-datepicker-today a { box-shadow: inset 0 0 0 1px var(--tg-accent, #d56823); }
.ui-datepicker .ui-state-disabled span { color: #c4c4c4; }

/* CF7 */
.wpcf7 .tg-cf7-terminauswahl {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    background: #fff;
    font: inherit;
    font-size: 16px;
}

.wpcf7 .tg-cf7-terminauswahl:focus {
    outline: none;
    border-color: #d56823;
    box-shadow: 0 0 0 2px rgba(213,104,35,.10);
}

.wpcf7 .tg-cf7-no-termine {
    display: block;
    margin-top: 8px;
    color: #777;
    font-size: 14px;
}

@media (max-width: 900px) {
    .tg-table-wrap {
        overflow: visible;
    }

    .tg-table {
        min-width: 0;
    }

    .tg-table thead {
        display: none;
    }

    .tg-table,
    .tg-table tbody,
    .tg-table tr,
    .tg-table td {
        display: block;
        width: 100%;
    }

    .tg-table tr {
        margin: 0 0 16px;
        padding: 14px 16px;
        border: 1px solid var(--tg-line);
        border-radius: 6px;
    }

    .tg-table td,
    .tg-table td:first-child,
    .tg-table td:last-child {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 18px;
        padding: 7px 0;
        border: 0;
        text-align: right;
        font-size: 14px;
    }

    .tg-table td::before {
        content: attr(data-label);
        flex: 0 0 95px;
        text-align: left;
        color: #777;
        font-size: 13px;
        font-weight: 600;
    }

    .tg-table td > * {
        max-width: calc(100% - 115px);
    }

    .tg-action-cell form {
        margin-left: auto;
    }
}

@media (max-width: 767px) {
    .tg-section { margin-bottom: 32px; padding-bottom: 28px; }
    .tg-section-title h3 { font-size: 21px; }
    .tg-form { grid-template-columns: 1fr; gap: 14px; }
    .tg-primary { width: 100%; }

    .tg-release,
    .tg-delete {
        width: auto;
        max-width: 180px;
    }

    #ui-datepicker-div {
        width: min(308px, calc(100vw - 24px));
    }
}


/* CF7 Validierung für die dynamische Terminauswahl */
.wpcf7 .tg-cf7-terminauswahl.wpcf7-not-valid {
    border-color: #dc3232 !important;
}

.wpcf7 .termin .wpcf7-not-valid-tip,
.wpcf7 .wpcf7-form-control-wrap.termin .wpcf7-not-valid-tip {
    display: block !important;
    margin-top: 5px !important;
    color: #dc3232 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}


/* CF7 5.x/6.x: Fehlerausgabe der dynamischen Terminauswahl */
.wpcf7-form-control-wrap[data-name="termin"] .wpcf7-not-valid-tip {
    display: block !important;
    margin-top: 5px !important;
    color: #dc3232 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

.wpcf7-form-control-wrap[data-name="termin"] select.wpcf7-not-valid {
    border-color: #dc3232 !important;
}


/* Frontend-Zugang Dietmar */
.tg-userbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 24px;
    padding: 10px 0 12px;
    border-bottom: 1px solid var(--tg-line);
    color: var(--tg-muted);
    font-size: 14px;
}

.tg-userbar a {
    color: var(--tg-accent);
    font-weight: 600;
    text-decoration: none;
}

.tg-userbar a:hover {
    color: var(--tg-accent-hover);
    text-decoration: underline;
}

@media (max-width: 767px) {
    .tg-userbar {
        display: block;
    }

    .tg-userbar span {
        display: block;
        margin: 0 0 5px;
    }

    .tg-userbar a {
        display: inline-block;
    }
}


/* =========================================================
 * Öffentliches Buchungsformular als elegantes Modal / Overlay
 * ========================================================= */

.tg-booking-modal-component {
    margin: 0;
    padding: 0;
}

.tg-modal-trigger {
    display: inline-block;
    min-height: 48px;
    padding: 11px 22px;
    border: 1px solid #d56823;
    border-radius: 4px;
    background: #d56823;
    color: #ffffff;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
}

.tg-modal-trigger:hover,
.tg-modal-trigger:focus {
    background: #b95418;
    border-color: #b95418;
    color: #ffffff;
}

.tg-booking-modal {
    display: none;
    position: fixed;
    z-index: 2147483000;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.tg-booking-modal.tg-modal-is-open {
    display: block;
}

.tg-modal-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(28, 34, 36, 0.72);
    cursor: pointer;
}

.tg-modal-window {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 92%;
    max-width: 820px;
    max-height: 88vh;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.30);
    transform: translate(-50%, -50%);
    -webkit-overflow-scrolling: touch;
}

.tg-modal-accent {
    height: 5px;
    background: #d56823;
}

.tg-modal-close {
    position: absolute;
    z-index: 4;
    top: 17px;
    right: 18px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #dddddd;
    border-radius: 50%;
    background: #ffffff;
    color: #555555;
    font-family: Arial, sans-serif;
    font-size: 27px;
    font-weight: 300;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.tg-modal-close:hover,
.tg-modal-close:focus {
    border-color: #d56823;
    color: #d56823;
    outline: none;
}

.tg-modal-content {
    padding: 34px 42px 38px;
    text-align: left;
}

.tg-modal-content .wpcf7 {
    margin: 0;
}

/* Das Formular bringt seine eigene Überschrift mit. */
.tg-modal-content .cf7-erstgespraech {
    max-width: none;
    margin: 0;
}

.tg-modal-content .cf7-erstgespraech-intro {
    margin-right: 48px;
    margin-bottom: 22px;
}

.tg-modal-content .cf7-erstgespraech-intro h3 {
    margin-top: 0;
    font-size: 24px;
    line-height: 1.3;
}

.tg-modal-body-open {
    overflow: hidden !important;
}

.tg-modal-error {
    padding: 12px 14px;
    border-left: 3px solid #b44339;
    background: #fff0ef;
    color: #333333;
}

@media (max-width: 767px) {

    .tg-modal-trigger {
        width: 100%;
    }

    .tg-modal-window {
        width: 94%;
        max-height: 94vh;
        border-radius: 8px;
    }

    .tg-modal-content {
        padding: 28px 20px 26px;
    }

    .tg-modal-content .cf7-erstgespraech-intro {
        margin-right: 40px;
        margin-bottom: 18px;
    }

    .tg-modal-content .cf7-erstgespraech-intro h3 {
        font-size: 21px;
    }

    .tg-modal-close {
        top: 13px;
        right: 13px;
        width: 36px;
        height: 36px;
        font-size: 25px;
        line-height: 32px;
    }
}


/* Zusätzliche Schließen-Möglichkeit am Ende des Formulars
   – besonders wichtig für iPhone / mobile Nutzung. */
.tg-modal-footer {
    margin: 28px 0 0;
    padding: 20px 0 0;
    border-top: 1px solid #e6e6e6;
    text-align: center;
}

.tg-modal-bottom-close {
    min-height: 46px;
    padding: 10px 22px;
    border: 1px solid #d56823;
    border-radius: 4px;
    background: #ffffff;
    color: #d56823;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

.tg-modal-bottom-close:hover,
.tg-modal-bottom-close:focus {
    background: #d56823;
    color: #ffffff;
    outline: none;
}

@media (max-width: 767px) {
    .tg-modal-footer {
        margin-top: 24px;
        padding-top: 18px;
    }

    .tg-modal-bottom-close {
        width: 100%;
        min-height: 50px;
        font-size: 16px;
    }
}


/* Vergangene gebuchte Termine / Datenschutz */
.tg-privacy-reminder {
    margin: 0 0 20px;
    padding: 12px 14px;
    border-left: 3px solid #d56823;
    background: #fff7f1;
    color: #4a4038;
    font-size: 14px;
    line-height: 1.5;
}

.tg-row-past-booked td {
    background: #fffaf6;
}

.tg-status-past {
    color: #8a4a1f;
    background: #f9eadf;
}

.tg-past-action {
    display: inline-block;
    max-width: 220px;
    text-align: right;
}

.tg-delete-past {
    padding: 6px 11px;
    border: 1px solid #b44339;
    border-radius: 4px;
    background: #ffffff;
    color: #b44339;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.tg-delete-past:hover {
    background: #fff0ef;
}

.tg-past-action small {
    display: block;
    margin-top: 5px;
    color: #8a6b5d;
    font-size: 11px;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .tg-past-action {
        max-width: calc(100% - 115px);
    }

    .tg-past-action small {
        text-align: right;
    }
}
