/* ============================================================
   Shared Mailbox IdP — minimal, clean stylesheet
   No external fonts or CDN dependencies
   ============================================================ */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #1a73e8;
  --blue-dark:  #1557b0;
  --green:      #188038;
  --red:        #d93025;
  --orange:     #e37400;
  --gray-50:    #f8f9fa;
  --gray-100:   #f1f3f4;
  --gray-200:   #e8eaed;
  --gray-400:   #bdc1c6;
  --gray-600:   #80868b;
  --gray-800:   #3c4043;
  --gray-900:   #202124;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --radius:     8px;
  --font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ============================================================
   Layout
   ============================================================ */

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ============================================================
   Card
   ============================================================ */

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  width: 100%;
  max-width: 560px;
}

.card-narrow { max-width: 380px; }

.card-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.card-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
}

.subtitle {
  margin-top: .25rem;
  color: var(--gray-600);
  font-size: .875rem;
}

/* ============================================================
   Form elements
   ============================================================ */

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 500;
  margin-bottom: .375rem;
  color: var(--gray-800);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field select {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--gray-400);
  border-radius: 6px;
  font-size: .9375rem;
  font-family: var(--font);
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}

.field input:disabled {
  background: var(--gray-100);
  color: var(--gray-600);
}

.field-hint, .hint {
  display: block;
  margin-top: .25rem;
  font-size: .8125rem;
  color: var(--gray-600);
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-weight: 400;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: .875rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }

.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }

.btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-100); }

.btn-full { width: 100%; margin-top: .5rem; }

.btn-sm {
  padding: .25rem .75rem;
  font-size: .8125rem;
}

.action-row {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-top: 1.25rem;
}

/* ============================================================
   Flash messages
   ============================================================ */

.flash-messages {
  width: 100%;
  max-width: 720px;
  margin-bottom: 1rem;
}

.flash {
  padding: .75rem 1rem;
  border-radius: 6px;
  margin-bottom: .5rem;
  font-size: .875rem;
}

.flash-success { background: #e6f4ea; color: #137333; border: 1px solid #b7dfbf; }
.flash-error   { background: #fce8e6; color: #c5221f; border: 1px solid #f5b8b5; }
.flash-info    { background: #e8f0fe; color: #1a56ab; border: 1px solid #b0c8f9; }

/* ============================================================
   Mailbox selection cards
   ============================================================ */

.mailbox-list {
  display: flex;
  flex-direction: column;
  gap: .625rem;
  margin-bottom: 1.25rem;
}

.mailbox-card {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.mailbox-card:hover { border-color: var(--blue); background: #f0f6ff; }
.mailbox-card input[type="radio"] { flex-shrink: 0; accent-color: var(--blue); }

.mailbox-card input[type="radio"]:checked + .mailbox-info {
  color: var(--blue);
}

.mailbox-info {
  display: flex;
  flex-direction: column;
  gap: .125rem;
}

.mailbox-label { font-weight: 600; }
.mailbox-email { font-size: .8125rem; color: var(--gray-600); }

/* ============================================================
   Admin layout
   ============================================================ */

.admin-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gray-50);
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: .25rem;
  flex: 1;
  overflow-x: auto;
}

.nav-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .375rem .75rem;
  border-radius: 5px;
  font-size: .875rem;
  white-space: nowrap;
  transition: background .15s;
}

.nav-links a:hover,
.nav-links a.active { background: rgba(255,255,255,.2); color: #fff; }

.nav-logout {
  margin-left: auto;
  color: rgba(255,255,255,.85) !important;
}

.admin-main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.admin-main h2 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--gray-900);
}

.admin-main h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: .75rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.admin-main .card {
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Tables
   ============================================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  font-size: .875rem;
}

.data-table th {
  background: var(--gray-100);
  text-align: left;
  padding: .625rem .875rem;
  font-weight: 600;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: .625rem .875rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table .row-disabled td { color: var(--gray-600); }

.action-cell {
  white-space: nowrap;
  display: flex;
  gap: .375rem;
  align-items: center;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-block;
  padding: .1875rem .5rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-active   { background: #e6f4ea; color: #137333; }
.badge-inactive { background: var(--gray-100); color: var(--gray-600); }
.badge-admin    { background: #e8f0fe; color: #1a56ab; }

/* ============================================================
   Stats / Dashboard
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue);
}

.stat-label {
  color: var(--gray-600);
  font-size: .8125rem;
  margin-top: .25rem;
}

.stat-link {
  display: block;
  margin-top: .75rem;
  font-size: .8125rem;
  color: var(--blue);
  text-decoration: none;
}

.info-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.info-box h3 { margin-bottom: .75rem; }

.info-box ul {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .375rem;
  font-size: .875rem;
}

.info-box code {
  background: var(--gray-100);
  padding: .125rem .375rem;
  border-radius: 4px;
  font-size: .8125rem;
}

/* ============================================================
   Assignment matrix
   ============================================================ */

.two-col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}

.assignment-matrix th { text-align: center; font-size: .8125rem; }
.matrix-cell { text-align: center; }

.matrix-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: .875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  transition: background .15s;
}

.matrix-btn-on  { background: #e6f4ea; color: var(--green); }
.matrix-btn-on:hover  { background: #fce8e6; color: var(--red); }
.matrix-btn-off { background: var(--gray-100); color: var(--gray-600); }
.matrix-btn-off:hover { background: #e6f4ea; color: var(--green); }

/* ============================================================
   Empty state
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--gray-600);
}

.empty-state p { margin-bottom: 1rem; }

/* ============================================================
   Page footer (change password link etc.)
   ============================================================ */

.page-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: .8125rem;
}

.page-footer a {
  color: var(--gray-600);
  text-decoration: none;
}

.page-footer a:hover { color: var(--blue); text-decoration: underline; }

/* ============================================================
   Utilities
   ============================================================ */

code { font-family: 'SF Mono', 'Fira Mono', Consolas, monospace; }
