/* ==================================================
   Live-Vorschau Box (Design-Tab)
   ================================================== */

/* Standardmäßig ausgeblendet */
.simpbook-form-preview-box {
    display: none;
}

/* Nur anzeigen, wenn Design-Tab aktiv ist */
.simpbook-tabs #tab-design:checked ~ .simpbook-form-preview-box {
    display: block;
}

/* Design-Tab-Content begrenzen für Platz rechts */
.simpbook-tabs #tab-design:checked ~ #content-design {
    max-width: 900px;
}

/* Auf großen Bildschirmen: Vorschau-Box fest rechts neben Content */
@media (min-width: 1600px) {
    body.wp-admin .simpbook-tabs #tab-design:checked ~ .simpbook-form-preview-box {
        position: fixed !important;
        top: 130px;
        left: calc(160px + 20px + 900px + 20px);
        width: 780px;
        z-index: 100;
    }

    /* Adminmenü eingeklappt: Position anpassen */
    body.folded .simpbook-tabs #tab-design:checked ~ .simpbook-form-preview-box {
        left: calc(36px + 20px + 900px + 20px) !important;
    }

    .simpbook-tabs {
        position: relative;
    }
}

/* Kleinere Bildschirme: Vorschau unterhalb des Contents */
@media (max-width: 1599px) {
    .simpbook-tabs #tab-design:checked ~ #content-design {
        max-width: 100%;
    }

    .simpbook-tabs #tab-design:checked ~ .simpbook-form-preview-box {
        position: relative !important;
        margin-top: 30px;
    }
}

