/* =============================================================================
   PsychExpert – Kalender, Activity-Kachel & Event-Modal
   Mobile First | Breakpoint Desktop: min-width 768px
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Activity-Kachel (.psychexpert-activity-draggable)
   ----------------------------------------------------------------------------- */

.psychexpert-activity-draggable {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #fff;
    border: 2px dashed #3a7bd5;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.psychexpert-activity-draggable:active {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(58, 123, 213, 0.25);
    border-color: #2563b0;
}

.psychexpert-activity-draggable__icon {
    font-size: 20px;
    color: #3a7bd5;
    line-height: 1;
}

.psychexpert-activity-draggable__title {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
    line-height: 1.3;
}

.psychexpert-activity-draggable__meta {
    font-size: 12px;
    color: #6b7280;
}

@media (min-width: 768px) {
    .psychexpert-activity-draggable {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px 20px;
        margin-bottom: 20px;
    }

    .psychexpert-activity-draggable__meta {
        margin-left: auto;
    }
}

/* -----------------------------------------------------------------------------
   2. Kalender-Container (#psychexpert-calendar)
   ----------------------------------------------------------------------------- */

#psychexpert-calendar {
    width: 100%;
    min-height: 400px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 8px;
    box-sizing: border-box;
    font-size: 13px;
}

/* Kompakte Darstellung auf Mobile */
#psychexpert-calendar .fc-toolbar-title {
    font-size: 15px;
}

#psychexpert-calendar .fc-button {
    padding: 4px 8px;
    font-size: 12px;
}

#psychexpert-calendar .fc-event {
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
}

@media (min-width: 768px) {
    #psychexpert-calendar {
        min-height: 600px;
        padding: 16px;
        font-size: 14px;
    }

    #psychexpert-calendar .fc-toolbar-title {
        font-size: 18px;
    }

    #psychexpert-calendar .fc-button {
        padding: 6px 12px;
        font-size: 13px;
    }

    #psychexpert-calendar .fc-event {
        font-size: 13px;
    }
}

/* -----------------------------------------------------------------------------
   3. Modal (.psychexpert-modal)
   ----------------------------------------------------------------------------- */

.psychexpert-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.psychexpert-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    cursor: pointer;
}

.psychexpert-modal__card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    background: #fff;
    border-radius: 0;
    padding: 24px 20px 32px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.psychexpert-modal__title {
    margin: 0 0 20px;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

/* Felder */
.psychexpert-modal__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.psychexpert-modal__label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.psychexpert-modal__input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1a1a2e;
    background: #f9fafb;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.psychexpert-modal__input:focus {
    outline: none;
    border-color: #3a7bd5;
    background: #fff;
}

.psychexpert-modal__input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
    cursor: default;
}

.psychexpert-modal__input--sm {
    max-width: 120px;
}

/* Buttons */
.psychexpert-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.psychexpert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.psychexpert-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.psychexpert-btn--primary {
    background: #3a7bd5;
    color: #fff;
}

.psychexpert-btn--primary:hover:not(:disabled) {
    background: #2563b0;
}

.psychexpert-btn--danger {
    background: #ef4444;
    color: #fff;
}

.psychexpert-btn--danger:hover:not(:disabled) {
    background: #dc2626;
}

.psychexpert-btn--secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.psychexpert-btn--secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

@media (min-width: 768px) {
    .psychexpert-modal {
        align-items: center;
    }

    .psychexpert-modal__card {
        max-width: 480px;
        height: auto;
        max-height: 90vh;
        border-radius: 12px;
        padding: 32px 28px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
        overflow-y: auto;
    }

    .psychexpert-modal__title {
        font-size: 19px;
    }
}


/* =========================================================
   Gebuchte Termine im Gutachter-Kalender
   ========================================================= */
.psychexpert-event--booked {
    opacity: 0.75;
    cursor: default;
}

.psychexpert-event--booked .fc-event-main::before,
.psychexpert-event--booked .fc-list-event-title::before {
    content: 'Termin vergeben ';
    font-weight: bold;
}

/* -----------------------------------------------------------------------------
   4. Mobile: Activity-Kachel ausblenden, Mobile-Button einblenden
   ----------------------------------------------------------------------------- */

