/* ═══════════════════════════════════════════════════════════
   CertifyPro — ISO Certificate Issuance Portal
   Aesthetic: Refined regulatory dark with gold accents
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0e0f11;
  --bg-card:      #14161a;
  --bg-sidebar:   #0a0b0d;
  --bg-input:     #1a1c21;
  --border:       #252830;
  --border-light: #2e3140;

  --gold:         #c9a84c;
  --gold-dim:     #8a6d2f;
  --gold-glow:    rgba(201,168,76,0.15);

  --text:         #e8e6e1;
  --text-muted:   #6b7080;
  --text-subtle:  #3a3d4a;

  --success:      #2d7a4f;
  --success-bg:   rgba(45,122,79,0.12);
  --error:        #8b3030;
  --error-bg:     rgba(139,48,48,0.12);

  --radius:       6px;
  --radius-lg:    10px;
  --sidebar-w:    260px;
  --transition:   0.18s ease;
}

html { font-size: 15px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────── */
.portal-wrap {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.logo-seal {
  width: 42px; height: 42px;
  color: var(--gold);
  flex-shrink: 0;
}
.logo-seal svg { width: 100%; height: 100%; }
.logo-title {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.logo-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-item:hover {
  color: var(--text);
  background: var(--bg-card);
}
.nav-item.active {
  color: var(--gold);
  background: var(--gold-glow);
  border-color: var(--gold-dim);
}
.nav-icon { font-size: 0.7rem; opacity: 0.8; }

.sidebar-standards {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.standards-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  margin-bottom: 0.7rem;
}
.standard-chip {
  display: inline-block;
  font-size: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 100px;
  padding: 0.2rem 0.55rem;
  margin: 0.2rem 0.15rem;
}
.standard-chip--unmatched {
  background: transparent;
  color: var(--text-muted);
  border-style: dashed;
  opacity: 0.6;
}

/* ── Main ────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: 1000px;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.3rem;
}
.header-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.25rem;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  border: 1px solid;
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: #6ecf98; }
.alert-error   { background: var(--error-bg);   border-color: var(--error);   color: #e08080; }
.download-link {
  margin-left: auto;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.download-link:hover { text-decoration: underline; }

/* ── Form ────────────────────────────────────────────────── */
.cert-form { display: flex; flex-direction: column; gap: 1.5rem; }

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.section-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.form-section > .form-grid,
.form-section > .form-group {
  padding: 1.25rem 1.5rem;
}
.form-section > .form-grid + .form-grid { padding-top: 0; }

.form-grid {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
}
.form-grid-1 { grid-template-columns: 1fr; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.req { color: var(--gold); }

input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.6rem 0.8rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
input[type="date"] { color-scheme: dark; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7080' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }
textarea { resize: vertical; min-height: 80px; }

input:focus, select:focus, textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
select option { background: var(--bg-card); }

.field-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.field-hint a { color: var(--gold); text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }

/* ── Form Actions ────────────────────────────────────────── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #0a0b0d;
}
.btn-primary:hover {
  background: #dbbf6a;
  border-color: #dbbf6a;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-muted);
}
.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text);
}
.btn-outline {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-outline:hover { color: var(--text); border-color: var(--text-muted); }
.btn-danger {
  background: transparent;
  border: none;
  color: #e08080;
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-danger:hover { background: var(--error-bg); }
.btn-icon { font-size: 0.7rem; }
.btn-sm-full { width: 100%; justify-content: center; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.card-header {
  padding: 0.9rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.card-body { padding: 1.5rem; }

/* ── Upload Form ─────────────────────────────────────────── */
.upload-form .form-grid { padding: 0 0 1.25rem; }
.file-input-wrap { position: relative; }
.file-input-wrap input[type="file"] {
  position: absolute;
  opacity: 0; width: 0; height: 0;
}
.file-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}
.file-label:hover { border-color: var(--gold-dim); color: var(--text); }
.file-icon { font-size: 1rem; }

/* ── Placeholder Grid ────────────────────────────────────── */
.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.placeholder-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.ph-code {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--gold);
  background: none;
}
.ph-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}
code {
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  background: var(--bg);
  color: var(--gold);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.tip-box {
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Data Table ──────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.file-icon-sm { margin-right: 0.35rem; }

/* ── Cert Cards Grid ─────────────────────────────────────── */
.search-wrap { margin-bottom: 1.5rem; }
.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.7rem 1rem;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--gold-dim); }

.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
}
.cert-card:hover { border-color: var(--border-light); }

.cert-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.cert-standard {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.cert-badge {
  font-size: 0.65rem;
  background: var(--success-bg);
  color: #6ecf98;
  border: 1px solid var(--success);
  border-radius: 100px;
  padding: 0.15rem 0.5rem;
}
.cert-card-body { padding: 1.1rem; flex: 1; }
.cert-company {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.85rem;
  line-height: 1.3;
}
.cert-meta { display: flex; flex-direction: column; gap: 0.4rem; }
.cert-meta-row { display: flex; justify-content: space-between; gap: 0.5rem; }
.meta-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-val { font-size: 0.75rem; color: var(--text); text-align: right; }
.file-small { font-size: 0.65rem; color: var(--text-muted); word-break: break-all; }

.cert-card-footer {
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1.5rem 1.25rem; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 0.5rem; }
}