.nav-tab-wrapper {
    margin-bottom: 20px;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.email-templates h3 {
    margin: 15px 0 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ccc;
}
.form-table td .description {
    margin-top: 5px;
}
.spezieller-tag-eintrag {
    padding: 10px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    display: flex; /* Flexbox für bessere Ausrichtung */
    flex-wrap: wrap; /* Umbruch bei Bedarf */
    align-items: center; /* Vertikale Zentrierung */
    gap: 10px; /* Abstand zwischen Elementen */
}
.spezieller-tag-eintrag strong {
    flex-basis: 150px; /* Feste Basisbreite für das Datum */
    flex-shrink: 0;
}
.urlaub-zeitraum-eintrag strong {
    flex-basis: auto;
    white-space: nowrap;
}
/* Urlaubs-Tage im Datepicker: orangefarbene Markierung */
.ui-datepicker-calendar td.urlaub-gesperrt-tag span.ui-state-default,
.ui-datepicker-calendar td.urlaub-gesperrt-tag a.ui-state-default {
    background: #fff3e0 !important;
    border-color: #ffb74d !important;
    color: #e65100 !important;
    cursor: not-allowed !important;
}
/* Spezielle geschlossene Tage im Urlaubs-Datepicker: rot */
.ui-datepicker-calendar td.speziell-geschlossen-tag span.ui-state-default,
.ui-datepicker-calendar td.speziell-geschlossen-tag a.ui-state-default {
    background: #fce4e4 !important;
    border-color: #e57373 !important;
    color: #c62828 !important;
    cursor: not-allowed !important;
}
/* Geschlossene Wochentage im Urlaubs-Datepicker: grau */
.ui-datepicker-calendar td.deaktivierter-wochentag span.ui-state-default,
.ui-datepicker-calendar td.deaktivierter-wochentag a.ui-state-default {
    background: #f5f5f5 !important;
    border-color: #ddd !important;
    color: #bbb !important;
    cursor: not-allowed !important;
}
.spezieller-tag-eintrag select.spezieller-tag-status {
     flex-basis: 200px; /* Breite für das Select-Feld */
     flex-shrink: 0;
}
.wochentag-zeiten-inputs,
.spezielle-zeiten-inputs {
    display: inline-flex;
    gap: 15px;
    align-items: center;
    flex-grow: 0;
    margin-top: 8px;
    flex-direction: row;
}
.time-input-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.time-label {
    font-weight: 500;
    color: #50575e;
    white-space: nowrap;
    min-width: auto;
}
.time-input {
    padding: 4px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    min-width: 100px;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.time-input:hover {
    border-color: #2271b1;
}
.time-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}
.ampm-select {
    margin-left: 8px;
    vertical-align: middle;
    width: 70px;
    max-width: 70px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
}
.ampm-toggle {
    margin-left: 8px;
    vertical-align: middle;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.ampm-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    min-width: 36px;
    line-height: 1;
}
.ampm-btn.active,
.ampm-btn[aria-pressed="true"] {
    background: #2271b1;
    color: #fff;
    border-color: #135e96;
}
.ampm-btn:focus {
    outline: 2px solid rgba(34,113,177,0.25);
    outline-offset: 2px;
}
.remove-speziellen-tag-btn {
    margin-left: auto; /* Drückt den Button nach rechts */
    color: #a00 !important;
    text-decoration: none !important;
    border: none !important;
    background: none !important;
    cursor: pointer;
    padding: 5px;
}
.remove-speziellen-tag-btn:hover {
    color: #f00 !important;
}
.ui-datepicker .ui-state-disabled .ui-state-default {
    opacity: 0.7 !important;
    background: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    border: 1px solid #ddd !important;
}
div.ui-datepicker {
    font-size: 14px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 1000 !important;
    width: 300px !important;
    padding: 0 !important;
    background-color: #ffffff !important;
    border: 1px solid #ddd !important;
}
.ui-datepicker-header {
    background: var(--simpbook-container-bg) !important;
    color: var( --simpbook-text-color) !important;
    border-radius: 4px 4px 0 0;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 5px !important;
    border-bottom: 1px solid #135e96;
}
.ui-datepicker-prev {
    order: 1;
    flex-shrink: 0;
    position: relative !important; top: auto !important; left: auto !important; right: auto !important;
    background-color: var(--simpbook-button-color) !important; border: none !important; cursor: pointer;
    margin-left: 5px !important;
}
.ui-datepicker-title {
    order: 2;
    flex-grow: 1;
    text-align: center !important;
    margin: 0 0.5em !important;
    line-height: 1.8em !important;
    font-weight: bold;
}
.ui-datepicker-next {
    order: 3;
    flex-shrink: 0;
    position: relative !important; top: auto !important; left: auto !important; right: auto !important;
    background-color: var(--simpbook-button-color) !important; border: none !important; cursor: pointer;
    margin-right: 5px !important;
}
.ui-datepicker-prev .ui-icon,
.ui-datepicker-next .ui-icon {
    background-image: none !important;
    text-indent: -9999px !important;
    overflow: hidden;
    width: 1.2em; height: 1.2em;
    display: inline-block; position: relative; vertical-align: middle;
}
.ui-datepicker-prev .ui-icon::before {
    content: ''; display: block; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFFFFF'%3E%3Cpath d='M11.043 1.561a.75.75 0 00-1.061 0L4.779 6.764a.75.75 0 000 1.06L9.982 13.03a.75.75 0 101.06-1.061L6.37 7.294l4.673-4.673a.75.75 0 000-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center center; background-size: contain;
}
.ui-datepicker-next .ui-icon::before {
    content: ''; display: block; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFFFFF'%3E%3Cpath d='M5.018 1.561a.75.75 0 011.061 0l5.203 5.203a.75.75 0 010 1.06l-5.203 5.203a.75.75 0 11-1.06-1.061L9.63 7.294 5.018 2.622a.75.75 0 010-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center center; background-size: contain;
}
.ui-datepicker-calendar {
    width: 100%; border-collapse: collapse; margin: 0;
}
.ui-datepicker-calendar th {
    background-color: #f7f7f7 !important; color: #333 !important;
    padding: 5px 2px !important; font-size: 12px !important; line-height: 1.2 !important;
    text-align: center; font-weight: bold;
}
.ui-datepicker-calendar td {
    padding: 1px !important; border: none;
}
.ui-datepicker-calendar td a.ui-state-default,
.ui-datepicker-calendar td span.ui-state-default {
    display: block !important; box-sizing: border-box !important; width: 100% !important;
    text-align: center !important; text-decoration: none !important;
    padding: 5px 2px !important; font-size: 13px !important; line-height: 1.4em !important;
    border-radius: 3px !important; border: 1px solid #ddd !important;
    color: #333 !important; background: #fdfdfd !important; opacity: 1.0 !important;
}
.ui-datepicker-calendar td a.ui-state-hover {
    background: #e0f7ff !important; border-color: #99d1ff !important; color: #004a7c !important;
}
.ui-datepicker-calendar td.ui-datepicker-today a.ui-state-default,
.ui-datepicker-calendar td.ui-datepicker-today span.ui-state-default {
    background: #fffadd !important; border-color: #fcefae !important; color: #363636 !important; font-weight: bold;
}
.ui-datepicker-calendar td.ui-datepicker-current-day a.ui-state-default,
.ui-datepicker-calendar td.ui-datepicker-current-day span.ui-state-default {
    background: #2271b1 !important; color: #ffffff !important; border-color: #135e96 !important; font-weight: bold;
}
.ui-datepicker-calendar td.ui-state-disabled span.ui-state-default,
.ui-datepicker-calendar td.ui-state-disabled a.ui-state-default {
    background-color: var(--simpbook-container-bg) !important;
    color:rgb(9, 9, 9) !important;
    opacity: 0.9 !important;
    border-color:rgb(128, 117, 118) !important;
}
.simpbook-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Spezielle Ansicht für den Öffnungszeiten-Tab */
#content-opening-hours .simpbook-settings-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}
.simpbook-setting-card {
    border: 1px solid #b3bce3;
    border-radius: 8px;
    padding: 20px;
    background: #f9f9f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.simpbook-setting-card:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}
.simpbook-setting-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #2271b1;
}
.simpbook-setting-card strong {
    display: block;
    font-size: 18px;
    color: #2271b1;
    margin: 10px 0;
    font-weight: bold;
}
.simpbook-setting-card .description {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 10px 0 0 0;
}
.simpbook-setting-card select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    margin: 10px 0;
}
.simpbook-setting-card select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}
.simpbook-settings-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}
.simpbook-setting-full-width {
    grid-column: 1 / -1;
}
.time-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
@media (max-width: 782px) {
    div.ui-datepicker {
        width: 90% !important; max-width: none;
        background-color: #ffffff !important; /* White background for the datepicker container */
        border: 1px solid #ddd !important; /* Border for the datepicker container */
    }
    .ui-datepicker-calendar th {
        padding: 3px 1px !important; font-size: 11px !important;
    }
    .ui-datepicker-calendar td a.ui-state-default,
    .ui-datepicker-calendar td span.ui-state-default {
        font-size: 12px !important; padding: 4px 1px !important;
    }
    .spezieller-tag-eintrag {
        flex-direction: column;
        align-items: flex-start; /* Bessere Ausrichtung für mobile Ansicht */
    }
    .spezieller-tag-eintrag strong,
    .spezieller-tag-eintrag select.spezieller-tag-status,
    .spezielle-zeiten-inputs,
    .remove-speziellen-tag-btn {
        width: 100%; /* Volle Breite für mobile Ansicht */
        margin-left: 0;
        flex-basis: auto; /* Automatische Basisbreite */
    }
    .wochentag-zeiten-inputs,
    .spezielle-zeiten-inputs {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .time-input-group {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .time-label {
        min-width: 50px;
    }
    .time-input {
        flex: 1;
    }
    .remove-speziellen-tag-btn {
        text-align: right; /* Button-Text rechtsbündig */
        margin-top: 5px;
    }
    .simpbook-settings-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .simpbook-settings-grid-2col {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .simpbook-setting-card {
        padding: 15px;
    }
}

/* ============================================
   Tab System Styles — Pill Bar
   ============================================ */

.simpbook-tabs {
    position: relative;
    background: transparent;
    border-bottom: none;
    margin-bottom: 0;
}

.simpbook-tabs::after { display: none; }

.simpbook-tabs input[type="radio"] { display: none; }

.simpbook-tabs-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    background: #1a4a8a;
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 10px;
}

.simpbook-tabs-bar label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 15px;
    transition: all 0.2s;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.simpbook-tabs-bar label:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.simpbook-tabs-bar label.is-active {
    background: #fff;
    color: #1a4a8a;
}

.simpbook-tabs-bar label .dashicons {
    font-size: 15px;
    width: 15px;
    height: 15px;
    line-height: 1;
}

.simpbook-tab-content {
    display: none;
    background: #fff;
    border: 2px solid #1a4a8a;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 0;
    clear: both;
    width: 100%;
    box-sizing: border-box;
}

/* Show specific tab content when corresponding radio is checked */
.simpbook-tabs #tab-general:checked ~ #content-general,
.simpbook-tabs #tab-opening-hours:checked ~ #content-opening-hours,
.simpbook-tabs #tab-cancellations:checked ~ #content-cancellations,
.simpbook-tabs #tab-emails:checked ~ #content-emails,
.simpbook-tabs #tab-design:checked ~ #content-design,
.simpbook-tabs #tab-language:checked ~ #content-language,
.simpbook-tabs #tab-app:checked ~ #content-app {
    display: block !important;
}

/* ============================================
   Toggle Switch
   ============================================ */

.spb-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.spb-toggle-wrap input[type="checkbox"] { display: none; }

.spb-toggle-slider {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    background: #c5c5c5;
    border-radius: 100px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.spb-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: left 0.2s;
}

.spb-toggle-wrap input:checked + .spb-toggle-slider { background: #2271b1; }
.spb-toggle-wrap input:checked + .spb-toggle-slider::after { left: 20px; }

.spb-toggle-label {
    font-size: 13px;
    color: #1d2327;
    user-select: none;
}

/* ============================================
   App Tab - TR als Kacheln (wie simpbook-setting-card)
   ============================================ */
#content-app .form-table {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    border-collapse: separate;
    border-spacing: 0;
}

#content-app .form-table tbody {
    display: contents;
}

