/*
 * My Schedule - dedicated styles for the Syncfusion Scheduler page and the
 * topbar bell dropdown that polls the same backend.
 */

/* ---------- page layout ---------- */
.schedule-page .card { border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }

#scheduleObj { width: 100%; min-height: 70vh; }

/* Read-only events (system-generated) get a subtle stripe so users know they
   can't drag them. The pointer stays default; clicking opens the source. */
.e-schedule .e-appointment.schedule-readonly {
    background-image: linear-gradient(135deg,
        rgba(255, 255, 255, 0.18) 25%, transparent 25%,
        transparent 50%, rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0.18) 75%, transparent 75%, transparent);
    background-size: 12px 12px;
}

/* ---------- legend ---------- */
.schedule-legend {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: .85rem; color: #4a4a4a;
}
.schedule-legend .legend-item {
    display: inline-flex; align-items: center; gap: 6px;
}
.schedule-legend .legend-dot {
    width: 12px; height: 12px; border-radius: 50%;
    display: inline-block;
}
.schedule-legend .legend-dot[data-source="task"] { background: #0d6efd; }
.schedule-legend .legend-dot[data-source="pour"] { background: #0dcaf0; }
.schedule-legend .legend-dot[data-source="project_schedule"] { background: #6c757d; }
.schedule-legend .legend-dot[data-source="timeoff"] { background: #ffc107; }
.schedule-legend .legend-dot[data-source="custom"] { background: #198754; }

/* ---------- QuickInfo popup (single-click on an event) ----------
   The Syncfusion popup is rendered as three regions: e-popup-header
   (colored bar with subject + action icons), e-popup-content (our
   quickInfoTemplates.content), and e-popup-footer (our footer template).
   We don't override the header - we tweak the icon strip via JS so custom
   events keep their native Edit / Delete buttons, while read-only events
   get an "Open Task" icon next to the close X. */

.e-schedule-dialog,
.e-quick-popup-wrapper {
    /* Slightly wider than the EJ2 default so two columns of pour metadata
       (Yds / Mix / Pump / Slump) fit on the same row without truncating. */
    max-width: 380px;
}
.e-quick-popup-wrapper .e-popup-content,
.e-schedule .quick-info-content {
    padding: 12px 14px 4px;
}

/* Coloured "source" chip (Pour / Task / Time Off / ...) plus optional
   status pill. They live on the same line right at the top of the body. */
.quick-info-badges {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 10px;
}
.quick-info-source,
.quick-info-status {
    display: inline-block;
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .03em;
    padding: 3px 8px; border-radius: 999px;
    line-height: 1.2;
}
.quick-info-source { color: #fff; }
.quick-info-status {
    background: #e9ecef; color: #495057;
    border: 1px solid rgba(0, 0, 0, .05);
}
.quick-info-status-new { background: #e7f1ff; color: #0d6efd; border-color: rgba(13,110,253,.2); }
.quick-info-status-inprogress,
.quick-info-status-in_progress { background: #fff8e1; color: #b7770b; border-color: rgba(255,193,7,.3); }
.quick-info-status-completed { background: #e6f6ec; color: #198754; border-color: rgba(25,135,84,.3); }
.quick-info-status-canceled,
.quick-info-status-cancelled { background: #fdecea; color: #b02a37; border-color: rgba(220,53,69,.25); }

/* Single info row (time, project, location). */
.quick-info-row {
    display: flex; align-items: flex-start;
    gap: 8px;
    padding: 3px 0;
    font-size: .88rem; color: #2c2f33;
}
.quick-info-row .quick-info-icon {
    flex: 0 0 16px;
    margin-top: 3px;
    color: #6c757d;
    font-size: .8rem;
}
.quick-info-project {
    font-weight: 600; color: #1c1e21;
    overflow: hidden; text-overflow: ellipsis;
}

/* Pour-detail grid: 2 columns of key/value cards rendered when the
   server-side description looks like "Yds: ... | Mix: ... | Pump: ... | Slump: ...". */
.quick-info-pour-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, .06);
}
.quick-info-pour-cell {
    background: #f8f9fb;
    border: 1px solid rgba(0, 0, 0, .05);
    border-radius: 6px;
    padding: 6px 8px;
}
.quick-info-pour-key {
    font-size: .68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .03em;
    color: #6c757d;
}
.quick-info-pour-val {
    font-size: .9rem; font-weight: 500; color: #1c1e21;
    word-break: break-word;
}

/* Free-text description fallback when the description isn't a pour grid. */
.quick-info-desc {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, .06);
    white-space: pre-line; line-height: 1.4;
    font-size: .85rem; color: #495057;
}

/* Footer: a clean text link with an external-link icon for read-only events. */
.e-quick-popup-wrapper .e-popup-footer,
.e-schedule .quick-info-footer-actions {
    padding: 8px 14px 12px;
    display: flex; justify-content: flex-end;
}
.schedule-open-source-link {
    display: inline-flex; align-items: center;
    background: #0d6efd; color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    padding: 7px 14px;
    font-size: .85rem; font-weight: 500;
    transition: background .15s ease, transform .15s ease;
}
.schedule-open-source-link:hover {
    background: #0b5ed7;
    text-decoration: none;
    transform: translateY(-1px);
}
.schedule-open-source-link i { margin-right: 6px; }

/* "Open Task" icon button injected into the header icon strip in place of
   the hidden Edit / Delete icons. We piggy-back on EJ2's own button classes
   so the look matches the close (X) icon next to it. The glyph is a
   FontAwesome icon (loaded globally), which avoids depending on whether the
   EJ2 icon font ships an "e-launch" character. */
.schedule-open-source-icon-btn {
    color: #fff !important;
    opacity: .85;
    background: transparent !important;
    border: 0 !important;
}
.schedule-open-source-icon-btn:hover { opacity: 1; }
.schedule-open-source-icon-btn i {
    font-size: .9rem; color: inherit;
}

/* ---------- transient toast ---------- */
.schedule-toast {
    position: fixed; right: 24px; bottom: 24px;
    background: #212529; color: #fff;
    padding: 10px 16px; border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
    font-size: .9rem;
    opacity: 0; transform: translateY(8px);
    transition: opacity .25s ease, transform .25s ease;
    z-index: 2000;
}
.schedule-toast.show { opacity: 1; transform: translateY(0); }

/* ---------- topbar bell dropdown ---------- */
.schedule-bell { position: relative; }
.schedule-bell .bell-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #dc3545; color: #fff;
    font-size: 10px; line-height: 16px;
    text-align: center;
    display: none;
    pointer-events: none;
}
.schedule-bell .bell-badge.show { display: inline-block; }

.schedule-bell-menu {
    width: 360px; max-width: calc(100vw - 24px);
    max-height: 70vh; overflow-y: auto;
    padding: 0;
}
.schedule-bell-menu .bell-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    display: flex; align-items: center; justify-content: space-between;
}
.schedule-bell-menu .bell-header h6 { margin: 0; font-weight: 600; }
.schedule-bell-menu .bell-empty {
    padding: 24px 16px;
    text-align: center; color: #888; font-size: .9rem;
}
.schedule-bell-menu .bell-item {
    display: flex; gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    cursor: pointer; text-decoration: none; color: inherit;
}
.schedule-bell-menu .bell-item:last-child { border-bottom: 0; }
.schedule-bell-menu .bell-item:hover { background: #f7f7f9; }
.schedule-bell-menu .bell-dot {
    flex: 0 0 6px; width: 6px; border-radius: 3px; margin-top: 6px;
}
.schedule-bell-menu .bell-body { flex: 1; min-width: 0; }
.schedule-bell-menu .bell-title {
    font-weight: 600; font-size: .9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.schedule-bell-menu .bell-meta { color: #6c757d; font-size: .78rem; }

/* ---------- M365 status pill ---------- */
.m365-status { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.m365-status .badge { font-size: .8rem; padding: 6px 10px; }
.m365-status .m365-upn {
    font-weight: 400; opacity: .9;
    max-width: 220px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: inline-block; vertical-align: bottom;
}

/* ---------- responsive tweaks ---------- */
@media (max-width: 992px) {
    .m365-status .m365-upn { max-width: 140px; }
}

@media (max-width: 768px) {
    #scheduleObj { min-height: 65vh; }
    .schedule-bell-menu { width: 320px; }
    .schedule-legend { gap: 8px; font-size: .8rem; }
    .m365-status .m365-upn { display: none; } /* keep just the "Connected" pill on phones */
    .schedule-page .card-body .d-flex.flex-wrap > div { width: 100%; }
}

@media (max-width: 576px) {
    .schedule-page .btn-sm { padding: .25rem .5rem; font-size: .8rem; }
}
