/* Frontend Styles */
.wsp-calendar-shell {
    background: #f3f4f6;
    padding: 16px;
    box-sizing: border-box;
    color: #4a3728;
}

.wsp-calendar-card {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(74, 55, 40, 0.12);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wsp-calendar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: radial-gradient(circle at top right, rgba(184, 133, 106, 0.06), transparent 55%);
}

.wsp-calendar-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wsp-calendar-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #b8856a;
    box-shadow: 0 0 14px rgba(184, 133, 106, 0.5);
}

.wsp-calendar-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
}

.wsp-calendar-main {
    display: flex;
    flex-wrap: wrap;
    min-height: 540px;
    border-top: 1px solid #e5e7eb;
}

.wsp-calendar-panel {
    flex: 1 1 400px;
    min-width: 280px;
    padding: 14px 18px 18px;
    box-sizing: border-box;
    background: #ffffff;
}

.wsp-calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    align-items: center;
    justify-content: space-between;
}

.wsp-toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wsp-toolbar-group-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.wsp-nav-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    font-size: 0.78rem;
    color: #6b7280;
    cursor: pointer;
}

.wsp-nav-today {
    padding: 6px 10px;
    border-radius: 999px;
    background: #faf5f0;
    border: 1px solid rgba(184, 133, 106, 0.9);
    font-size: 0.78rem;
    color: #b8856a;
    cursor: pointer;
}

.wsp-toolbar-label {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 160px;
}

.wsp-current-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: #4a3728;
    white-space: nowrap;
}

.wsp-date-jump {
    background: #ffffff;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    padding: 5px 9px;
    font-size: 0.78rem;
    color: #6b7280;
    outline: none;
    min-width: 130px;
}

.wsp-print-calendar {
    padding: 6px 10px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    font-size: 0.78rem;
    color: #374151;
    cursor: pointer;
}

.wsp-view-toggle {
    display: inline-flex;
    align-items: center;
    background: #f9fafb;
    border-radius: 999px;
    padding: 3px;
    border: 1px solid #e5e7eb;
}

.wsp-view-toggle button {
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    min-width: 48px;
}

.wsp-view-toggle button.is-active {
    background: #b8856a;
    color: #ffffff;
}

.wsp-machine-row {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wsp-machine-label {
    font-size: 0.78rem;
    color: #6b7280;
}

.wsp-machine-select {
    background: #ffffff;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    padding: 5px 12px;
    font-size: 0.78rem;
    color: #374151;
}

.wsp-helper-text {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 6px;
}

.wsp-calendar-grid {
    margin-top: 8px;
    display: grid;
    gap: 0;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    min-height: 360px;
}

.wsp-grid-main {
    background: #ffffff;
    display: flex;
    flex-direction: column;
}

.wsp-grid-header-row {
    display: grid;
    border-bottom: 1px solid #e5e7eb;
}

.wsp-grid-header-cell {
    background: #f3f4f6;
    padding: 6px 6px 7px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.wsp-grid-day-cell {
    background: #ffffff;
    padding: 6px 6px 4px;
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    font-size: 0.75rem;
}

.wsp-grid-day-cell.is-outside {
    background: #f9fafb;
    color: #9ca3af;
}

.wsp-time-grid {
    position: relative;
    height: calc(var(--wsp-hours-count, 6) * var(--wsp-hour-height, 40px));
    background: #ffffff;
}

.wsp-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.6);
    z-index: 2;
}

.wsp-time-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed #e5e7eb;
}

.wsp-time-line.is-top {
    border-top: 1px solid #e5e7eb;
}

.wsp-slot-bar {
    position: absolute;
    left: 8px;
    right: 8px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(184, 133, 106, 0.12), rgba(184, 133, 106, 0.2));
    border: 1px solid rgba(184, 133, 106, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 70px;
    cursor: pointer;
    color: #4a3728;
}

.wsp-slot-bar.booked {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(22, 163, 74, 0.6);
    color: #166534;
    cursor: not-allowed;
    text-decoration: none;
}

.wsp-slot-bar.is-disabled {
    cursor: not-allowed;
    opacity: 0.95;
}

.wsp-slot-bar.selected {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(22, 163, 74, 0.25));
    border-color: rgba(2, 3, 2, 0.6);
    color: #065f46;
}

.wsp-slot-time {
    font-size: 20px;
    font-weight: 600;
    color: #6b4f38;
    font-variant-numeric: tabular-nums;
}

.wsp-slot-name {
    margin-top: 2px;
    font-size: 16px;
    color: #4a3728;
    line-height: 1.1;
    white-space: normal;
    text-overflow: ellipsis;
    overflow: hidden;
}

.wsp-slot-name-open {
    color: #4a3728;
}

.wsp-slot-bar.booked .wsp-slot-time,
.wsp-slot-bar.booked .wsp-slot-name {
    color: #166534;
}

.wsp-slot-title {
    font-size: 0.72rem;
    color: #4a3728;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.wsp-day-label {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(249, 250, 251, 0.9);
    z-index: 2;
}

.wsp-day-label.is-today {
    color: #6b4f38;
    border: 1px solid rgba(184, 133, 106, 0.5);
}

.wsp-day-summary {
    position: absolute;
    left: 6px;
    bottom: 6px;
    font-size: 0.68rem;
    color: #b8856a;
    background: rgba(184, 133, 106, 0.1);
    border: 1px solid rgba(184, 133, 106, 0.3);
    border-radius: 999px;
    padding: 2px 6px;
}

.wsp-slot-list {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1;
    pointer-events: none;
    padding-right: 26px;
}