#content-app .form-table tr {
    display: flex;
    flex-direction: column;
    border: 1px solid #b3bce3;
    border-radius: 8px;
    padding: 15px 20px;
    background: #f9f9f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    margin: 0;
}

#content-app .form-table tr:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

#content-app .form-table th {
    display: block;
    padding: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    border-bottom: none;
    width: 100%;
}

#content-app .form-table td {
    display: block;
    padding: 0;
    width: 100%;
}

#content-app .form-table td .description {
    margin-top: 8px;
    color: #666;
    font-size: 13px;
}

/* Responsive: App Tab Kacheln auf kleinen Bildschirmen untereinander */
@media screen and (max-width: 782px) {
    #content-app .form-table {
        grid-template-columns: 1fr;
    }
}

/* Responsive Tabs */
@media screen and (max-width: 768px) {
    .simpbook-tabs label {
        display: block;
        margin-right: 0;
        margin-bottom: 4px;
        border-radius: 8px;
        border: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
    }
    
    .simpbook-tabs {
        margin-top: 30px !important;
    }
    
    .simpbook-tabs input[type="radio"]:checked + label {
        border-bottom: 1px solid var(--simpbook-primary-color, #667eea);
        margin-bottom: 0;
    }
    
    .simpbook-tab-content {
        border-radius: 8px;
        margin-top: 0;
    }
}

/* ============================================
   Tooltip Styles
   ============================================ */
.simpbook-tooltip-trigger {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    cursor: help;
    color: #2271b1;
    vertical-align: middle;
    z-index: 10001;
}

.simpbook-tooltip-trigger .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

.simpbook-tooltip-trigger:hover .dashicons {
    color: #135e96;
}

.simpbook-tooltip {
    position: absolute;
    background: #1d2327;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    width: 400px;
    max-width: 90vw;
    z-index: 999999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    white-space: normal;
    word-wrap: break-word;
}

.simpbook-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1d2327;
}

