/* =============================================================================
   University of Misurata · Faculty of Engineering
   Portal Responsive Framework & Design System
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

:root {
  --portal-brand: #0c2b44;
  --portal-brand-dark: #071c2d;
  --portal-brand-2: #103c5c;
  --portal-brand-3: #176696;
  --portal-accent: #059669;
  --portal-accent-soft: #ecfdf5;
  --portal-accent-border: #a7f3d0;
  --portal-blue: #0284c7;
  --portal-blue-soft: #e0f2fe;
  --portal-purple: #7c3aed;
  --portal-purple-soft: #f5f3ff;
  --portal-amber: #d97706;
  --portal-amber-soft: #fffbeb;
  --portal-danger: #dc2626;
  --portal-danger-soft: #fef2f2;
  --portal-ink: #0f172a;
  --portal-ink-muted: #475569;
  --portal-ink-light: #64748b;
  --portal-line: #e2e8f0;
  --portal-line-subtle: #f1f5f9;
  --portal-bg: #f8fafc;
  --portal-card: #ffffff;
  --portal-shadow-sm: 0 2px 6px rgba(12, 43, 68, 0.05);
  --portal-shadow: 0 4px 20px -2px rgba(12, 43, 68, 0.07);
  --portal-shadow-hover: 0 12px 30px -4px rgba(12, 43, 68, 0.12);
  --portal-radius-sm: 10px;
  --portal-radius: 16px;
  --portal-radius-lg: 22px;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, Tahoma, Arial, sans-serif;
  color: var(--portal-ink);
  -webkit-font-smoothing: antialiased;
}

input, select, textarea, button {
  font: inherit;
}

button, a, input, select, textarea {
  touch-action: manipulation;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #d97706;
  outline-offset: 3px;
}

button:disabled, [aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}

/* Base Micro-Components & Utilities */
.mc-shell {
  max-width: 1120px;
  margin: 28px auto;
  padding: 0 20px;
  line-height: 1.85;
  color: var(--portal-ink);
}

.mc-shell * {
  box-sizing: border-box;
  min-width: 0;
}

.mc-shell h1, .mc-shell h2, .mc-shell label {
  overflow-wrap: anywhere;
}

.mc-shell summary {
  cursor: pointer;
  min-height: 44px;
}

.mc-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.mc-card {
  background: var(--portal-card);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--portal-shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.mc-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--portal-shadow-hover);
}

.mc-muted {
  color: var(--portal-ink-light);
  font-size: .93rem;
}

.mc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.mc-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.mc-field input, .mc-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--portal-radius-sm);
  background: white;
  color: var(--portal-ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.mc-field input:focus, .mc-field select:focus {
  border-color: var(--portal-brand-3);
  box-shadow: 0 0 0 3px rgba(23, 102, 150, .14);
  outline: 0;
}

.mc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: var(--portal-radius-sm);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--portal-brand), var(--portal-brand-3));
  color: white;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(12, 43, 68, 0.16);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.mc-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(12, 43, 68, 0.24);
  filter: brightness(1.05);
}

.mc-alert {
  padding: 14px 18px;
  border-radius: var(--portal-radius-sm);
  background: var(--portal-amber-soft);
  color: #92400e;
  border: 1px solid #fde68a;
  border-inline-start: 4px solid var(--portal-amber);
  margin: 16px 0;
  font-weight: 600;
}

.mc-success {
  background: var(--portal-accent-soft);
  color: #065f46;
  border: 1px solid var(--portal-accent-border);
  border-inline-start: 4px solid var(--portal-accent);
}

.mc-danger {
  background: var(--portal-danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
  border-inline-start: 4px solid var(--portal-danger);
}

.mc-stat {
  padding: 18px;
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius-sm);
  background: #fbfdff;
  transition: transform .16s ease, border-color .16s ease;
}

.mc-stat:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.mc-stat strong {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--portal-brand);
  line-height: 1.35;
}

.mc-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #9eb6c8 #edf3f7;
}

.mc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}

.mc-table th, .mc-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--portal-line);
}

.mc-table th {
  background: #f1f5f9;
  color: var(--portal-brand);
  font-weight: 800;
}

.mc-table tbody tr:hover {
  background: #f8fafc;
}

.mc-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}

.mc-check input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--portal-accent);
}

.mc-shell h1 {
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  line-height: 1.4;
  margin: 0;
  color: var(--portal-brand);
  font-weight: 800;
}

.mc-shell h2 {
  font-size: 1.3rem;
  margin-top: 0;
  color: var(--portal-brand-2);
  font-weight: 700;
}

@media (max-width: 768px) {
  .mc-shell {
    margin: 16px auto;
    padding: 0 14px;
  }
  .mc-card {
    padding: 16px;
    border-radius: var(--portal-radius-sm);
  }
  .mc-shell h1 {
    font-size: 1.4rem;
  }
  .mc-grid {
    grid-template-columns: 1fr;
  }
  .mc-button {
    width: 100%;
  }
  .topbar, .header, .toolbar, .actions, .quick-actions {
    flex-wrap: wrap;
    gap: 10px;
  }
  .container, .wrap, .main, .content {
    max-width: 100%;
    min-width: 0;
  }
  .qbtn, .btn {
    white-space: normal;
    min-height: 44px;
    text-align: center;
  }
  input, select, textarea {
    font-size: 16px;
    max-width: 100%;
  }
  .table-wrap, .table-responsive {
    overflow-x: auto;
    max-width: 100%;
  }
}

@media print {
  .mc-no-print {
    display: none !important;
  }
  .mc-shell {
    margin: 0;
    padding: 0;
    max-width: none;
  }
  .mc-card {
    box-shadow: none;
    border-radius: 0;
    break-inside: avoid;
    border: none;
    padding: 0;
  }
  .mc-scroll {
    overflow: visible;
  }
  .mc-table thead {
    display: table-header-group;
  }
  .mc-table tr {
    break-inside: avoid;
  }
  body {
    background: #fff !important;
  }
}
