/* ═══════════════════════════════════════════════════════════
   Church Events Calendar – Styles
   ═══════════════════════════════════════════════════════════ */

.church-events-app {
    padding: 0;
}

/* ── Top Bar ──────────────────────────────────────────────── */

.ce-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #d1d8dd);
    margin-bottom: 12px;
}

.ce-topbar-left,
.ce-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ce-search-input {
    border: 1px solid var(--border-color, #d1d8dd);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 13px;
    width: 200px;
    outline: none;
    transition: border-color 0.2s;
}

.ce-search-input:focus {
    border-color: var(--primary, #4a90d9);
}

.ce-view-btn.active,
.ce-view-btn.btn-primary {
    background-color: var(--primary, #4a90d9);
    color: #fff;
    border-color: var(--primary, #4a90d9);
}

.ce-pending-btn { position: relative; }
.ce-pending-count { font-weight: bold; }

/* ── Calendar Container ──────────────────────────────────── */

#ceCalendarContainer {
    min-height: 500px;
}

#ceCalendarContainer .fc {
    font-size: 13px;
}

/*
 * Month View (dayGrid) — Dot Display
 *
 * FC6 default (eventDisplay: "auto") renders timed events as:
 *   .fc-daygrid-dot-event (flex row): [dot] [time] [title]
 * We force single-line with truncation.
 */

/* Dot events: single-line flex row */
#ceCalendarContainer .fc-daygrid-dot-event {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 1px 2px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.5;
}

/* Colored dot */
#ceCalendarContainer .fc-daygrid-dot-event .fc-daygrid-event-dot {
    display: inline-block !important;
    flex-shrink: 0 !important;
    margin: 0 4px 0 0 !important;
}

/* Time */
#ceCalendarContainer .fc-daygrid-dot-event .fc-event-time {
    flex-shrink: 0 !important;
    margin-right: 4px !important;
    font-size: 11px;
    overflow: hidden;
}

/* Title: fill remaining space, truncate */
#ceCalendarContainer .fc-daygrid-dot-event .fc-event-title {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-weight: normal;
}

/* Block events (all-day) — also single line */
#ceCalendarContainer .fc-daygrid-block-event {
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    cursor: pointer;
}

/* Harness */
#ceCalendarContainer .fc-daygrid-event-harness {
    overflow: hidden;
}

/* Hover */
#ceCalendarContainer .fc-daygrid-dot-event:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Time grid events (week/day) */
#ceCalendarContainer .fc-timegrid-event {
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
}

#ceCalendarContainer .fc-event:hover {
    opacity: 0.85;
}

#ceCalendarContainer .fc-toolbar-title {
    font-size: 18px !important;
    font-weight: 600;
}

/* ── Filter Bar ──────────────────────────────────────────── */
/*
 * Single inline row: FILTER label + dropdowns + save + load
 * Wraps responsively on mobile.
 */

.ce-filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-color, #d1d8dd);
    padding: 8px 0;
    margin-top: 8px;
}

.ce-filter-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, #8d99a6);
    letter-spacing: 0.8px;
    flex-shrink: 0;
    padding-right: 2px;
}