.simpbook-tooltip-trigger:hover .simpbook-tooltip,
.simpbook-tooltip-trigger.active .simpbook-tooltip {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 782px) {
    .simpbook-tooltip {
        max-width: 250px;
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ============================================
   Color Picker Group
   ============================================ */
.simpbook-color-picker-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    max-width: 100%;
    margin-top: 5px;
}

.simpbook-color-picker-group input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    cursor: pointer;
}

.simpbook-color-picker-group .simpbook-color-text-input {
    width: 150px;
    max-width: 100%;
    padding: 6px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
}

.simpbook-color-picker-group .button {
    margin-top: 0;
}

@media (min-width: 782px) {
    .simpbook-color-picker-group {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .simpbook-color-picker-group input[type="color"] {
        flex-shrink: 0;
    }
    
    .simpbook-color-picker-group .simpbook-color-text-input {
        flex-shrink: 0;
    }
}

/* ============================================
   App Install Box (PWA Einstellungen)
   ============================================ */
.simpbook-app-install-box {
    background: linear-gradient(135deg, var(--simpbook-container-bg, #667eea) 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    margin-top: 30px;
    text-align: center;
}

.simpbook-app-install-box h3 {
    margin: 0 0 15px;
    font-size: 28px;
    color: white;
    font-weight: 700;
}

.simpbook-app-install-box p {
    margin: 0 0 25px;
    opacity: 0.9;
    font-size: 16px;
    line-height: 1.5;
}

.simpbook-app-install-box .button {
    padding: 5px 20px;
    height: auto;
    font-weight: 600;
}

.simpbook-app-install-box .qr-code-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

.simpbook-app-install-box .qr-code-container img {
    display: block;
    width: 180px;
    height: 180px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.simpbook-app-install-instructions {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.simpbook-app-install-instructions h4 {
    margin: 0 0 15px;
    font-size: 16px;
    color: white;
    font-weight: 600;
}

.simpbook-app-install-instructions .instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.simpbook-app-install-instructions .instruction-card {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 8px;
}

.simpbook-app-install-instructions .instruction-card h5 {
    margin: 0 0 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.simpbook-app-install-instructions .instruction-card ol {
    margin: 0;
    padding-left: 20px;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    line-height: 1.8;
}

/* Mobile Only Utility */
.simpbook-mobile-only {
    display: none !important;
}

@media (max-width: 782px) {
    .simpbook-mobile-only {
        display: flex !important;
    }
}

/* App Install Box Responsive - Desktop Side Position */
@media (min-width: 1400px) {
    body.wp-admin .simpbook-admin-wrap:has(.simpbook-tabs) {
        position: relative;
        width: 60% !important;
        max-width: 900px !important;
    }
    
    .simpbook-app-install-box {
        position: absolute !important;
        left: calc(100% + 30px) !important;
        top: 80px !important;
        width: 350px !important;
        max-width: 350px !important;
        margin: 0 !important;
        padding: 30px 20px !important;
    }
    
    .simpbook-app-install-box h3 {
        font-size: 22px !important;
    }
    
    .simpbook-app-install-box > div:first-child {
        min-height: auto !important;
        gap: 20px !important;
    }
}

/* Tablet and smaller: Keep box below content */
@media (max-width: 1399px) {
    body.wp-admin .simpbook-admin-wrap:has(.simpbook-tabs) {
        position: relative;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .simpbook-app-install-box {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        max-width: 100% !important;
        margin-top: 30px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ============================================
   PWA Mode Settings Grid Anpassungen
   ============================================ */
body.simpbook-pwa-mode .simpbook-admin-wrap .simpbook-setting-full-width {
    grid-column: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

body.simpbook-pwa-mode .simpbook-setting-card > div > label {
    display: flex !important;
    flex-direction: column;
    gap: 8px !important;
    align-items: flex-start !important;
}

body.simpbook-pwa-mode .simpbook-setting-card label input[type="checkbox"] {
    margin: 0 !important;
}

/* ============================================
   PWA Mode: Viewport-Kontrolle für Einstellungen
   Verhindert horizontalen Overflow
   ============================================ */
body.simpbook-pwa-mode .wrap.simpbook-admin-wrap {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

body.simpbook-pwa-mode .simpbook-tabs,
body.simpbook-pwa-mode .tab-content {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

body.simpbook-pwa-mode .simpbook-setting-card,
body.simpbook-pwa-mode .form-table {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* ============================================
   Responsive Grid-Klassen (für PWA-freundliche Layouts)
   Ersetzen inline minmax() Grid-Styles
   ============================================ */
.simpbook-responsive-grid,
.simpbook-push-grid,
.simpbook-install-grid {
    display: grid;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Desktop: 2 Spalten */
@media (min-width: 783px) {
    .simpbook-responsive-grid,
    .simpbook-push-grid,
    .simpbook-install-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile & PWA: 1 Spalte */
@media (max-width: 782px) {
    .simpbook-responsive-grid,
    .simpbook-push-grid,
    .simpbook-install-grid {
        grid-template-columns: 1fr;
    }
}

/* PWA-Modus: Erzwinge 1 Spalte auf kleineren Screens */
body.simpbook-pwa-mode .simpbook-responsive-grid,
body.simpbook-pwa-mode .simpbook-push-grid,
body.simpbook-pwa-mode .simpbook-install-grid {
    grid-template-columns: 1fr;
}

/* ==================================================
   Form Builder Tab
   ================================================== */

/* Hide preview by default */
#simpbook-fb-form-preview {
    display: none;
}

/* Show preview when formular tab is active */
.simpbook-tabs #tab-formular:checked ~ #simpbook-fb-form-preview {
    display: block;
}

/* Limit content width when formular tab active for preview space */
.simpbook-tabs #tab-formular:checked ~ #content-formular {
    max-width: 900px;
}

/* Large screens: fixed preview right of content */
@media (min-width: 1600px) {
    body.wp-admin .simpbook-tabs #tab-formular:checked ~ #simpbook-fb-form-preview {
        position: fixed !important;
        top: 130px;
        left: calc(160px + 20px + 900px + 20px);
        width: 780px;
        z-index: 100;
    }
    body.folded .simpbook-tabs #tab-formular:checked ~ #simpbook-fb-form-preview {
        left: calc(36px + 20px + 900px + 20px) !important;
    }
}

/* Smaller screens: preview below content */
@media (max-width: 1599px) {
    .simpbook-tabs #tab-formular:checked ~ #content-formular {
        max-width: 100%;
    }
    .simpbook-tabs #tab-formular:checked ~ #simpbook-fb-form-preview {
        position: relative !important;
        margin-top: 30px;
    }
}

/* ---- Form Builder Layout ---- */
.simpbook-fb-wrap {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.simpbook-fb-config {
    flex: 1;
    min-width: 0;
}

/* ---- Section ---- */
.simpbook-fb-section {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
}

.simpbook-fb-section h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

/* ---- Field rows ---- */
#simpbook-fb-fields-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.simpbook-fb-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: default;
    user-select: none;
}

.simpbook-fb-field-info {
    flex: 1;
    min-width: 0;
}

.simpbook-fb-field-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.simpbook-fb-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f0f0f1;
    color: #646970;
    border-radius: 3px;
    padding: 1px 5px;
    margin-top: 2px;
}

.simpbook-fb-field-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.simpbook-fb-placeholder-input {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    width: 130px;
    color: #1d2327;
}

/* ---- Toggle switch ---- */
/* WP admin overrides: label and checkbox need !important to fight admin CSS */
.simpbook-fb-field-row label.simpbook-fb-toggle {
    display: inline-block !important;
    background: none !important;
    background-color: transparent !important;
    min-height: unset !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    width: 36px !important;
    height: 20px !important;
    position: relative !important;
    flex-shrink: 0 !important;
    align-items: unset !important;
    color: inherit !important;
    transition: none !important;
    user-select: none;
    box-shadow: none !important;
}

.simpbook-fb-field-row label.simpbook-fb-toggle:hover {
    background: none !important;
    background-color: transparent !important;
    transform: none !important;
}

.simpbook-fb-field-row label.simpbook-fb-toggle input[type="checkbox"] {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    position: absolute !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}

.simpbook-fb-field-row .simpbook-fb-toggle-slider {
    position: absolute;
    inset: 0;
    background: #c3c4c7;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.simpbook-fb-field-row .simpbook-fb-toggle input:checked + .simpbook-fb-toggle-slider {
    background: #2271b1;
}

.simpbook-fb-field-row .simpbook-fb-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.simpbook-fb-field-row .simpbook-fb-toggle input:checked + .simpbook-fb-toggle-slider::before {
    transform: translateX(16px);
}

/* ---- Delete / Lock buttons ---- */
.simpbook-fb-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #d63638;
    font-size: 16px;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    transition: background 0.15s;
}

.simpbook-fb-delete-btn:hover {
    background: #fbeaea;
}

.simpbook-fb-lock {
    color: #c3c4c7;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
}

/* ---- Actions row ---- */
.simpbook-fb-actions-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.simpbook-fb-save-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.simpbook-fb-add-field {
    align-self: flex-start;
}

#simpbook-fb-save-status {
    font-size: 13px;
    color: #2da44e;
}

.simpbook-fb-req-label {
    font-size: 11px;
    color: #646970;
    white-space: nowrap;
}

/* ---- Type picker modal ---- */
.simpbook-fb-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    justify-content: center;
    align-items: center;
}

.simpbook-fb-modal-overlay.open {
    display: flex;
}

.simpbook-fb-modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 480px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    position: relative;
}

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

.simpbook-fb-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.simpbook-fb-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #646970;
    line-height: 1;
    padding: 0 4px;
}

.simpbook-fb-modal-close:hover {
    color: #d63638;
}

.simpbook-fb-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.simpbook-fb-type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #1d2327;
    transition: border-color 0.15s, background 0.15s;
}

.simpbook-fb-type-option:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.simpbook-fb-type-option.simpbook-fb-type-selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.simpbook-fb-type-option .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    color: #2271b1;
}