.wsp-slot-list-item {
    font-size: 0.64rem;
    font-weight: 600;
    color: #6b4f38;
    font-variant-numeric: tabular-nums;
    background: rgba(184, 133, 106, 0.1);
    border: 1px solid rgba(184, 133, 106, 0.2);
    border-radius: 6px;
    padding: 2px 4px;
    line-height: 1.1;
}

.wsp-slot-list-item.is-booked {
    color: #166534;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(22, 163, 74, 0.35);
}

.wsp-slot-list-time {
    display: block;
}

.wsp-slot-list-name {
    display: block;
    font-size: 0.6rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wsp-slot-list-item.is-booked .wsp-slot-list-name {
    color: #166534;
}

.wsp-selection-bar {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.wsp-selection-summary {
    font-size: 0.78rem;
    color: #6b7280;
}

.wsp-open-booking {
    padding: 8px 14px;
    background: linear-gradient(135deg, #d4a574, #b8856a);
    color: #ffffff;
    border-radius: 999px;
    border: 1px solid rgba(232, 213, 196, 0.8);
    font-size: 0.82rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(184, 133, 106, 0.35);
    white-space: nowrap;
}

.wsp-open-booking:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wsp-public-note {
    margin-top: 12px;
    font-size: 0.78rem;
    color: #6b7280;
}

.wsp-bookings-panel {
    max-width: 1200px;
    margin: 16px auto 0;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    padding: 14px 18px;
    box-shadow: 0 12px 30px rgba(74, 55, 40, 0.08);
}

.wsp-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 10px;
}

.wsp-booking-item {
    background: #ffffff;
    border-left: 4px solid #b8856a;
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-size: 0.78rem;
}

.wsp-booking-item.cancelled {
    border-left-color: #f43f5e;
    opacity: 0.7;
}

.wsp-booking-item .wsp-button {
    margin-top: 6px;
}

.wsp-message {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    border-left: 4px solid;
}

.wsp-message.success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.wsp-message.error {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.wsp-message.info {
    background: #f5ede4;
    border-color: #b8856a;
    color: #6b4f38;
}

/* Modal styles */
.wsp-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.wsp-modal.is-open {
    display: flex;
}

.wsp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(74, 55, 40, 0.45);
}

.wsp-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    max-width: 520px;
    width: calc(100% - 32px);
    box-shadow: 0 18px 45px rgba(74, 55, 40, 0.2);
    z-index: 1;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.wsp-modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wsp-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #4a3728;
}

.wsp-modal-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6b7280;
}

.wsp-modal-body {
    padding: 16px 18px;
}

.wsp-selected-slot {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    margin-bottom: 14px;
}

.wsp-selected-label {
    font-size: 0.72rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.wsp-selected-value {
    font-size: 0.82rem;
    color: #4a3728;
}

.wsp-form-grid {
    display: grid;
    gap: 10px;
}

.wsp-form-field label {
    display: block;
    font-size: 0.72rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.wsp-form-field input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    font-size: 0.82rem;
    color: #4a3728;
    box-sizing: border-box;
    background: #ffffff;
}

.wsp-modal-footer {
    padding: 14px 18px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.wsp-btn-secondary,
.wsp-btn-primary {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.wsp-btn-secondary {
    background: #f9fafb;
    color: #6b7280;
    border-color: #e5e7eb;
}

.wsp-btn-primary {
    background: linear-gradient(135deg, #d4a574, #b8856a);
    color: #ffffff;
    border-color: rgba(232, 213, 196, 0.8);
    box-shadow: 0 12px 30px rgba(184, 133, 106, 0.35);
}

/* Legacy buttons */
.wsp-button {
    display: inline-block;
    padding: 8px 14px;
    background: #b8856a;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
}

.wsp-button.secondary {
    background: #6b7280;
}

@media (max-width: 768px) {
    .wsp-calendar-main {
        min-height: auto;
    }

    .wsp-calendar-toolbar {
        justify-content: center;
    }

    .wsp-selection-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media print {
    body.wsp-printing * {
        visibility: hidden;
    }

    body.wsp-printing .wsp-calendar-shell.wsp-print-target,
    body.wsp-printing .wsp-calendar-shell.wsp-print-target * {
        visibility: visible;
    }

    body.wsp-printing .wsp-calendar-shell.wsp-print-target {
        position: absolute;
        inset: 0;
        width: 100%;
        padding: 0;
        background: #ffffff;
        box-shadow: none;
    }

    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-calendar-card {
        max-width: none;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-calendar-toolbar,
    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-selection-bar,
    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-bookings-panel,
    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-public-note,
    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-message,
    body.wsp-printing .wsp-calendar-shell.wsp-print-target .wsp-open-booking {
        display: none !important;
    }
}
/* Month-view slot buttons (image 2 style) */
.wsp-time-grid.wsp-canvas-month {
    height: auto;
    min-height: 140px;
    padding-top: 26px;
}

.wsp-time-grid.wsp-canvas-month .wsp-time-line,
.wsp-time-grid.wsp-canvas-month .wsp-loading {
    display: none;
}

.wsp-time-grid.wsp-canvas-month .wsp-slot-list {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 4px 6px;
}

.wsp-time-grid.wsp-canvas-month .wsp-day-summary {
    position: static;
    display: block;
    margin: 4px 4px 0;
    text-align: center;
}

.wsp-slot-list-item {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 4px;
    border-radius: 6px;
    background: #faf5f0;
    border: 1px solid #e8d5c4;
    color: #6b4f38;
}

.wsp-slot-list-item.is-booked {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

.wsp-slot-list-name {
    display: none; /* image 2 shows no name inside month cells */
}

@media (max-width: 768px) {
    .wsp-slot-list-item { font-size: 0.66rem; padding: 4px; }
}