/* Calendar Styles */
.bw-calendar-container .bw-calendar-card {
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .05);
}

.bw-calendar-header-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.bw-calendar-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.bw-calendar-actions .el-button--success {
    background-color: #5700B4;
    /* BookWell Blue */
    border-color: #5700B4;
    font-weight: 500;
}

.bw-calendar-actions .el-button--success:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

.bw-calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 30px;
}

.bw-calendar-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bw-calendar-display-month {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    min-width: 150px;
    text-align: center;
}

.bw-cal-nav-btn {
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bw-cal-nav-btn > i,
.bw-cal-nav-btn > .el-icon {
    display: none !important;
}

.bw-cal-nav-btn:hover {
    color: #5700B4;
    background-color: #eff6ff !important;
}

.bw-calendar-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.bw-calendar-staff-select {
    width: 200px;
}

.bw-cal-empty-staff {
    padding: 40px 20px;
    text-align: center;
    color: #909399;
    font-size: 14px;
}

.bw-cal-day-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.bw-cal-day-title {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
}

.bw-cal-day-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bw-cal-day-strip-wrap {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 20px;
}

.bw-cal-day-strip {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid #ebeef5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.bw-cal-day-strip-row {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    gap: 0;
}

.bw-cal-day-strip-nav {
    flex-shrink: 0;
    align-self: center;
}

.bw-cal-day-strip-item {
    position: relative;
    min-height: 52px;
    border: none;
    border-right: 1px solid #ebeef5;
    border-bottom: 1px solid #ebeef5;
    border-radius: 0;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px 8px;
    transition: background-color 0.2s ease;
}

.bw-cal-day-strip-row:last-child .bw-cal-day-strip-item {
    border-bottom: none;
}

.bw-cal-day-strip-item:nth-child(16n) {
    border-right: none;
}

.bw-cal-day-strip-item:hover:not(:disabled):not(.bw-cal-day-strip-item--empty) {
    background: #eff6ff;
}

.bw-cal-day-strip-item--selected {
    box-shadow: inset 0 0 0 2px #5700B4;
    z-index: 1;
}

.bw-cal-day-strip-item--today .bw-cal-day-strip-num {
    color: #5700B4;
    font-weight: 700;
}

.bw-cal-day-strip-item--past {
    background: repeating-linear-gradient(
        -45deg,
        #fafafa,
        #fafafa 4px,
        #f0f0f0 4px,
        #f0f0f0 8px
    );
}

.bw-cal-day-strip-item--past .bw-cal-day-strip-dow,
.bw-cal-day-strip-item--past .bw-cal-day-strip-num {
    color: #c0c4cc;
}

.bw-cal-day-strip-item--empty {
    background: #f5f7fa;
    cursor: default;
    pointer-events: none;
}

.bw-cal-day-strip-dow {
    font-size: 11px;
    font-weight: 500;
    color: #909399;
    line-height: 1.2;
    text-transform: uppercase;
}

.bw-cal-day-strip-num {
    font-size: 14px;
    font-weight: 600;
    color: #303133;
    line-height: 1.2;
    margin-top: 2px;
}

.bw-cal-day-strip-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f56c6c;
}

.bw-cal-day-strip-bar {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 3px;
    height: 4px;
    border-radius: 2px;
    background: #67c23a;
}

.bw-cal-day-strip-bar--selected {
    background: #5700B4;
}

.bw-cal-day-view {
    min-height: 400px;
}

.bw-cal-day-off {
    padding: 40px 20px;
    text-align: center;
    color: #909399;
    font-size: 14px;
    border: 1px solid #ebeef5;
    border-radius: 8px;
}

.bw-cal-day-col--single {
    flex: 1;
    min-width: 200px;
}

.bw-cal-staff-header {
    gap: 8px;
    flex-direction: column;
    padding: 8px;
    height: auto;
    min-height: 50px;
}

/* Day view timeline: matched headers + taller hour rows */
.bw-calendar-day-grid {
    --bw-cal-hour-height: 80px;
    --bw-cal-col-header-height: 64px;
}

