/* ============================================================
   Meeting Room Booking – Public Styles
   ============================================================ */

/* Wrap */
.mrb-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 18px !important;
    color: #333;
    box-sizing: border-box;
}

/* ---- Calendar header ---- */
.mrb-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.mrb-month-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: #2c3e50;
}

/* Nav buttons — div[role=button] avoids theme button CSS interference */
.mrb-wrap .mrb-nav-btn {
    background: #f0f0f0;
    border: 1px solid #bbb;
    border-radius: 6px;
    font-size: 18px !important;
    font-weight: 600;
    line-height: 1.4;
    padding: 10px 22px;
    cursor: pointer;
    color: #333;
    min-width: 100px;
    text-align: center;
    transition: background 0.15s;
    display: inline-block;
    user-select: none;
}
.mrb-wrap .mrb-nav-btn:hover  { background: #ddd; color: #333; }
.mrb-wrap .mrb-nav-btn:focus  { background: #ddd; color: #333; outline: 2px solid #3498db; }
.mrb-wrap .mrb-nav-btn:active { background: #ccc; color: #333; }

/* ---- Legend ---- */
.mrb-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}
.mrb-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 1rem;
}
.mrb-legend-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- Grid header (day names) ---- */
.mrb-grid-header {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    background: #2c3e50;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    width: 100% !important;
    box-sizing: border-box;
}
.mrb-dh {
    text-align: center;
    padding: 16px 4px;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
    color: #fff !important;
    text-transform: uppercase;
}

/* ---- Calendar grid ---- */
.mrb-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    grid-auto-rows: 180px; /* JS overrides this at runtime to fill viewport */
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    width: 100% !important;
    box-sizing: border-box;
}

