/* ===============================
   Digital Relief Co. — Portal CSS (FULL REPLACEMENT)
   Fixes: gold accent bleed from style.css, consistent portal buttons,
   safe mobile layout helpers, keeps gold only for help/promos.
   =============================== */

/* ===============================
   GLOBAL DEFAULTS (marketing site may override)
   Keep these minimal — portal should not rely on :root for theming.
   =============================== */
:root{
  --gold-1: #f2d27a;
  --gold-2: #c9a24d;
  --gold-text: #1a1406;
}

/* ===============================
   PORTAL THEME (SCOPED)
   This is the key: style.css can keep gold in :root.
   Everything inside .portal-main becomes BLUE.
   =============================== */
.portal-main{
  --accent: #2f3e55;
  --accent-hover: #3a4d6a;
  --accent-text: #0b1220;

  /* Mobile breathing room for portal pages */
  padding-left: 0;
  padding-right: 0;
}

/* ===============================
   Portal Primary Button (Upload / Primary actions)
   Uses .btn-upload everywhere in portal for consistency.
   Forced blue so it will NEVER turn gold from style.css.
   =============================== */
.portal-main a.btn-upload{
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 10px 16px;
  border-radius: 10px;

  background-color: #2f3e55 !important;
  color: #ffffff !important;


  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;

  cursor: pointer;
  text-decoration: none;

  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);

  transition:
    transform .12s ease,
    box-shadow .12s ease,
    background-color .12s ease,
    filter .12s ease;
}

.portal-main a.btn-upload:hover{
  background-color: #3a4d6a !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  filter: brightness(1.03);
}

/* ===============================
   Secondary buttons (Download, etc.)
   =============================== */
.portal-main .btn-download{
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;

  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #ffffff !important;

  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}

.portal-main .btn-download:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.20);
}

/* ===============================
   Navbar: logout button should match nav buttons
   =============================== */
.portal-main .main-nav form{
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.portal-main .main-nav .logout-button{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}

.portal-main .main-nav .logout-button:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.20);
}

/* ===============================
   Dashboard tiles styling
   =============================== */
.portal-hero h1{ margin: 0 0 0.25rem 0; }
.portal-hero p { margin: 0; color: var(--text-muted); max-width: 70ch; }

.portal-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (max-width: 900px){
  .portal-grid{ grid-template-columns: 1fr; }
}

.portal-tile{
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-subtle);
  display: block;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.portal-tile:hover{
  transform: translateY(-1px);
  border-color: rgba(58, 77, 106, 0.6);
}

.portal-tile h3{
  margin: 0 0 0.35rem 0;
  border: none;
  padding: 0;
  text-align: left;
  color: #fde68a;
}

.portal-tile p{
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.portal-tile .meta{
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #d6dbea;
  opacity: 0.9;
}

/* ===============================
   File Sharing layout (responsive)
   NOTE: your new files.html uses card/list layout; this keeps legacy table safe too.
   =============================== */
.files-page{
  max-width: 980px;
  margin: 0 auto;
}

.files-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.files-table-wrap{
  margin-top: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

.files-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px; /* forces scroll on small screens instead of squishing */
}

.files-table th,
.files-table td{
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.files-table thead th{
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.files-actions{
  white-space: nowrap;
}

/* ===============================
   Mobile spacing fixes for portal pages
   =============================== */
@media (max-width: 768px){
  .portal-main{
    padding-left: 12px;
    padding-right: 12px;
  }

  .portal-main td:last-child{
    padding-right: 16px !important;
  }

  .portal-main .btn-download,
  .portal-main .btn-danger{
    margin-top: 6px;
    padding: 10px 14px;
  }

  .portal-main td:last-child{
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .files-header{
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===============================
   Help / promos (keep GOLD intentionally)
   Use on help pages only.
   =============================== */
a.help-btn,
a.btn-gold{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none !important;

  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: var(--gold-text) !important;

  border: 1px solid rgba(201,162,77,0.45);
  box-shadow: 0 6px 20px rgba(201,162,77,0.35);

  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

a.help-btn:hover,
a.btn-gold:hover{
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(201,162,77,0.55);
}

.tailscale-help h1,
.tailscale-help h3{
  color: var(--gold-1) !important;
}

/* Admin tile subtle distinction */
.admin-tile{
  border-style: dashed;
  opacity: 0.92;
}
/* ===============================
   FIX: Logout button (force consistent styling)
   =============================== */
.main-nav form{
  display: inline-flex !important;
  margin: 0 !important;
  padding: 0 !important;
}

.main-nav .logout-button{
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14) !important;
  background: rgba(255,255,255,0.06) !important;
  color: #ffffff !important;

  font-weight: 700 !important;
  padding: 8px 12px !important;
  border-radius: 999px !important;

  cursor: pointer !important;
  line-height: 1 !important;

  transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}

.main-nav .logout-button:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.12) !important;
  border-color: rgba(255,255,255,0.20) !important;
}


/* ===============================
   Upload page (matches portal style)
   =============================== */
.upload-wrap{
  max-width: 760px;
  margin: 0 auto;
  padding: 0.25rem 0;
}

.upload-header{ margin-bottom: 1rem; }
.upload-title{ margin: 0 0 0.35rem 0; }

.upload-subtitle{
  margin: 0.35rem 0;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Card */
.upload-card{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: 0 10px 26px rgba(0,0,0,0.25);
}

/* Alert */
.upload-alert{
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.35;
}
.upload-alert-error{
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid rgba(255, 77, 77, 0.35);
}

/* Dropzone */
.upload-dropzone{
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.18);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.upload-dropzone:focus{
  outline: 2px solid rgba(255,255,255,0.30);
  outline-offset: 2px;
}
.upload-dropzone:hover{
  border-color: rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.22);
}
.upload-dropzone.is-dragover{
  border-color: rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.30);
  transform: translateY(-1px);
}

.upload-icon{
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  flex: 0 0 auto;
}

.upload-dropzone-text{
  min-width: 0;
  flex: 1 1 auto;
}
.upload-strong{ font-weight: 800; margin-bottom: 0.15rem; }
.upload-muted{ color: var(--text-muted); font-size: 0.95rem; }

/* Choose button */
.upload-choose{ flex: 0 0 auto; }

/* File meta */
.upload-filemeta{
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.file-pill{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}

.file-name{
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size{
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

/* Remove link */
.upload-link{
  background: transparent;
  border: none;
  padding: 0.25rem 0.25rem;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  text-decoration: underline;
}
.upload-link:hover{ color: #fff; }

/* Actions */
.upload-actions{
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.upload-footnote{
  margin: 0.95rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Screen-reader only */
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Mobile */
@media (max-width: 520px){
  .upload-card{ padding: 0.95rem; }
  .upload-dropzone{ flex-wrap: wrap; }
  .upload-choose{ width: 100%; }

  .upload-filemeta{
    flex-direction: column;
    align-items: stretch;
  }
  .file-pill{ width: 100%; }
  .file-name{
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }
  .file-size{ white-space: normal; }
}


/* ===============================
   Tailscale Help page: restore GOLD headings only here
   =============================== */
.tailscale-help{
  --accent: #f2d27a; /* gold */
}

.tailscale-help h1,
.tailscale-help h2,
.tailscale-help h3{
  color: var(--accent) !important;
}

@media (max-width: 768px) {
  .site-header .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