.bw-calendar-day-grid .bw-cal-time-header,
.bw-calendar-day-grid .bw-cal-staff-header {
    height: var(--bw-cal-col-header-height);
    min-height: var(--bw-cal-col-header-height);
    max-height: var(--bw-cal-col-header-height);
    box-sizing: border-box;
    overflow: hidden;
}

.bw-calendar-day-grid .bw-cal-staff-header {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
}

.bw-calendar-day-grid .bw-cal-time-slot,
.bw-calendar-day-grid .bw-cal-time-cell {
    height: var(--bw-cal-hour-height);
}

.bw-calendar-day-grid .bw-cal-time-slot {
    top: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 0 8px 0 4px;
    line-height: 1.2;
}

.bw-calendar-day-grid .bw-cal-flex-event-slot {
    position: absolute;
    left: 4px;
    right: 4px;
    z-index: 10;
}

.bw-calendar-day-grid .bw-cal-flex-event-slot:hover {
    z-index: 20;
}

.bw-calendar-day-grid .bw-cal-flex-event-slot:hover .bw-cal-flex-event {
    transform: scale(1.02);
}

.bw-calendar-day-grid .bw-cal-flex-event-slot .el-popover,
.bw-calendar-day-grid .bw-cal-flex-event-slot > span {
    display: block;
    width: 100%;
    height: 100%;
}

.bw-calendar-day-grid .bw-cal-flex-event-slot .bw-cal-flex-event {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
}

.bw-calendar-day-grid .bw-cal-flex-event {
    padding: 3px 8px;
    min-height: 0;
    box-sizing: border-box;
    overflow: hidden;
    display: block;
}

.bw-calendar-day-grid .bw-cal-event-inline {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 600;
    color: #333;
}

.bw-calendar-day-grid .bw-cal-event-inline-time {
    font-weight: 500;
    color: #666;
    margin-left: 6px;
}

.bw-cal-day-event-popover {
    z-index: 100000 !important;
}

.bw-cal-day-popover-content .bw-pop-service-row {
    padding: 15px;
    border-bottom: 1px solid #ebeef5;
}

.bw-cal-day-popover-content .bw-pop-service-id {
    display: block;
    font-size: 11px;
    color: #666;
    font-weight: 500;
    margin-top: 4px;
}

.bw-cal-day-popover-content .bw-pop-customer-card {
    margin: 15px;
}

.bw-cal-day-popover-content .bw-pop-actions {
    padding: 0 15px 15px 15px;
}

.bw-cal-staff-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.bw-cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #f56c6c;
    z-index: 15;
    pointer-events: none;
}

.bw-cal-now-label {
    position: absolute;
    left: -72px;
    top: -10px;
    background: #f56c6c;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.bw-calendar-view-toggle {
    position: static;
}

.bw-cal-nav-btn {
    border: none;
    background: transparent;
    font-size: 20px;
}

.bw-calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 30px;
}

.bw-calendar-view-toggle .el-button-group>.el-button {
    padding: 10px 20px;
    font-weight: 500;
}

.bw-calendar-view-toggle .el-button--primary {
    background-color: #5700B4;
    border-color: #5700B4;
    color: #fff;
}

.bw-calendar-view-toggle .el-button--primary:hover {
    background-color: #5700B4;
    border-color: #5700B4;
}

.bw-calendar-view-toggle .el-button--default:hover {
    color: #5700B4;
    border-color: #bfdbfe;
    background-color: #eff6ff;
}

/* Calendar Grid Styles */
.bw-calendar-month-grid {
    border: 1px solid #ebeef5;
    border-radius: 8px;
    overflow: hidden;
}

.bw-cal-grid-row {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}

.bw-cal-header {
    background-color: #f9fafc;
    border-bottom: 1px solid #ebeef5;
}

.bw-cal-cell-header {
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: #606266;
}

.bw-cal-grid-body {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    grid-auto-rows: minmax(120px, auto) !important;
}

.bw-cal-cell {
    border-right: 1px solid #ebeef5;
    border-bottom: 1px solid #ebeef5;
    padding: 10px;
    position: relative;
    background: #fff;
    transition: background-color 0.2s;
}

.bw-cal-cell:nth-child(7n) {
    border-right: none;
}

.bw-cal-cell-inactive {
    background-color: #fafafa;
    color: #c0c4cc;
}