/* ---- Day cell ---- */
.mrb-day {
    padding: 10px 8px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    overflow: hidden;          /* clip events that exceed the fixed height */
    background: #fff;
    transition: background 0.12s;
}
.mrb-day:nth-child(7n) { border-right: none; }
.mrb-day:hover { background: #f0f7ff; }

.mrb-day.mrb-other-month {
    background: #f7f7f7;
    cursor: default;
}
.mrb-day.mrb-other-month:hover { background: #f7f7f7; }
.mrb-day.mrb-other-month .mrb-day-num { color: #ccc; }

.mrb-day.mrb-today { background: #fffde7; }
.mrb-day.mrb-today .mrb-day-num {
    background: #f39c12;
    color: #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.mrb-day.mrb-past { opacity: 0.65; }

.mrb-day-num {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #444 !important;
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

/* ---- Event blocks (desktop) ---- */
.mrb-events { display: flex; flex-direction: column; gap: 5px; }

.mrb-event {
    border-left: 4px solid #888;
    border-radius: 0 4px 4px 0;
    padding: 6px 10px;
    font-size: 15px !important;
    line-height: 1.5;
    cursor: pointer;
    overflow: hidden;
}
.mrb-event-time {
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #222 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mrb-event-room {
    font-weight: 600 !important;
    font-size: 14px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mrb-event-who {
    color: #444 !important;
    font-size: 14px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mrb-event-reason {
    color: #666 !important;
    font-size: 14px !important;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Dots (mobile only, hidden on desktop) ---- */
.mrb-dots {
    display: none;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 5px;
}
.mrb-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================================
   Responsive — tablet (≤ 900px): hide who/room, keep time+reason
   ============================================================ */
@media (max-width: 900px) {
    .mrb-grid { grid-auto-rows: 140px; }
    .mrb-event { font-size: 0.85rem; padding: 4px 6px; }
    .mrb-event-who,
    .mrb-event-room { display: none; }
}

/* ============================================================
   Responsive — mobile (≤ 600px): dots only, compact grid
   ============================================================ */
@media (max-width: 600px) {
    .mrb-grid { grid-auto-rows: 56px; }
    .mrb-day { padding: 4px 3px; }
    .mrb-day-num { font-size: 0.85rem; width: 24px; height: 24px; }
    .mrb-events { display: none; }
    .mrb-dots   { display: flex; }
    .mrb-dh { font-size: 0.72rem; padding: 7px 2px; }
    .mrb-month-title { font-size: 1.2rem; }
    .mrb-nav-btn { font-size: 1.4rem; padding: 4px 12px; min-width: 40px; }
    .mrb-legend { gap: 8px; }
    .mrb-legend-item { font-size: 0.88rem; }
}

/* ---- Modal overlay ---- */
.mrb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: mrbFadeIn 0.15s ease;
}
.mrb-hidden { display: none !important; }

@keyframes mrbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Modal box ---- */
.mrb-modal {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: mrbSlideUp 0.18s ease;
}

@keyframes mrbSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.mrb-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px 18px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.mrb-modal-head h3, .mrb-modal-title {
    margin: 0;
    font-size: 24px !important;
    color: #2c3e50;
}
.mrb-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}
.mrb-modal-close:hover { color: #333; }

.mrb-modal-body { padding: 22px 26px 26px; }

/* ---- Spinner ---- */
.mrb-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #ddd;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: mrbSpin 0.7s linear infinite;
    margin: 30px auto;
}
@keyframes mrbSpin { to { transform: rotate(360deg); } }

/* ---- Booking list in modal ---- */
.mrb-booking-list { list-style: none; padding: 0; margin: 0 0 22px; }
.mrb-booking-list li {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 16px 18px;
    margin-bottom: 12px;
}
.mrb-booking-room {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 10px;
}
.mrb-booking-time {
    font-weight: 600;
    color: #2c3e50;
    font-size: 20px !important;
    margin-bottom: 6px;
}
.mrb-booking-meta {
    font-size: 18px !important;
    color: #666;
    margin-bottom: 4px;
}
.mrb-booking-reason {
    font-size: 18px !important;
    color: #444;
    font-style: italic;
    margin-top: 8px;
    padding-left: 10px;
    border-left: 3px solid #ddd;
}
/* ---- Action button row (Edit + Cancel) ---- */
.mrb-action-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.mrb-cancel-btn {
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 16px !important;
    cursor: pointer;
    transition: all 0.15s;
}
.mrb-cancel-btn:hover { background: #e74c3c; color: #fff; }
.mrb-cancel-btn:disabled { opacity: 0.5; cursor: default; }

.mrb-edit-btn {
    background: none;
    border: 1px solid #3498db;
    color: #3498db;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 16px !important;
    cursor: pointer;
    transition: all 0.15s;
}
.mrb-edit-btn:hover { background: #3498db; color: #fff; }

/* ---- Edit form ---- */
.mrb-be { padding-top: 12px; border-top: 1px dashed #ddd; margin-top: 4px; }
.mrb-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.mrb-edit-actions .mrb-submit-btn { flex: 1; }
.mrb-cancel-edit-btn {
    flex: 0 0 auto;
    padding: 10px 18px;
    background: #f0f0f0;
    border: 1px solid #bbb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px !important;
    color: #333;
}
.mrb-cancel-edit-btn:hover { background: #ddd; }
.mrb-edit-recur-note {
    font-size: 14px;
    color: #888;
    font-style: italic;
    margin: 6px 0 0;
}

/* ---- Booking form ---- */
.mrb-form-title {
    font-size: 17px !important;
    font-weight: 600;
    color: #2c3e50;
    margin: 22px 0 16px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.mrb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 500px) { .mrb-form-row { grid-template-columns: 1fr; } }

.mrb-form-group { margin-bottom: 16px; }
.mrb-form-group label {
    display: block;
    font-size: 17px !important;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}
.mrb-form-group input[type="text"],
.mrb-form-group input[type="date"],
.mrb-form-group input[type="time"],
.mrb-form-group input[type="number"],
.mrb-form-group select,
.mrb-form-group textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 17px !important;
    box-sizing: border-box;
}
.mrb-form-group input:focus,
.mrb-form-group select:focus,
.mrb-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

.mrb-recur-section {
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.mrb-submit-btn {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1.2rem !important;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
    padding: 14px 28px !important;
}
.mrb-submit-btn:hover { background: #2980b9; }
.mrb-submit-btn:disabled { background: #aaa; cursor: default; }

/* ---- Alerts ---- */
.mrb-alert {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 1rem;
    margin-bottom: 16px;
}
.mrb-alert-error   { background: #fdf3f2; border-left: 4px solid #e74c3c; color: #a00; }
.mrb-alert-success { background: #f0fdf4; border-left: 4px solid #2ecc71; color: #166534; }
.mrb-alert-info    { background: #eff8ff; border-left: 4px solid #3498db; color: #1a4a8a; }

/* ---- Duration warning ---- */
.mrb-duration-info {
    font-size: 0.92rem;
    color: #666;
    margin-top: 5px;
}
.mrb-duration-info.over { color: #e74c3c; font-weight: 600; }

/* ---- Global notice (from email cancel redirect) ---- */
.mrb-global-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 380px;
    padding: 16px 20px;
    border-radius: 6px;
    font-size: 1rem;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.mrb-notice-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.mrb-notice-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ---- Single-room note ---- */
.mrb-single-room-note {
    background: #f0f7ff;
    border-left: 4px solid #3498db;
    padding: 10px 14px;
    margin: 0 0 16px;
    border-radius: 0 4px 4px 0;
    font-size: 17px !important;
    color: #2c3e50;
}

/* ---- Login prompt ---- */
.mrb-login-prompt {
    text-align: center;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 1rem;
    color: #555;
    margin-top: 18px;
    border-top: 1px solid #eee;
}
.mrb-login-prompt a { color: #3498db; font-weight: 600; }

/* ---- No bookings ---- */
.mrb-no-bookings {
    text-align: center;
    color: #aaa;
    font-style: italic;
    font-size: 1rem;
    padding: 18px 0;
}

/* ---- Recur badge ---- */
.mrb-recur-badge {
    display: inline-block;
    font-size: 0.82rem;
    padding: 2px 7px;
    background: #e8f4fd;
    color: #2980b9;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ---- All-day row ---- */
.mrb-allday-row { margin-bottom: 12px; }
.mrb-allday-row label { font-weight: 500; cursor: pointer; font-size: 1rem; }

/* ---- Recurring ends layout ---- */
.mrb-recur-ends { display: flex; flex-direction: column; gap: 10px; }
.mrb-recur-ends label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: normal; font-size: 1rem; }

/* ---- req asterisk ---- */
.req { color: red; }