.ce-filter-select {
    border: 1px solid var(--border-color, #d1d8dd);
    border-radius: 4px;
    padding: 4px 24px 4px 8px;
    font-size: 12px;
    background: #fff;
    outline: none;
    flex: 0 1 auto;
    min-width: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.ce-filter-select:focus {
    border-color: var(--primary, #4a90d9);
}

.ce-filter-load {
    max-width: 120px;
}

/* ── Event Detail Modal ──────────────────────────────────── */

.ce-event-detail { padding: 5px; }

.ce-detail-header {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ce-detail-section { margin-bottom: 15px; }

.ce-detail-section h6 {
    font-weight: 700;
    color: var(--heading-color, #333);
    border-bottom: 1px solid var(--border-color, #d1d8dd);
    padding-bottom: 4px;
    margin-bottom: 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ce-detail-section .table { margin-bottom: 0; }
.ce-detail-section .table td {
    padding: 3px 8px;
    font-size: 13px;
    border-top: none;
}

/* ── Approval Modal ──────────────────────────────────────── */

.ce-approval-list { max-height: 500px; overflow-y: auto; }

.ce-approval-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color, #d1d8dd);
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fff;
    transition: box-shadow 0.2s;
}

.ce-approval-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.ce-approval-info h5 { margin: 0 0 4px 0; font-size: 14px; font-weight: 600; }
.ce-approval-info p { margin: 0; font-size: 12px; }
.ce-approval-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── DateTime Builder ────────────────────────────────────── */

.ce-time-grid { padding: 5px 0; }

.ce-time-grid label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 5px;
    color: var(--text-muted, #8d99a6);
    text-transform: uppercase;
}

.ce-time-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.ce-time-btn-row .btn { min-width: 45px; font-size: 12px; }

.ce-time-btn-row .btn.active {
    background-color: var(--primary, #4a90d9) !important;
    color: #fff !important;
    border-color: var(--primary, #4a90d9) !important;
}

.ce-dt-builder-btn { margin-left: 4px; vertical-align: middle; }

/* ── Settings Modal ──────────────────────────────────────── */

.ce-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid var(--border-color, #d1d8dd);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 13px;
}

.ce-manage-tables { display: flex; gap: 8px; flex-wrap: wrap; }
.ce-manage-tables .btn { font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────── */

.badge {
    display: inline-block; padding: 3px 8px; border-radius: 3px;
    font-size: 11px; font-weight: 600;
}
.badge-primary { background: #4a90d9; color: #fff; }
.badge-secondary { background: #6c757d; color: #fff; }
.badge-warning { background: #ffc107; color: #333; }
.badge-danger { background: #dc3545; color: #fff; }
.badge-light { background: #f8f9fa; color: #333; border: 1px solid #ddd; }
.badge-info { background: #17a2b8; color: #fff; }

/* ── Print Group ─────────────────────────────────────────── */

.ce-print-group .dropdown-menu { min-width: 140px; }
.ce-print-group .dropdown-menu a {
    padding: 5px 12px; font-size: 13px; display: block;
    color: #333; text-decoration: none;
}
.ce-print-group .dropdown-menu a:hover { background: #f5f5f5; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* ── Mobile (≤768px) ───────────────────────────────────── */

@media (max-width: 768px) {
    .ce-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .ce-topbar-left {
        width: 100%;
    }

    .ce-topbar-right {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .ce-search-input {
        width: 100%;
        flex: 1;
    }

    #ceCalendarContainer .fc-toolbar {
        flex-direction: column;
        gap: 6px;
    }

    /* Filter bar wraps to multiple rows on mobile */
    .ce-filters-bar {
        gap: 6px;
    }

    .ce-filter-select {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        font-size: 13px;
        padding: 6px 24px 6px 8px;
    }

    .ce-filter-label {
        flex-basis: 100%;
        padding-bottom: 2px;
    }

    .ce-filter-load {
        max-width: none;
    }

    .ce-approval-card {
        flex-direction: column;
        align-items: stretch;
    }

    .ce-approval-actions {
        margin-top: 10px;
        justify-content: flex-end;
    }
}

/* ── Small Mobile (≤480px) ─────────────────────────────── */

@media (max-width: 480px) {
    .ce-topbar-right .btn {
        font-size: 11px;
        padding: 4px 6px;
    }

    #ceImportBtn, #ceExportBtn { font-size: 0; }
    #ceImportBtn .fa, #ceExportBtn .fa { font-size: 13px; }

    .ce-time-btn-row .btn { min-width: 38px; font-size: 11px; }

    .ce-filter-select {
        flex: 1 1 100%;
        font-size: 13px;
    }

    #ceCalendarContainer .fc-toolbar-title {
        font-size: 15px !important;
    }
}

/* ── Staff Notes ──────────────────────────────────────── */
.ce-staff-note-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 4px;
}

/* ── Modal responsive tweaks ──────────────────────────── */
@media (max-width: 768px) {
    .modal-dialog.modal-xl, .modal-dialog.modal-lg {
        margin: 5px !important;
        max-width: calc(100% - 10px) !important;
    }

    .modal-body {
        padding: 10px !important;
    }

    .ce-event-detail .row {
        flex-direction: column;
    }

    .ce-event-detail .col-md-8,
    .ce-event-detail .col-md-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .ce-list-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .ce-list-row > div:last-child {
        margin-top: 6px;
        justify-content: flex-end !important;
    }

    .modal-footer .standard-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .modal-footer .btn-group {
        margin-right: 4px !important;
        margin-bottom: 4px;
    }
}