.bw-cal-cell-today {
    background-color: #eff6ff;
}

.bw-cal-cell-date {
    text-align: right;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #606266;
}

.bw-cal-cell-inactive .bw-cal-cell-date {
    color: #c0c4cc;
}

/* Event Styles */
.bw-cal-events-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bw-cal-event-item {
    background-color: #eff6ff;
    /* Soft blue background */
    border-left: 3px solid #5700B4;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: transform 0.1s;
}

.bw-cal-event-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bw-cal-event-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bw-cal-event-time {
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bw-cal-event-more {
    font-size: 11px;
    color: #5700B4;
    text-align: right;
    cursor: pointer;
    font-weight: 600;
    margin-top: 2px;
}

.bw-cal-event-more:hover {
    text-decoration: underline;
}

/* Week and Day Grid Styles */
.bw-calendar-week-grid {
    display: flex;
    border: 1px solid #ebeef5;
    border-radius: 8px;
    background: #fff;
    overflow-x: auto;
}

.bw-cal-time-col {
    min-width: 80px;
    border-right: 1px solid #ebeef5;
    background: #f9fafc;
    flex-shrink: 0;
}

.bw-cal-time-header {
    height: 50px;
    border-bottom: 1px solid #ebeef5;
}

.bw-cal-time-slot {
    height: 60px;
    box-sizing: border-box;
    border-bottom: 1px solid #ebeef5;
    font-size: 11px;
    color: #909399;
    padding: 5px;
    text-align: right;
    position: relative;
    top: -10px;
    /* offset to align text with border line */
}

.bw-cal-day-col {
    flex: 1;
    min-width: 120px;
    border-right: 1px solid #ebeef5;
    display: flex;
    flex-direction: column;
}

.bw-cal-day-col:last-child {
    border-right: none;
}

.bw-cal-day-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #606266;
    background: #f9fafc;
    border-bottom: 1px solid #ebeef5;
}

.bw-cal-day-body {
    position: relative;
    flex: 1;
    background: #fff;
}

.bw-cal-time-cell {
    height: 60px;
    box-sizing: border-box;
    border-bottom: 1px solid #ebeef5;
}

.bw-cal-flex-event {
    position: absolute;
    left: 4px;
    right: 4px;
    background-color: #eff6ff;
    border-left: 3px solid #5700B4;
    border-radius: 3px;
    padding: 4px;
    font-size: 11px;
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    cursor: pointer;
}

.bw-cal-flex-event:hover {
    transform: scale(1.02);
    z-index: 20;
}

.bw-cal-flex-event .bw-cal-event-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.bw-cal-flex-event .bw-cal-event-time {
    color: #666;
}

/* Popover Styles */
.bw-cal-event-popover {
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.bw-pop-header {
    background-color: #eff6ff;
    color: #1e3a8a;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #bfdbfe;
}

.bw-pop-header i {
    margin-right: 5px;
}

.bw-pop-close-icon {
    margin-right: 0 !important;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #606266;
    border: none;
    background: transparent;
    padding: 0;
}

.bw-pop-close-icon:hover {
    color: #303133;
}

.bw-pop-accordion .el-collapse-item__header {
    height: auto;
    line-height: 1.4;
    padding: 10px 0 10px 15px;
}

.bw-pop-accordion .el-collapse-item__content {
    padding-bottom: 0;
}

.bw-pop-service-row {
    padding: 15px;
    border-bottom: 1px solid #ebeef5;
}

.bw-pop-service-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 14px;
}

.bw-pop-time {
    font-size: 12px;
    color: #606266;
}

.bw-pop-customer-card {
    margin: 15px;
    background-color: #f9fafc;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #ebeef5;
}

.bw-pop-customer-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 13px;
}

