/* ==========================================================================
   StudyHub Global - client portal
   Sits on top of the website theme, so the portal matches the public pages.
   ========================================================================== */

.portal-area {
  padding: 50px 0 70px;
  background: #f5f7fb;
}

.portal-area .container { max-width: 1140px; }

/* ---------------------------------------------------------------- bar */

.portal-bar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e4e8f0; border-radius: 12px;
  padding: 16px 20px; margin-bottom: 24px;
  box-shadow: 0 6px 22px rgba(20, 35, 70, .05);
}
.portal-who { display: flex; align-items: center; gap: 12px; }
.portal-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: #2154cf; color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.portal-who strong { font-size: 16px; color: #1b2334; display: block; }
.portal-ref { font-size: 13px; color: #8a93a8; }

.portal-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portal-nav a, .portal-logout button {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  color: #55607a; background: #f2f5fb; border: 1px solid transparent; cursor: pointer;
}
.portal-nav a:hover, .portal-logout button:hover { background: #e6ecf9; color: #0f2765; }
.portal-nav a.is-active { background: #2154cf; color: #fff; }
.portal-logout { display: inline; margin: 0; }

/* ---------------------------------------------------------------- cards */

.portal-card {
  background: #fff; border: 1px solid #e4e8f0; border-radius: 12px;
  margin-bottom: 24px; box-shadow: 0 6px 22px rgba(20, 35, 70, .05);
}
.portal-card-head {
  padding: 16px 22px; border-bottom: 1px solid #eef1f7;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.portal-card-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: #1b2334; }
.portal-card-head .right { margin-left: auto; }
.portal-card-body { padding: 22px; }
.portal-note { color: #55607a; font-size: 14px; margin: 0 0 18px; }

.portal-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---------------------------------------------------------------- forms */

.portal-field { margin-bottom: 18px; }
.portal-field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: #1b2334; }
.portal-field input[type=text],
.portal-field input[type=email],
.portal-field input[type=password],
.portal-field input[type=tel],
.portal-field select,
.portal-field textarea {
  width: 100%; padding: 11px 13px; font-size: 14px; color: #1b2334;
  border: 1px solid #e4e8f0; border-radius: 8px; background: #fbfcfe;
  font-family: inherit;
}
.portal-field input:focus, .portal-field select:focus, .portal-field textarea:focus {
  outline: none; border-color: #2154cf; background: #fff; box-shadow: 0 0 0 3px rgba(33, 84, 207, .1);
}
.portal-field textarea { min-height: 90px; resize: vertical; }
.portal-help { font-size: 12.5px; color: #8a93a8; margin-top: 5px; }
.portal-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.portal-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border: 0; border-radius: 8px; cursor: pointer;
  background: #2154cf; color: #fff; font-size: 15px; font-weight: 600; text-decoration: none;
}
.portal-btn:hover { background: #0f2765; color: #fff; }
.portal-btn-light { background: #f2f5fb; color: #55607a; border: 1px solid #e4e8f0; }
.portal-btn-light:hover { background: #e6ecf9; color: #0f2765; }
.portal-btn-sm { padding: 7px 13px; font-size: 13px; }
.portal-btn-danger { background: #fff; color: #b3261e; border: 1px solid #f0c9c5; }
.portal-btn-danger:hover { background: #b3261e; color: #fff; }
.portal-btn[disabled] { opacity: .6; cursor: not-allowed; }
.portal-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- uploader */

.portal-drop {
  border: 1.5px dashed #c8d2e6; border-radius: 10px; background: #fafbff;
  padding: 26px 18px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.portal-drop.dragover { border-color: #2154cf; background: #eef2fd; }
.portal-drop input[type=file] { display: none; }
.portal-drop .pick { color: #2154cf; font-weight: 700; }
.portal-drop .rules { font-size: 12.5px; color: #8a93a8; margin-top: 8px; }
.portal-chosen { margin-top: 14px; font-size: 14px; color: #1d7a45; font-weight: 600; }
.portal-chosen .file-size { color: #8a93a8; font-weight: 400; }
.portal-preview { margin-top: 14px; }
.portal-preview img {
  max-width: 220px; max-height: 170px; border: 1px solid #e4e8f0;
  border-radius: 8px; padding: 4px; background: #fff;
}

/* ---------------------------------------------------------------- table */

.portal-table-wrap { overflow-x: auto; }
table.portal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.portal-table th, table.portal-table td {
  padding: 13px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid #eef1f7;
}
table.portal-table th {
  background: #fafbfe; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .4px; color: #8a93a8; font-weight: 700; white-space: nowrap;
}
table.portal-table tr:last-child td { border-bottom: 0; }
table.portal-table .doc-name { font-weight: 600; color: #1b2334; }
table.portal-table .doc-meta { font-size: 12.5px; color: #8a93a8; }

.badge {
  display: inline-block; padding: 4px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
.badge-live { background: #e8f7ee; color: #1d7a45; }
.badge-draft { background: #eef0f5; color: #55607a; }
.badge-rejected { background: #fdecea; color: #b3261e; }
.badge-soft { background: #eef2fd; color: #2154cf; }

.portal-empty { padding: 40px 20px; text-align: center; color: #8a93a8; }
.portal-empty strong { display: block; color: #55607a; font-size: 15px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- alerts */

.portal-alert {
  padding: 14px 18px; border-radius: 9px; margin-bottom: 20px;
  font-size: 14px; border: 1px solid transparent;
}
.portal-alert-success { background: #e8f7ee; color: #1d6b3c; border-color: #c4e7d3; }
.portal-alert-error   { background: #fdecea; color: #b3261e; border-color: #f3ccc8; }
.portal-alert-warning { background: #fff6e2; color: #8a5a00; border-color: #f3e0b6; }
.portal-alert-info    { background: #eef2fd; color: #0f2765; border-color: #ccd9f7; }
.portal-alert ul { margin: 8px 0 0 18px; padding: 0; }

/* ---------------------------------------------------------------- sign in */

.portal-narrow { max-width: 520px; margin: 0 auto; }
.portal-switch { text-align: center; margin-top: 18px; font-size: 14px; color: #55607a; }
.portal-note-box {
  background: #eef2fd; border: 1px solid #ccd9f7; color: #0f2765;
  border-radius: 9px; padding: 14px 18px; font-size: 13.5px; margin-bottom: 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

.portal-area img { max-width: 100%; }
.portal-table-wrap { -webkit-overflow-scrolling: touch; }

@media (max-width: 991px) {
  .portal-area { padding: 34px 0 50px; }
  .portal-grid { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 767px) {
  .portal-area { padding: 26px 0 40px; }

  .portal-bar { padding: 14px; gap: 14px; }
  .portal-nav { margin-left: 0; width: 100%; }
  .portal-nav a, .portal-logout button { flex: 1 1 auto; text-align: center; }
  .portal-logout { display: flex; flex: 1 1 auto; }
  .portal-logout button { width: 100%; }

  .portal-card { border-radius: 10px; margin-bottom: 18px; }
  .portal-card-head { padding: 14px 16px; }
  .portal-card-head h2 { font-size: 15.5px; }
  .portal-card-head .right { margin-left: 0; width: 100%; }
  .portal-card-body { padding: 16px; }

  .portal-two { grid-template-columns: 1fr; gap: 0; }
  .portal-drop { padding: 20px 14px; }
  .portal-btn { width: 100%; }
  .portal-actions .portal-btn { flex: 1 1 100%; }
}

@media (min-width: 821px) and (max-width: 1080px) {
  table.portal-table { min-width: 620px; }
}

/* Phones and portrait tablets: the document list becomes a stack of cards. */
@media (max-width: 820px) {
  .portal-table-wrap { overflow-x: visible; }

  table.portal-table thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  table.portal-table tr {
    display: block;
    border: 1px solid #e4e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 0 16px 12px;
    background: #fff;
  }
  table.portal-table tr:first-child { margin-top: 16px; }
  table.portal-table td {
    display: block;
    padding: 5px 0;
    border: 0;
    white-space: normal;
  }
  table.portal-table td:empty { display: none; }
  table.portal-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
    color: #8a93a8; font-weight: 700; margin-bottom: 2px;
  }
  table.portal-table td.doc-actions { padding-top: 12px; }
  table.portal-table td.doc-actions .portal-btn {
    width: auto; flex: 1 1 auto; margin: 0 6px 6px 0; justify-content: center;
  }
  table.portal-table td.doc-actions form { display: inline-flex; flex: 1 1 auto; }
  table.portal-table td.doc-actions form .portal-btn { width: 100%; margin-right: 0; }
}

@media (max-width: 420px) {
  .portal-bar { flex-direction: column; align-items: flex-start; }
  .portal-avatar { width: 38px; height: 38px; font-size: 16px; }
  .portal-card-body { padding: 14px; }
  table.portal-table tr { margin-left: 12px; margin-right: 12px; }
}
