/**
 * Macau Student Events Calendar Stylesheet
 */

:root {
  --mec-primary: #0f766e;
  --mec-primary-hover: #115e59;
  --mec-secondary: #0d9488;
  --mec-accent: #f59e0b;
  --mec-bg-light: #f8fafc;
  --mec-border: #e2e8f0;
  --mec-text-dark: #1e293b;
  --mec-text-muted: #64748b;
  --mec-today-bg: #ecfdf5;
  --mec-today-border: #10b981;
}

.mec-calendar-wrap {
  font-family: inherit;
  color: var(--mec-text-dark);
  margin: 2rem 0;
  position: relative;
}

/* Header Controls */
.mec-header-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--mec-border);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.mec-month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mec-month-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--mec-primary);
  margin: 0 0.75rem;
  min-width: 170px;
  text-align: center;
}

.mec-right-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mec-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--mec-border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--mec-text-dark);
  background-color: #fff;
  cursor: pointer;
  outline: none;
}
.mec-select:focus {
  border-color: var(--mec-secondary);
}

.mec-btn {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--mec-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--mec-text-dark);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.mec-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.mec-btn-today {
  background: var(--mec-primary);
  color: #ffffff;
  border-color: var(--mec-primary);
}
.mec-btn-today:hover {
  background: var(--mec-primary-hover);
}

.mec-view-switch {
  display: flex;
  border: 1px solid var(--mec-border);
  border-radius: 8px;
  overflow: hidden;
}

.mec-view-btn {
  padding: 0.5rem 0.85rem;
  background: #fff;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--mec-text-muted);
  transition: all 0.15s;
}
.mec-view-btn.active {
  background: var(--mec-primary);
  color: #fff;
}

/* Month Grid */
.mec-grid-view {
  background: #ffffff;
  border: 1px solid var(--mec-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03);
}

.mec-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--mec-border);
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--mec-text-muted);
  padding: 0.75rem 0;
}

.mec-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 520px;
}

.mec-day-cell {
  border-right: 1px solid var(--mec-border);
  border-bottom: 1px solid var(--mec-border);
  min-height: 105px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  transition: background 0.15s;
  position: relative;
}
.mec-day-cell:nth-child(7n) {
  border-right: none;
}
.mec-day-cell.other-month {
  background: #fafaf9;
  opacity: 0.45;
}
.mec-day-cell.today {
  background: var(--mec-today-bg);
}

.mec-day-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.25rem;
}
.mec-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mec-text-muted);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.mec-day-cell.today .mec-day-num {
  background: var(--mec-today-border);
  color: #ffffff;
}

.mec-day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-grow: 1;
}

.mec-event-pill {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.1s;
  border-left: 3px solid #0284c7;
}
.mec-event-pill:hover {
  transform: scale(1.02);
  filter: brightness(0.95);
}
.mec-event-pill.cat-talks-seminars {
  background: #fef3c7; color: #92400e; border-left-color: #f59e0b;
}
.mec-event-pill.cat-admissions-exams {
  background: #fee2e2; color: #991b1b; border-left-color: #ef4444;
}
.mec-event-pill.cat-tutoring-training {
  background: #ccfbf1; color: #115e59; border-left-color: #0d9488;
}
.mec-event-pill.cat-competitions-campus {
  background: #ede9fe; color: #5b21b6; border-left-color: #8b5cf6;
}

.mec-more-pill {
  font-size: 0.7rem;
  color: var(--mec-text-muted);
  font-weight: 600;
  margin-top: 2px;
  cursor: pointer;
}

/* List View */
.mec-events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mec-list-card {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--mec-border);
  border-radius: 12px;
  padding: 1.2rem;
  gap: 1.25rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.mec-list-card:hover {
  border-color: var(--mec-secondary);
  box-shadow: 0 4px 12px rgba(13,148,136,0.08);
}

