/* GHR VMS Password Store — styled per GHR Analytics UI/UX Guide */

/* === CSS Custom Properties === */
:root {
  /* Brand */
  --navy: #091e3a;
  --blue: #0078d4;
  --deep-blue: #0063b1;
  --muted-blue: #005a9e;
  --green: #107c10;
  --orange: #d83b01;
  --red: #e3008c;

  /* Glass (light mode) */
  --glass-bg: rgba(255,255,255,0.75);
  --glass-border: rgba(255,255,255,0.9);
  --glass-shadow: 0 4px 28px rgba(0,0,0,0.07);

  /* Page */
  --page-bg: #f0f4f8;
  --dot-color: rgba(0,0,0,0.06);
  --input-glow: 0 0 0 3px rgba(0,120,212,0.15), 0 4px 20px rgba(0,0,0,0.08);

  /* Text */
  --text-primary: #323130;
  --text-secondary: #605e5c;
  --text-muted: #a19f9d;

  /* Sizing */
  --radius-card: 20px;
  --radius-inner: 12px;
  --radius-button: 8px;
}

[data-theme="dark"] {
  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.09);
  --glass-shadow: 0 4px 28px rgba(0,0,0,0.45);
  --page-bg: #0d1117;
  --dot-color: rgba(255,255,255,0.04);
  --input-glow: 0 0 0 3px rgba(0,120,212,0.3), 0 4px 20px rgba(0,0,0,0.3);
  --text-primary: #e1dfdd;
  --text-secondary: #a19f9d;
  --text-muted: #605e5c;
}

/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background-color: var(--page-bg);
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* === Login === */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #091e3a, #0078d4, #005a9e, #091e3a);
  background-size: 300% 300%;
  animation: gradientShift 12s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 48px 40px;
  border-radius: var(--radius-card);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: var(--navy); }
.login-card p { color: var(--text-secondary); margin-bottom: 32px; }

/* === App Shell === */
#app-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* === Header (animated gradient) === */
.header-bar {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 24px;
  background: linear-gradient(135deg, #091e3a, #0078d4, #005a9e, #091e3a);
  background-size: 300% 300%;
  animation: gradientShift 12s ease infinite;
  box-shadow: 0 1px 12px rgba(0,0,0,0.25);
  color: #fff;
  flex-shrink: 0;
  z-index: 10;
}

.header-bar h1 {
  font-size: 16px;
  font-weight: 700;
  margin-right: 32px;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.nav-tab {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.72);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover { color: #fff; }

.nav-tab.active {
  color: #fff;
  font-weight: 600;
  border-bottom-color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-user {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}

.header-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: var(--radius-button);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.header-btn:hover { background: rgba(255,255,255,0.25); }

/* === Content Area === */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0;
  background-color: var(--page-bg);
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
}

.content-column {
  width: 75%;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: hidden;
}

@media (max-width: 1024px) { .content-column { width: 90%; } }
@media (max-width: 640px) { .content-column { width: 100%; padding: 0 16px; } }

.page { display: none; }
.page.active { display: block; }

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

.page-header h1 { font-size: 20px; font-weight: 700; }

.page-actions { display: flex; gap: 10px; align-items: center; }

.page-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

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

.btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid rgba(0,0,0,0.12);
}
.btn-ghost:hover { background: rgba(0,120,212,0.06); }

.btn-danger { background: var(--orange); color: #fff; }
.btn-danger:hover { background: #c43501; }

.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; }
.btn-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }

/* === Inputs === */
.input, .select {
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-button);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  transition: box-shadow 0.2s;
}

.input:focus { box-shadow: var(--input-glow); border-color: var(--blue); }

select.input {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.input-group { display: flex; gap: 6px; align-items: center; }
.input-group .input { flex: 1; }

.search-bar { margin-bottom: 16px; }
.search-bar .input { width: 100%; max-width: 400px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.form-group .input, .form-group textarea.input { width: 100%; }

.form-static { font-size: 13px; color: var(--text-secondary); padding: 4px 0; }

.inline-form { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.inline-form .input { flex: 1; }

/* === Glass Cards === */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-card);
  padding: 24px;
  max-width: 800px;
  transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.info-box {
  background: rgba(0,120,212,0.06);
  border: 1px solid rgba(0,120,212,0.15);
  border-radius: var(--radius-inner);
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.info-box ul { margin: 6px 0 0 18px; }

.status-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-button);
  font-size: 13px;
}

.status-msg.success { background: rgba(16,124,16,0.08); color: var(--green); }
.status-msg.error { background: rgba(216,59,1,0.08); color: var(--orange); }

/* === Tables === */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-inner);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
}

.table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--navy);
  color: rgba(255,255,255,0.92);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 13px;
  overflow-wrap: break-word;
  word-break: break-all;
  max-width: 400px;
}

.table td a {
  word-break: break-all;
}

.table tr:hover td { background: rgba(0,120,212,0.04); }
.table .empty { text-align: center; color: var(--text-muted); padding: 30px; }
.table .actions { display: flex; gap: 6px; }

.password-cell { font-family: 'Fira Code', Consolas, monospace; letter-spacing: 1px; }

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.4;
  transition: opacity 0.15s;
  padding: 0 2px;
}
.copy-btn:hover { opacity: 1; }

/* === CSV import mapping === */
.mapping-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.mapping-label { font-weight: 600; font-size: 13px; min-width: 100px; }
.mapping-select { width: 200px; }
.mapping-sample { font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Audit log === */
.audit-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.audit-view { background: rgba(0,120,212,0.1); color: var(--blue); }
.audit-create { background: rgba(16,124,16,0.1); color: var(--green); }
.audit-update { background: rgba(255,185,0,0.15); color: #9a7b00; }
.audit-delete { background: rgba(216,59,1,0.1); color: var(--orange); }
.audit-login { background: rgba(0,0,0,0.05); color: var(--text-secondary); }

/* === Icon upload === */
.icon-upload-grid { display: flex; gap: 24px; }

.icon-upload-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.icon-upload-item label { font-weight: 600; font-size: 12px; color: var(--text-secondary); }

.icon-preview {
  width: 80px;
  height: 80px;
  border: 2px dashed rgba(0,0,0,0.12);
  border-radius: var(--radius-inner);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--glass-bg);
}

.icon-preview img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.icon-preview-wide { width: 160px; }

.header-logo {
  height: 32px;
  margin-right: 12px;
  object-fit: contain;
}
.icon-placeholder { font-size: 11px; color: var(--text-muted); }
.icon-file-input { display: none; }

/* === Modals === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  padding: 24px;
  width: 460px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-lg { width: 600px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; font-weight: 700; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-button);
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  transition: opacity 0.3s;
}

/* === Responsive === */
@media (max-width: 640px) {
  .header-bar { padding: 0 12px; height: 48px; }
  .header-bar h1 { font-size: 14px; margin-right: 16px; }
  .nav-tab { padding: 4px 8px; font-size: 13px; }
  .card { padding: 16px; border-radius: 16px; }
  .modal-dialog { width: 95%; padding: 16px; border-radius: 16px; }
}

@media (max-width: 480px) {
  .header-user { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