.simpbook-fb-type-desc {
    font-size: 11px;
    color: #646970;
    text-align: center;
}

.simpbook-fb-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.simpbook-fb-options-row {
    margin-top: 8px;
}

/* ============================================================
   Email Card & Preview System
   ============================================================ */

.simpbook-email-card {
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    border: 2px solid transparent;
}
.simpbook-email-card:hover {
    border-color: #2271b1;
}
.simpbook-email-card.is-active {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Preview box — hidden by default */
.simpbook-email-preview-box {
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 24px;
}
.simpbook-email-preview-box.is-visible {
    display: flex;
}

/* Preview header */
.simpbook-email-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0f6fc;
    border-bottom: 1px solid #c3c4c7;
    padding: 12px 16px;
}
.simpbook-email-preview-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}
.simpbook-email-preview-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #787c82;
    padding: 0 4px;
}
.simpbook-email-preview-close:hover {
    color: #1d2327;
}

/* Preview body */
.simpbook-email-preview-body {
    min-height: 300px;
}
.simpbook-email-preview-body iframe {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
}
.simpbook-email-preview-hint {
    padding: 40px 24px;
    text-align: center;
    color: #787c82;
    font-size: 14px;
}

/* Large screens: fixed to the right of the content area (same as design/form preview) */
@media (min-width: 1600px) {
    #content-emails.simpbook-email-preview-open {
        max-width: 900px;
    }
    body.wp-admin .simpbook-email-preview-box.is-visible {
        position: fixed !important;
        top: 130px;
        left: calc(160px + 20px + 900px + 20px);
        width: 600px;
        z-index: 100;
    }
    body.folded .simpbook-email-preview-box.is-visible {
        left: calc(36px + 20px + 900px + 20px) !important;
    }
}

/* Smaller screens: preview below content */
@media (max-width: 1599px) {
    .simpbook-email-preview-box.is-visible {
        margin-top: 24px;
        width: 100%;
    }
}