/* Activity-Kachel nur auf Desktop sichtbar */
@media (max-width: 767px) {
    .psychexpert-activity-draggable {
        display: none;
    }
}

/* Mobile-Button nur auf Mobile sichtbar */
#psychexpert-add-event-mobile {
    display: none;
}

.psychexpert-calendar-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 18px;
    margin: 0 0 12px;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 13px;
    line-height: 1.35;
}

.psychexpert-calendar-feedback[hidden] {
    display: none;
}

.psychexpert-calendar-feedback--info {
    background: #e8f3ff;
    border-color: #b6d8f5;
    color: #155a8a;
}

.psychexpert-calendar-feedback--success {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #1b5e20;
}

.psychexpert-calendar-feedback--error {
    background: #fdecea;
    border-color: #f5c6c6;
    color: #8b1a1a;
}

.psychexpert-calendar-feedback--loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: psychexpert-spin 0.7s linear infinite;
    flex: 0 0 auto;
}

@media (max-width: 767px) {
    #psychexpert-add-event-mobile {
        display: flex;
        width: 100%;
        justify-content: center;
        margin-bottom: 16px;
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* -----------------------------------------------------------------------------
   5. Saving-Zustand: Termin wird gerade angelegt (Drag & Drop)
   ----------------------------------------------------------------------------- */

@keyframes psychexpert-spin {
    to { transform: rotate(360deg); }
}

.psychexpert-event--saving {
    opacity: 0.85;
    pointer-events: none;
    position: relative;
    overflow: visible !important;
}

.psychexpert-event--saving .fc-event-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 6px;
}

.psychexpert-event--saving .fc-event-main::before {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: psychexpert-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.psychexpert-event--saving .fc-event-main::after {
    content: 'Termin wird angelegt';
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    line-height: 1.2;
}

/* Originalen Event-Titel während des Speicherns ausblenden */
.psychexpert-event--saving .fc-event-title,
.psychexpert-event--saving .fc-event-time,
.psychexpert-event--updating .fc-event-title,
.psychexpert-event--updating .fc-event-time,
.psychexpert-event--deleting .fc-event-title,
.psychexpert-event--deleting .fc-event-time {
    display: none;
}

/* -----------------------------------------------------------------------------
   6. Updating-Zustand: Termin wird gerade geändert (Modal-Speichern)
   ----------------------------------------------------------------------------- */

.psychexpert-event--updating {
    opacity: 0.85;
    pointer-events: none;
    position: relative;
    overflow: visible !important;
}

.psychexpert-event--updating .fc-event-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 6px;
}

.psychexpert-event--updating .fc-event-main::before {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: psychexpert-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.psychexpert-event--updating .fc-event-main::after {
    content: 'Termin wird geändert';
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    line-height: 1.2;
}

/* -----------------------------------------------------------------------------
   7. Deleting-Zustand: Termin wird gerade gelöscht
   ----------------------------------------------------------------------------- */

.psychexpert-event--deleting {
    opacity: 0.85;
    pointer-events: none;
    position: relative;
    overflow: visible !important;
    background-color: #c0392b !important;
    border-color: #a93226 !important;
}

.psychexpert-event--deleting .fc-event-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 6px;
}

.psychexpert-event--deleting .fc-event-main::before {
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: psychexpert-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.psychexpert-event--deleting .fc-event-main::after {
    content: 'Termin wird gelöscht';
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    line-height: 1.2;
}

/* -----------------------------------------------------------------------------
   8. Vergangene Tage: visuell ausgrauen
   ----------------------------------------------------------------------------- */

.psychexpert-past-day {
    background: rgba(0, 0, 0, 0.045) !important;
}

.fc-timegrid-col.fc-day-past {
    background: rgba(0, 0, 0, 0.03) !important;
}



/* =========================================================================
   Multi-Standort: Drag-Kacheln + Standortfilter (Phase 3)
   ========================================================================= */

.psychexpert-activity-draggables {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.psychexpert-activity-draggables .psychexpert-activity-draggable {
    margin-bottom: 0;
}

.psychexpert-location-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9em;
}

.psychexpert-location-filter__label {
    font-weight: 600;
}

.psychexpert-location-filter__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.psychexpert-location-filter__dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