.mec-card-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 65px;
  height: 65px;
  background: #f0fdfa;
  border: 2px solid #ccfbf1;
  border-radius: 10px;
  color: var(--mec-primary);
  flex-shrink: 0;
}
.mec-badge-m {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}
.mec-badge-d {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.mec-list-info {
  flex-grow: 1;
}
.mec-list-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  margin-bottom: 0.35rem;
}
.mec-list-title {
  margin: 0 0 0.4rem 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.mec-list-title a {
  color: var(--mec-text-dark);
  text-decoration: none;
}
.mec-list-title a:hover {
  color: var(--mec-secondary);
}

.mec-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--mec-text-muted);
}

.mec-list-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Modal / Drawer */
.mec-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.mec-modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.mec-modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
}
.mec-modal-close:hover {
  color: #1e293b;
}

/* Single Event Card Box */
.mec-single-event-box {
  background: #f8fafc;
  border: 1px solid var(--mec-border);
  border-left: 5px solid var(--mec-primary);
  border-radius: 12px;
  padding: 1.75rem;
  margin: 1.5rem 0 2.5rem 0;
}
.mec-single-box-title {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: 1.3rem;
  color: var(--mec-primary);
  font-weight: 700;
}
.mec-single-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}
.mec-single-item .mec-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mec-text-muted);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.mec-single-item .mec-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--mec-text-dark);
}
.mec-pill {
  display: inline-block;
  background: #ccfbf1;
  color: #0f766e;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 6px;
}

.mec-single-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-top: 1px solid var(--mec-border);
  padding-top: 1.25rem;
}
.mec-btn-primary {
  background: var(--mec-primary);
  color: #fff !important;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
}
.mec-btn-primary:hover {
  background: var(--mec-primary-hover);
}
.mec-btn-secondary {
  background: #f1f5f9;
  color: var(--mec-text-dark) !important;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid #cbd5e1;
}
.mec-btn-secondary:hover {
  background: #e2e8f0;
}
.mec-btn-outline {
  background: transparent;
  color: var(--mec-secondary) !important;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--mec-secondary);
}
.mec-btn-outline:hover {
  background: #f0fdfa;
}

/* Upcoming Cards Widget */
.mec-upcoming-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.mec-card {
  display: flex;
  background: #ffffff;
  border: 1px solid var(--mec-border);
  border-radius: 12px;
  padding: 1rem;
  gap: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: transform 0.15s, border-color 0.15s;
}
.mec-card:hover {
  transform: translateY(-2px);
  border-color: var(--mec-secondary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.mec-card-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 55px;
  height: 55px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  color: var(--mec-primary);
  flex-shrink: 0;
}
.mec-date-month {
  font-size: 0.7rem;
  font-weight: 700;
}
.mec-date-day {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}
.mec-card-content {
  flex-grow: 1;
  min-width: 0;
}
.mec-tag {
  font-size: 0.7rem;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.25rem;
}
.mec-card-title {
  margin: 0 0 0.35rem 0;
  font-size: 0.98rem;
  line-height: 1.35;
}
.mec-card-title a {
  color: var(--mec-text-dark);
  text-decoration: none;
}
.mec-card-title a:hover {
  color: var(--mec-secondary);
}
.mec-card-meta {
  font-size: 0.8rem;
  color: var(--mec-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.mec-badge-cost {
  color: #0f766e;
  font-weight: bold;
}

/* Spinner */
.mec-loading-overlay {
  position: absolute;
  top: 100px; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.mec-spinner {
  width: 40px; height: 40px;
  border: 4px solid #ccfbf1;
  border-top-color: var(--mec-secondary);
  border-radius: 50%;
  animation: mec-spin 0.8s linear infinite;
}
@keyframes mec-spin {
  to { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .mec-header-controls { flex-direction: column; align-items: stretch; }
  .mec-month-nav { justify-content: space-between; }
  .mec-right-controls { flex-direction: column; }
  .mec-select { width: 100%; }
  .mec-days-grid { min-height: 400px; }
  .mec-day-cell { min-height: 70px; padding: 2px; }
  .mec-event-pill { font-size: 0.65rem; padding: 1px 3px; }
  .mec-list-card { flex-direction: column; align-items: flex-start; }
}

/* Multi-day Event Pill Styles */
.mec-event-pill.mec-pill-multiday {
  border-left-width: 3px;
}
.mec-event-pill.mec-span-mid {
  opacity: 0.9;
  border-left-style: dashed;
}
