/* ═══════════════════════════════════════════════════
   Announcements Page — SaaS-Quality Stylesheet
   ═══════════════════════════════════════════════════ */

/* ─── Table ──────────────────────────────────────── */
.ann-table { border-collapse: collapse; }

.ann-table thead th {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 16px;
  white-space: nowrap;
  border: none;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.ann-table .th-ann-identity { min-width: 340px; }
.ann-table .th-ann-actions { width: 100px; text-align: center; }

.ann-table tbody tr.ann-row {
  border-bottom: 1px solid var(--border-light);
  transition: background .15s ease;
}

.ann-table tbody tr.ann-row:last-child { border-bottom: none; }

.ann-table tbody tr.ann-row:hover {
  background: rgba(37, 99, 235, .02);
}

.ann-table tbody td {
  padding: 12px 16px;
  font-size: .8125rem;
  vertical-align: middle;
  border: none;
  color: var(--text-primary);
}

/* ─── Announcement Identity Cell ─────────────────── */
.ann-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ann-identity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  flex-shrink: 0;
}

.ann-identity-icon.ann-type-news   { background: #ecfeff; color: #0891b2; }
.ann-identity-icon.ann-type-alert  { background: #fef2f2; color: #dc2626; }
.ann-identity-icon.ann-type-update { background: #eff6ff; color: #2563eb; }
.ann-identity-icon.ann-type-event  { background: #f0fdf4; color: #16a34a; }

.ann-identity-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ann-title-text {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
  line-height: 1.4;
}

.ann-meta-text {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  line-height: 1.4;
}

.ann-meta-dot {
  margin: 0 5px;
  color: var(--border);
}

.ann-type-label {
  font-weight: 500;
}

.ann-type-label.ann-type-news   { color: #0891b2; }
.ann-type-label.ann-type-alert  { color: #dc2626; }
.ann-type-label.ann-type-update { color: #2563eb; }
.ann-type-label.ann-type-event  { color: #16a34a; }

.ann-expired-text { color: #ef4444; }

/* ─── Status ─────────────────────────────────────── */
.ann-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}

.ann-status-active  { color: #059669; }
.ann-status-hidden  { color: #94a3b8; }
.ann-status-expired { color: #dc2626; }

.ann-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ann-status-dot.active {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, .2);
}

.ann-status-dot.hidden {
  background: #cbd5e1;
}

.ann-status-dot.expired {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, .15);
}

/* ─── Author / Actions ───────────────────────────── */
.td-ann-author {
  color: var(--text-secondary);
  font-size: .8125rem;
  white-space: nowrap;
}

.td-ann-actions { text-align: center; }

.ann-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ann-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: .875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  padding: 0;
}

.ann-action-edit:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(37, 99, 235, .12);
}

.ann-action-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, .12);
}

/* ─── Empty State ────────────────────────────────── */
.ann-empty-state {
  text-align: center;
  padding: 64px 24px;
}

.ann-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #eff6ff, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.75rem;
  color: var(--accent);
}

.ann-empty-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.ann-empty-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.ann-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
  border: none;
  cursor: pointer;
}

.ann-empty-cta:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

/* ═══════════════════════════════════════════════════
   Modal
   ═══════════════════════════════════════════════════ */

.ann-modal-dialog {
  max-width: 640px;
}

.ann-modal-content {
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .15), 0 4px 16px rgba(0, 0, 0, .08);
}

/* ─── Modal Header ───────────────────────────────── */
.ann-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 0;
  gap: 12px;
}

.ann-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ann-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.ann-modal-subtitle {
  font-size: .8125rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.ann-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  flex-shrink: 0;
  padding: 0;
}

.ann-modal-close:hover {
  background: var(--border-light);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ─── Modal Body ─────────────────────────────────── */
.ann-modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ann-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ann-field-row {
  display: flex;
  gap: 16px;
}

.ann-field-half {
  flex: 1;
  min-width: 0;
}

.ann-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.ann-required {
  color: var(--danger);
  font-weight: 500;
}

.ann-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .75rem;
}

.ann-input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
}

.ann-input::placeholder {
  color: var(--text-muted);
}

.ann-input:hover {
  border-color: #cbd5e1;
}

.ann-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.ann-select {
  width: 100%;
  padding: 9px 36px 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card-bg) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat left 12px center / 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all .15s ease;
  outline: none;
  font-family: inherit;
}

.ann-select:hover {
  border-color: #cbd5e1;
}

.ann-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.ann-textarea {
  width: 100%;
  min-height: 130px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: all .15s ease;
  outline: none;
  resize: vertical;
  font-family: inherit;
  line-height: 1.65;
}

.ann-textarea::placeholder {
  color: var(--text-muted);
}

.ann-textarea:hover {
  border-color: #cbd5e1;
}

.ann-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

/* ─── Toggle ─────────────────────────────────────── */
.ann-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--border-light);
  border-radius: 10px;
  gap: 16px;
}

.ann-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ann-toggle-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ann-toggle-desc {
  font-size: .75rem;
  color: var(--text-muted);
}

.ann-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.ann-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ann-toggle-track {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 12px;
  transition: all .2s ease;
}

.ann-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all .2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.ann-toggle input:checked + .ann-toggle-track {
  background: var(--accent);
}

.ann-toggle input:checked + .ann-toggle-track::after {
  right: calc(100% - 22px);
}

.ann-toggle input:focus-visible + .ann-toggle-track {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .2);
}

/* ─── Modal Footer ───────────────────────────────── */
.ann-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 28px 24px;
}

.ann-btn-cancel {
  padding: 9px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}

.ann-btn-cancel:hover {
  background: var(--border-light);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.ann-btn-publish {
  padding: 9px 24px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.ann-btn-publish:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}

.ann-btn-publish:active {
  transform: translateY(0);
  box-shadow: none;
}

.ann-btn-publish:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Modal Animation ────────────────────────────── */
#announcementModal .modal-dialog {
  transition: transform .25s cubic-bezier(.34, 1.4, .64, 1), opacity .2s ease;
}

#announcementModal.fade .modal-dialog {
  transform: scale(.95) translateY(12px);
  opacity: 0;
}

#announcementModal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .ann-modal-dialog {
    max-width: calc(100% - 24px);
    margin: 12px;
  }

  .ann-modal-header,
  .ann-modal-body,
  .ann-modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .ann-field-row {
    flex-direction: column;
    gap: 20px;
  }

  .ann-title-text { max-width: 200px; }
  .ann-table .th-ann-identity { min-width: 240px; }
}