.bw-pop-customer-email,
.bw-pop-customer-phone {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

.bw-pop-customer-email i,
.bw-pop-customer-phone i {
    margin-right: 6px;
    color: #909399;
}

.bw-pop-actions {
    padding: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.bw-pop-actions .el-button {
    width: 100%;
}

/* -------------------------------------------------------------------------
   Calendar — mobile (782px and below)
   ------------------------------------------------------------------------- */
@media (max-width: 782px) {
    body.bookwellab-admin-page .bw-calendar-container.book-now-adm--container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .bw-calendar-container .container {
        padding-left: 0;
        padding-right: 0;
    }

    .bw-calendar-container .bw-admin-page-container {
        padding: 0;
    }

    .bw-calendar-container .bw-calendar-card {
        padding: 12px;
        min-height: auto !important;
        border-radius: 12px;
    }

    .bw-calendar-header-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .bw-calendar-title h2 {
        font-size: 20px;
    }

    .bw-calendar-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .bw-calendar-view-toggle {
        width: 100%;
    }

    .bw-calendar-view-toggle .el-button-group {
        display: flex;
        width: 100%;
    }

    .bw-calendar-view-toggle .el-button-group > .el-button {
        flex: 1 1 0;
        padding: 10px 12px;
    }

    .bw-calendar-staff-select {
        width: 100% !important;
    }

    .bw-calendar-controls {
        margin-bottom: 16px;
    }

    .bw-calendar-display-month {
        font-size: 16px;
        min-width: 0;
    }

    .bw-cal-day-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 12px;
    }

    .bw-cal-day-title {
        font-size: 18px;
        line-height: 1.35;
        word-break: break-word;
    }

    .bw-cal-day-toolbar-right {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }

    .bw-cal-day-strip-wrap {
        align-items: center;
        margin-bottom: 14px;
        gap: 0;
    }

    .bw-cal-day-strip-nav {
        display: none;
    }

    .bw-cal-day-strip {
        flex: 1;
        width: 100%;
        overflow: hidden;
    }

    .bw-cal-day-strip--mobile .bw-cal-day-strip-row,
    .bw-cal-day-strip-row {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        min-width: 0;
    }

    .bw-cal-day-strip-item:nth-child(16n) {
        border-right: 1px solid #ebeef5;
    }

    .bw-cal-day-strip--mobile .bw-cal-day-strip-item:nth-child(16n),
    .bw-cal-day-strip--mobile .bw-cal-day-strip-item:nth-child(7n) {
        border-right: none;
    }

    .bw-cal-day-strip-item:nth-child(7n) {
        border-right: none;
    }

    .bw-cal-day-strip-item {
        min-height: 42px;
        min-width: 0;
        padding: 3px 1px 5px;
    }

    .bw-cal-day-strip-dow {
        font-size: 10px;
    }

    .bw-cal-day-strip-num {
        font-size: 13px;
    }

    .bw-calendar-month-grid {
        overflow: hidden;
    }

    .bw-cal-grid-row,
    .bw-cal-grid-body {
        min-width: 0;
        width: 100%;
    }

    .bw-cal-cell-header {
        padding: 8px 2px;
        font-size: 10px;
    }

    .bw-cal-grid-body {
        grid-auto-rows: minmax(72px, auto) !important;
    }

    .bw-cal-cell {
        padding: 4px 2px;
    }

    .bw-cal-cell-date {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .bw-cal-event-item {
        font-size: 10px;
        padding: 3px 4px;
    }

    .bw-calendar-day-grid {
        --bw-cal-hour-height: 56px;
        --bw-cal-col-header-height: 52px;
        overflow: hidden;
    }

    .bw-calendar-week-grid {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .bw-cal-day-col--single {
        min-width: 0;
    }

    .bw-cal-time-col {
        min-width: 52px;
        position: sticky;
        left: 0;
        z-index: 2;
        background: #f9fafc;
    }

    .bw-cal-day-col--single {
        min-width: 0;
        flex: 1;
    }

    .bw-calendar-day-grid .bw-cal-time-slot {
        font-size: 10px;
        padding: 0 4px 0 2px;
    }

    .bw-cal-now-line {
        left: 0;
        right: 0;
    }

    .bw-cal-now-label {
        left: 8px;
        top: -22px;
        transform: none;
        font-size: 9px;
        padding: 2px 5px;
        z-index: 16;
        max-width: calc(100% - 16px);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bw-cal-staff-header span {
        font-size: 13px;
        text-align: center;
        word-break: break-word;
    }

    .bw-cal-staff-avatar {
        width: 28px;
        height: 28px;
    }
}