/* ============================================
   COMMUNICATIONS MODULE
   Announcements, Newsletter, Calendar
   ============================================ */

/* ---- Shared toolbar ---- */
.comm-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.comm-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.comm-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.comm-search-wrap .form-control { padding-left: 36px; }

/* ---- Grid layout ---- */
.comm-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

/* ---- Left panel: list of announcements ---- */
.comm-list-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow: hidden;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.comm-list-header {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.comm-list-title {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: #111827;
}

.comm-list-scroll {
  overflow-y: auto;
  flex: 1;
}

.comm-list-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f9fafb;
  cursor: pointer;
  transition: background 0.12s;
}

.comm-list-item:hover { background: #f9fafb; }
.comm-list-item.active { background: #eff6ff; border-left: 3px solid #1d4ed8; }

.comm-item-type {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.type-announcement { background: #dbeafe; color: #1e40af; }
.type-newsletter    { background: #d1fae5; color: #065f46; }
.type-event         { background: #fef3c7; color: #92400e; }
.type-urgent        { background: #fee2e2; color: #991b1b; }

.comm-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-item-meta {
  font-size: 0.7rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comm-item-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-published { background: #10b981; }
.dot-draft     { background: #9ca3af; }

/* ---- Right panel: detail / editor ---- */
.comm-detail-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow: hidden;
}

.comm-detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comm-detail-title-text {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.comm-detail-body { padding: 20px; }

/* ---- Status badges ---- */
.comm-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.comm-status.published { background: #d1fae5; color: #065f46; }
.comm-status.draft     { background: #f3f4f6; color: #6b7280; }
.comm-status.scheduled { background: #fef3c7; color: #92400e; }

/* ---- Compose form ---- */
.comm-form-group {
  margin-bottom: 16px;
}

.comm-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.comm-form-input,
.comm-form-select,
.comm-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  color: #111827;
  transition: border-color 0.15s;
  background: #fff;
  box-sizing: border-box;
}

.comm-form-input:focus,
.comm-form-select:focus,
.comm-form-textarea:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

.comm-form-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.comm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.comm-audience-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.comm-audience-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.12s;
}

.comm-audience-chip:has(input:checked) {
  border-color: #1d4ed8;
  background: #eff6ff;
  color: #1e40af;
}

/* ---- Full detail view (reading mode) ---- */
.comm-read-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.comm-read-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.comm-read-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.comm-read-body {
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ---- Stats row ---- */
.comm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.comm-stat {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  border-left: 4px solid #1d4ed8;
}

.comm-stat.s-green  { border-left-color: #16a34a; }
.comm-stat.s-orange { border-left-color: #f59e0b; }
.comm-stat.s-red    { border-left-color: #dc2626; }

.comm-stat-num {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  display: block;
}

.comm-stat-label { font-size: 0.72rem; color: #6b7280; margin-top: 2px; }

/* ---- Empty state ---- */
.comm-empty {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
}

.comm-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.comm-empty-text { font-size: 0.875rem; }

/* ---- Calendar ---- */
.cal-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.cal-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow: hidden;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f3f4f6;
}

.cal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: #111827;
}

.cal-nav-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.cal-nav-btn:hover { background: #f3f4f6; }

.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 14px;
  gap: 2px;
}

.cal-day-name {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  padding: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  color: #374151;
}

.cal-day:hover { background: #f3f4f6; }
.cal-day.other-month { color: #d1d5db; }
.cal-day.today { background: #1d4ed8; color: #fff; font-weight: 700; }
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f59e0b;
}

.cal-day.today.has-event::after { background: #fff; }

/* Events list panel */
.cal-events-list { padding: 14px; }

.cal-event-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f9fafb;
}

.cal-event-item:last-child { border-bottom: none; }

.cal-event-color {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.cal-event-title { font-size: 0.82rem; font-weight: 600; color: #111827; margin-bottom: 2px; }
.cal-event-date  { font-size: 0.72rem; color: #6b7280; }

/* ICT Lab styles */
.ict-stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.ict-stat {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  border-left: 4px solid #7c3aed;
  text-align: center;
}

.ict-stat-num {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  display: block;
}

.ict-stat-label { font-size: 0.72rem; color: #6b7280; }

.ict-curriculum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.ict-class-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow: hidden;
}

.ict-class-card-header {
  background: linear-gradient(135deg, #4c1d95, #7c3aed);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ict-class-name { font-weight: 700; font-size: 0.9rem; }
.ict-class-count { font-size: 0.72rem; opacity: 0.8; }

.ict-topic-list { padding: 12px 16px; }

.ict-topic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f9fafb;
  font-size: 0.8rem;
}

.ict-topic-row:last-child { border-bottom: none; }

.ict-topic-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
}

.ict-topic-check.done    { background: #d1fae5; color: #065f46; }
.ict-topic-check.pending { background: #f3f4f6; color: #9ca3af; }

.ict-topic-label { flex: 1; color: #374151; }
.ict-topic-term  { font-size: 0.68rem; color: #9ca3af; }

/* Progress bar */
.ict-progress-bar {
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0 4px;
}

.ict-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: 3px;
  transition: width 0.5s;
}

/* Activity log table */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.log-table th {
  background: #f8fafc;
  padding: 9px 14px;
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.log-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}

.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: #f9fafb; }

.log-action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.log-login    { background: #dbeafe; color: #1e40af; }
.log-create   { background: #d1fae5; color: #065f46; }
.log-update   { background: #fef3c7; color: #92400e; }
.log-delete   { background: #fee2e2; color: #991b1b; }
.log-approve  { background: #ede9fe; color: #5b21b6; }
.log-publish  { background: #ccfbf1; color: #0f766e; }
.log-payment  { background: #d1fae5; color: #065f46; }
.log-system   { background: #f3f4f6; color: #6b7280; }

/* Responsive */
@media (max-width: 900px) {
  .comm-grid  { grid-template-columns: 1fr; }
  .cal-grid   { grid-template-columns: 1fr; }
  .comm-stats { grid-template-columns: 1fr 1fr; }
  .ict-stats  { grid-template-columns: 1fr 1fr; }
  .comm-form-row { grid-template-columns: 1fr; }
  .comm-audience-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 500px) {
  .comm-stats { grid-template-columns: 1fr; }
  .ict-stats  { grid-template-columns: 1fr; }
}

/* Announcements/Newsletter tab bar — the 3 tabs (with inline
   padding:8px 18px) don't fit narrow phones on one line and forced
   the whole page to overflow sideways. Shrink and let them wrap. */
@media (max-width: 400px) {
  .comm-tab {
    padding: 7px 10px !important;
    font-size: 0.78rem !important;
  }
}
