/* calendar.css - Monitoring Jadwal PT Mondylia Amerta */
:root {
  --color-kalibrasi: #10b981;   /* emerald-500 */
  --color-presentasi: #3b82f6;  /* blue-500 */
  --color-izin: #f59e0b;        /* amber-500 */
  --color-sakit: #ef4444;       /* red-500 */
  --color-lainnya: #8b5cf6;     /* violet-500 */
  --color-bg: #f8fafc;          /* slate-50 */
  --color-card: #ffffff;
  --color-border: #e2e8f0;      /* slate-200 */
  --color-text: #1e293b;        /* slate-800 */
  --color-text-muted: #64748b;  /* slate-500 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --transition: 150ms ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--color-bg); color: var(--color-text); line-height: 1.5; min-height: 100vh; }

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
.header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; background: var(--color-card); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow-sm); }
.header-left { display: flex; flex-direction: column; gap: 0.25rem; }
.header-left h1 { font-size: 1.25rem; font-weight: 700; color: var(--color-text); }
.subtitle { font-size: 0.75rem; color: var(--color-text-muted); font-weight: 500; }
.header-right { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; width: 100%; }
.control-group { display: flex; flex-direction: column; gap: 0.25rem; min-width: 140px; flex: 1; }
.control-group span { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.control-group select, .control-group input { padding: 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.875rem; background: var(--color-card); color: var(--color-text); transition: border-color var(--transition), box-shadow var(--transition); }
.control-group select:focus, .control-group input:focus { outline: none; border-color: var(--color-presentasi); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600; border-radius: var(--radius); border: none; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--color-presentasi); color: white; }
.btn-primary:hover:not(:disabled) { background: #2563eb; }
.btn-success { background: var(--color-kalibrasi); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-secondary { background: var(--color-border); color: var(--color-text); }
.btn-secondary:hover:not(:disabled) { background: #cbd5e1; }
.btn-danger { background: var(--color-sakit); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* Main */
.main { flex: 1; padding: 1.5rem; overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; padding: 0.75rem 1rem; background: var(--color-card); border-radius: var(--radius); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.legend-item { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; font-weight: 500; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* Calendar Grid */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; min-width: 980px; }
.day-header { padding: 0.5rem; text-align: center; font-weight: 600; font-size: 0.75rem; color: var(--color-text-muted); background: var(--color-card); border-radius: var(--radius); border: 1px solid var(--color-border); }
.day-cell { min-height: 100px; background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.375rem; display: flex; flex-direction: column; gap: 2px; transition: box-shadow var(--transition); }
.day-cell:hover { box-shadow: var(--shadow-md); z-index: 1; }
.day-cell.today { border-color: var(--color-presentasi); box-shadow: 0 0 0 2px rgb(59 130 246 / 0.15); }
.day-cell.other-month { background: #f1f5f9; opacity: 0.6; }
.day-number { font-size: 0.75rem; font-weight: 600; color: var(--color-text); }
.day-cell.other-month .day-number { color: var(--color-text-muted); }
.events-list { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.event-chip { display: flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: transform var(--transition); border: 1px solid transparent; }
.event-chip:hover { transform: scale(1.02); z-index: 2; box-shadow: var(--shadow-md); }
.event-chip .event-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.event-chip .event-name { flex: 1; min-width: 0; }
.event-chip .event-location { font-size: 0.65rem; opacity: 0.8; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
.more-events { font-size: 0.65rem; color: var(--color-text-muted); text-align: center; padding: 0.125rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgb(0 0 0 / 0.5); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 100; animation: fadeIn 150ms ease; }
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow-md); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; animation: slideUp 200ms ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-text-muted); padding: 0; line-height: 1; }
.modal-close:hover { color: var(--color-text); }
#eventForm { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: flex; flex-direction: column; gap: 0.375rem; }
.form-row label { display: flex; flex-direction: column; gap: 0.375rem; font-size: 0.8125rem; font-weight: 500; }
.form-row label span.required { color: var(--color-sakit); }
.form-row select, .form-row input, .form-row textarea { padding: 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.875rem; font-family: inherit; background: var(--color-card); color: var(--color-text); }
.form-row select:focus, .form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--color-presentasi); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }

/* Toast */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 200; }
.toast { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--color-card); border-radius: var(--radius); box-shadow: var(--shadow-md); border-left: 4px solid var(--color-presentasi); animation: slideIn 300ms ease; }
.toast.success { border-left-color: var(--color-kalibrasi); }
.toast.error { border-left-color: var(--color-sakit); }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* Responsive */
@media (max-width: 768px) {
  .header { flex-direction: column; align-items: stretch; }
  .controls { flex-direction: column; align-items: stretch; }
  .control-group { min-width: 0; }
  .btn { width: 100%; }
  .calendar-grid { min-width: 100%; }
  .day-cell { min-height: 80px; }
}