/* ============================================================
   css/agenda.css  –  THIQLA Agenda Mendatang Page
   ============================================================ */

/* ── Page Loader ─────────────────────────────────────────── */
#agendaLoader {
    position: fixed; inset: 0;
    background: rgba(255,255,255,.88);
    display: flex; align-items: center; justify-content: center;
    gap: 14px;
    font-size: 14px; color: #64748b;
    z-index: 9999;
}
.ag-spinner {
    width: 44px; height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: agSpin .8s linear infinite;
}
@keyframes agSpin { to { transform: rotate(360deg); } }

/* ── Page Header ─────────────────────────────────────────── */
.ag-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.ag-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.ag-header-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white;
    box-shadow: 0 4px 16px rgba(37,99,235,.3);
    flex-shrink: 0;
}
.ag-page-header h1 {
    font-size: 22px; font-weight: 800;
    color: #0f172a; margin: 0 0 4px;
}
.ag-page-header p {
    font-size: 13px; color: #64748b; margin: 0;
}

/* ── Admin Toolbar ───────────────────────────────────────── */
.ag-admin-toolbar {
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(90deg, #1e3a8a, #2563eb);
    color: white;
    padding: 10px 18px;
    border-radius: 12px;
    flex-wrap: wrap;
}
.ag-btn-add {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    color: white;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 7px;
    transition: background .2s;
}
.ag-btn-add:hover { background: rgba(255,255,255,.25); }
.ag-toggle-wrap {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: rgba(255,255,255,.85);
    cursor: pointer;
}

/* ── Stats Row ───────────────────────────────────────────── */
.ag-stats-row {
    display: flex; gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.ag-stat {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 20px;
    display: flex; align-items: center; gap: 14px;
    flex: 1; min-width: 140px;
}
.ag-stat > i {
    font-size: 22px;
    color: #2563eb;
    background: #eff6ff;
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ag-stat div { display: flex; flex-direction: column; gap: 2px; }
.ag-stat-num {
    font-size: 22px; font-weight: 800; color: #0f172a;
    line-height: 1;
}
.ag-stat-label { font-size: 11px; color: #64748b; }

/* ── Filter Bar ──────────────────────────────────────────── */
.ag-filter-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.ag-filter-btn {
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 13px; font-weight: 500; color: #475569;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    transition: all .18s;
}
.ag-filter-btn:hover { border-color: #93c5fd; color: #2563eb; background: #eff6ff; }
.ag-filter-btn.active { background: #2563eb; border-color: #2563eb; color: white; }

/* ── Timeline / Card Layout ──────────────────────────────── */
.ag-month-group { margin-bottom: 32px; }
.ag-month-label {
    font-size: 13px; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 10px;
}
.ag-month-label::after {
    content: ''; flex: 1; height: 1px; background: #e2e8f0;
}

.ag-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ── Agenda Card ─────────────────────────────────────────── */
.ag-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    position: relative;
}
.ag-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0,0,0,.1);
    border-color: #93c5fd;
}
.ag-card.ag-inactive {
    opacity: .55;
    filter: grayscale(.3);
}
.ag-card-accent {
    height: 4px;
}
.ag-card-body {
    padding: 18px 20px;
}
.ag-card-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 12px;
}
.ag-card-date-box {
    display: flex; align-items: center; gap: 12px;
}
.ag-date-block {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 8px 12px;
    text-align: center;
    min-width: 54px;
    flex-shrink: 0;
}
.ag-date-day {
    display: block;
    font-size: 26px; font-weight: 800; color: #0f172a;
    line-height: 1;
}
.ag-date-month {
    display: block;
    font-size: 11px; font-weight: 600; color: #64748b;
    text-transform: uppercase;
    margin-top: 2px;
}
.ag-date-year {
    display: block;
    font-size: 10px; color: #94a3b8; margin-top: 1px;
}
.ag-date-range {
    display: block;
    font-size: 10px; color: #f59e0b; margin-top: 3px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.ag-date-info { flex: 1; }
.ag-card-title {
    font-size: 15px; font-weight: 700; color: #0f172a;
    margin: 0 0 6px; line-height: 1.35;
}
.ag-card-meta {
    display: flex; flex-direction: column; gap: 3px;
}
.ag-card-meta span {
    font-size: 12px; color: #64748b;
    display: flex; align-items: center; gap: 6px;
}
.ag-card-meta i { width: 12px; text-align: center; color: #94a3b8; }

.ag-cat-badge {
    font-size: 11px; font-weight: 700;
    padding: 4px 10px; border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
}

/* Category colours */
.ag-cat-wajib       { background: #fee2e2; color: #b91c1c; }
.ag-cat-training    { background: #dbeafe; color: #1d4ed8; }
.ag-cat-fun         { background: #fef3c7; color: #d97706; }
.ag-cat-rapat       { background: #f3e8ff; color: #7c3aed; }
.ag-cat-pengumuman  { background: #d1fae5; color: #065f46; }
.ag-cat-lainnya     { background: #f1f5f9; color: #475569; }

/* accent bar colours */
.ag-accent-wajib       { background: linear-gradient(90deg, #ef4444, #dc2626); }
.ag-accent-training    { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.ag-accent-fun         { background: linear-gradient(90deg, #f59e0b, #d97706); }
.ag-accent-rapat       { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.ag-accent-pengumuman  { background: linear-gradient(90deg, #10b981, #059669); }
.ag-accent-lainnya     { background: linear-gradient(90deg, #64748b, #475569); }

.ag-card-desc {
    font-size: 12.5px; color: #64748b;
    line-height: 1.5;
    margin: 10px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ag-card-desc b, .ag-card-desc strong { font-weight: 600; }
.ag-card-desc i, .ag-card-desc em { font-style: italic; }
.ag-card-desc u { text-decoration: underline; }
.ag-card-desc ul, .ag-card-desc ol { margin: 0; padding-left: 20px; }
.ag-card-desc p { margin: 0; }
.ag-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}
.ag-card-organizer {
    font-size: 11.5px; color: #64748b;
    display: flex; align-items: center; gap: 5px;
}
.ag-card-organizer i { color: #94a3b8; }
.ag-card-actions {
    display: flex; gap: 6px;
}
.ag-btn-card-edit, .ag-btn-card-delete {
    width: 28px; height: 28px; border-radius: 6px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: background .15s;
}
.ag-btn-card-edit   { background: #eff6ff; color: #2563eb; }
.ag-btn-card-delete { background: #fef2f2; color: #dc2626; }
.ag-btn-card-edit:hover   { background: #dbeafe; }
.ag-btn-card-delete:hover { background: #fee2e2; }
.ag-inactive-badge {
    position: absolute; top: 12px; left: 12px;
    background: #334155; color: white;
    font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 20px;
}

/* ── Past event dim ──────────────────────────────────────── */
.ag-card.ag-past .ag-date-block {
    background: #f1f5f9;
}
.ag-past-label {
    font-size: 10px; font-weight: 600; color: #94a3b8;
    margin-left: 6px;
    background: #f1f5f9; padding: 2px 7px; border-radius: 10px;
}

/* ── Empty State ─────────────────────────────────────────── */
.ag-empty {
    text-align: center; padding: 60px 20px; color: #94a3b8;
}
.ag-empty i { font-size: 52px; display: block; margin-bottom: 14px; }
.ag-empty h3 { font-size: 16px; font-weight: 700; color: #64748b; margin-bottom: 6px; }
.ag-empty p  { font-size: 13px; }

/* ── Detail Panel (slide-in) ─────────────────────────────── */
.ag-detail-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1200;
    display: flex; justify-content: flex-end;
}
.ag-detail-panel {
    width: 440px; max-width: 100%;
    background: white;
    height: 100%;
    overflow-y: auto;
    display: flex; flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,.15);
    animation: slideInRight .28s ease;
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.ag-detail-header {
    padding: 20px 20px 16px;
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    position: sticky; top: 0; background: white; z-index: 1;
}
.ag-detail-title-area { flex: 1; }
.ag-detail-cat {
    display: inline-block;
    font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    margin-bottom: 8px;
}
.ag-detail-header h2 {
    font-size: 18px; font-weight: 800; color: #0f172a; margin: 0;
    line-height: 1.35;
}
.ag-detail-header-actions { display: flex; gap: 8px; align-items: center; }
.ag-btn-edit-sm {
    background: #eff6ff; color: #2563eb;
    border: 1px solid #bfdbfe;
    padding: 6px 14px; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background .15s;
}
.ag-btn-edit-sm:hover { background: #dbeafe; }
.ag-detail-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #64748b; transition: background .15s;
}
.ag-detail-close:hover { background: #fee2e2; color: #dc2626; }
.ag-detail-body { padding: 20px; flex: 1; }
.ag-detail-banner {
    height: 6px; border-radius: 4px;
    margin-bottom: 20px;
}
.ag-detail-info-row {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.ag-detail-info-box {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 130px;
}
.ag-detail-info-box i { color: #2563eb; font-size: 16px; flex-shrink: 0; }
.ag-detail-info-box div { display: flex; flex-direction: column; gap: 2px; }
.ag-detail-info-box .di-label { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; }
.ag-detail-info-box .di-val   { font-size: 13px; color: #0f172a; font-weight: 600; }
.ag-detail-desc-label {
    font-size: 11px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: .8px;
    margin-bottom: 8px;
}
.ag-detail-desc {
    font-size: 14px; color: #475569; line-height: 1.7;
}
.ag-detail-desc b, .ag-detail-desc strong { font-weight: 600; }
.ag-detail-desc i, .ag-detail-desc em { font-style: italic; }
.ag-detail-desc u { text-decoration: underline; }
.ag-detail-desc ul, .ag-detail-desc ol { margin: 8px 0; padding-left: 24px; }
.ag-detail-desc li { margin: 4px 0; }
.ag-detail-desc p { margin: 8px 0; }
.ag-detail-desc p:first-child { margin-top: 0; }
.ag-detail-desc p:last-child { margin-bottom: 0; }
.ag-detail-no-desc { font-size: 13px; color: #94a3b8; font-style: italic; }

/* ── Modal ───────────────────────────────────────────────── */
.ag-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1300;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.ag-modal {
    background: white;
    border-radius: 20px;
    width: 100%; max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    animation: agModalIn .25s ease;
}
.ag-modal-sm { max-width: 420px; }
@keyframes agModalIn {
    from { transform: scale(.94) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
.ag-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
}
.ag-modal-header h2 {
    font-size: 17px; font-weight: 800; color: #0f172a;
    display: flex; align-items: center; gap: 8px; margin: 0;
}
.ag-modal-header h2 i { color: #2563eb; }
.ag-modal-header-danger h2 i { color: #dc2626; }
.ag-modal-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #64748b;
}
.ag-modal-close:hover { background: #fee2e2; color: #dc2626; }
.ag-modal-body  { padding: 20px 24px; }
.ag-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Form ────────────────────────────────────────────────── */
.ag-form-row {
    display: flex; gap: 14px; margin-bottom: 16px;
}
.ag-field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ag-field-full { flex: 0 0 100%; }
.ag-field-toggle {
    flex-direction: row; align-items: center; gap: 12px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 10px 14px;
    flex: 0 0 auto;
}
.ag-field label {
    font-size: 12px; font-weight: 600; color: #475569;
}
.ag-req { color: #ef4444; }
.ag-field input[type=text],
.ag-field input[type=date],
.ag-field input[type=time],
.ag-field select,
.ag-field textarea {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13.5px; font-family: inherit;
    color: #0f172a;
    transition: border-color .18s, box-shadow .18s;
    outline: none;
}
.ag-field input:focus,
.ag-field select:focus,
.ag-field textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.ag-field textarea { resize: vertical; min-height: 90px; }
.ag-toggle-label { font-size: 12px; font-weight: 600; color: #475569; }

/* Toggle Switch */
.ag-switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.ag-switch input { opacity: 0; width: 0; height: 0; }
.ag-slider {
    position: absolute; inset: 0; background: #cbd5e1;
    border-radius: 22px; cursor: pointer; transition: .3s;
}
.ag-slider::before {
    content: ''; position: absolute;
    width: 16px; height: 16px;
    left: 3px; bottom: 3px;
    background: white; border-radius: 50%;
    transition: .3s;
}
.ag-switch input:checked + .ag-slider { background: #22c55e; }
.ag-switch input:checked + .ag-slider::before { transform: translateX(20px); }
.ag-switch-lg { width: 48px; height: 26px; }
.ag-switch-lg .ag-slider::before { width: 20px; height: 20px; }
.ag-switch-lg input:checked + .ag-slider::before { transform: translateX(22px); }

/* ── Buttons ─────────────────────────────────────────────── */
.ag-btn-save {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white; border: none;
    padding: 10px 24px; border-radius: 10px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: opacity .2s;
}
.ag-btn-save:disabled { opacity: .6; cursor: not-allowed; }
.ag-btn-cancel {
    background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
    padding: 10px 20px; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
}
.ag-btn-cancel:hover { background: #e2e8f0; }
.ag-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white; border: none;
    padding: 10px 22px; border-radius: 10px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
}
.ag-btn-danger:disabled { opacity: .6; cursor: not-allowed; }

/* ── Delete Warning ──────────────────────────────────────── */
.ag-delete-warning {
    text-align: center; padding: 16px 8px;
}
.ag-delete-warning > i {
    font-size: 42px; color: #f59e0b;
    display: block; margin-bottom: 12px;
}
.ag-delete-warning p { font-size: 14px; color: #475569; margin: 0 0 8px; }
.ag-delete-warning strong {
    display: block; font-size: 15px; color: #0f172a;
    margin-bottom: 8px;
}
.ag-delete-note { font-size: 12px; color: #94a3b8 !important; }

/* ── Toast ───────────────────────────────────────────────── */
#agToast {
    position: fixed; bottom: 28px; right: 28px;
    background: #0f172a; color: white;
    padding: 12px 20px; border-radius: 12px;
    font-size: 13.5px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    z-index: 9999; max-width: 360px;
    animation: agToastIn .25s ease;
    transition: opacity .3s;
}
@keyframes agToastIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
#agToast.ag-toast-success { background: #059669; }
#agToast.ag-toast-error   { background: #dc2626; }

/* ── hidden utility ──────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .ag-cards-grid { grid-template-columns: 1fr 1fr; }
    .ag-detail-panel { width: 100%; }
}
@media (max-width: 600px) {
    .ag-page-header { flex-direction: column; align-items: flex-start; }
    .ag-cards-grid { grid-template-columns: 1fr; }
    .ag-form-row    { flex-direction: column; }
    .ag-stats-row   { flex-direction: column; }
    .ag-modal { border-radius: 12px; }
}
