/* Client Portal — Styles */

/* Ensure footer sticks to bottom */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Login Page */
.login-page {
  display: flex;
  flex: 1;
  background: #000;
  padding: 2rem 1rem;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
}

.login-logo {
  margin-bottom: 1.5rem;
}

.login-logo img {
  height: 48px;
  width: auto;
}

.login-title {
  font-size: 1.5rem;
  color: #fff;
  margin: 0 0 0.4rem;
}

.login-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 2rem;
}

.login-field {
  text-align: left;
  margin-bottom: 1.25rem;
}

.login-field label {
  display: block;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.4rem;
}

.login-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.login-field input:focus {
  outline: none;
  border-color: #D4A84B;
}

.login-field input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.login-btn {
  width: 100%;
  padding: 0.85rem;
  background: #D4A84B;
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.login-btn:hover {
  opacity: 0.9;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-back-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  border: none;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s;
}

.login-back-btn:hover {
  color: rgba(255, 255, 255, 0.75);
}

.login-sent-msg {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1.5rem;
  text-align: left;
}

.login-sent-msg strong {
  color: #D4A84B;
}

.login-error {
  font-size: 0.85rem;
  color: #f08090;
  margin-bottom: 0.75rem;
  text-align: left;
  min-height: 1.2em;
}

/* Top bar — back link left, session info right */
.portal-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.logged-in-as {
  margin: 0 0 0 auto;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}

.signout-inline {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.signout-inline:hover {
  color: #D4A84B;
}

.portal-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
  padding-top: 80px;
}

.portal-page > .container {
  flex: 1;
}

.portal-header {
  padding: 1.25rem 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-header h1 {
  font-size: 2rem;
  color: #fff;
  margin: 0 0 0.4rem;
}

.portal-header .user-email {
  color: #D4A84B;
  font-size: 0.95rem;
}

.portal-section {
  padding: 1.5rem 0;
}

.portal-section + .portal-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-section h2 {
  font-size: 1.3rem;
  color: #fff;
  margin: 0 0 1.5rem;
  font-weight: 500;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed rgba(212, 168, 75, 0.5);
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: #D4A84B;
  background: rgba(212, 168, 75, 0.05);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #D4A84B;
}

.upload-zone p {
  margin: 0.4rem 0;
  color: rgba(255, 255, 255, 0.8);
}

.upload-zone .upload-hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.75rem;
}

.upload-progress {
  margin-top: 1.5rem;
  display: none;
}

.progress-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #D4A84B;
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.progress-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
  text-align: center;
}

/* Alert messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  display: none;
}

.alert.success {
  background: rgba(40, 167, 69, 0.15);
  border: 1px solid rgba(40, 167, 69, 0.4);
  color: #75d88e;
}

.alert.error {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #f08090;
}

/* Files List */
.files-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.file-item:last-child {
  border-bottom: none;
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: rgba(212, 168, 75, 0.1);
  border: 1px solid rgba(212, 168, 75, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: #D4A84B;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  color: #fff;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.2rem;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-download,
.btn-delete {
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity 0.2s;
}

.btn-download {
  background: #D4A84B;
  color: #000;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.btn-download:hover {
  opacity: 0.85;
}

.btn-delete {
  background: rgba(220, 53, 69, 0.15);
  color: #f08090;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.btn-delete:hover {
  background: rgba(220, 53, 69, 0.25);
}

.empty-state {
  text-align: center;
  padding: 3rem 0;
  color: rgba(255, 255, 255, 0.35);
}

.empty-state p {
  margin: 0.5rem 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #D4A84B;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Admin-specific */
.client-group {
  margin-bottom: 2.5rem;
}

.client-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(212, 168, 75, 0.3);
}

.client-email-label {
  font-size: 1rem;
  color: #D4A84B;
  font-weight: 500;
}

.client-file-count {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
}

.admin-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #D4A84B;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.2rem;
}

/* Client management */
.add-client-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.add-client-input {
  flex: 1;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
}

.add-client-input:focus {
  outline: none;
  border-color: #D4A84B;
}

.add-client-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.btn-add-client {
  padding: 0.65rem 1.25rem;
  background: #D4A84B;
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn-add-client:hover {
  opacity: 0.85;
}

.clients-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.client-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.client-list-item:last-child {
  border-bottom: none;
}

.client-list-email {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
}

.btn-remove-client {
  padding: 0.3rem 0.75rem;
  background: rgba(220, 53, 69, 0.15);
  color: #f08090;
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-remove-client:hover {
  background: rgba(220, 53, 69, 0.25);
}

/* Statement upload form */
.statement-upload-form {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 1.5rem;
}

.statement-upload-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.statement-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.statement-field label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.statement-submit-field {
  flex: 0 0 auto;
}

.statement-submit-field .btn-add-client {
  height: 100%;
  min-height: 40px;
}


@media (max-width: 768px) {
  .statement-upload-row {
    flex-direction: column;
  }
  .statement-submit-field {
    flex: 1;
  }
}

/* Client list cards (admin page) */
.client-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
  text-decoration: none;
}

.client-card:hover {
  border-color: rgba(212,168,75,0.4);
  background: rgba(255,255,255,0.05);
}

.client-card-info {
  flex: 1;
  min-width: 0;
}

.client-card-name {
  font-size: 1rem;
  color: #fff;
  font-weight: 500;
}

.client-card-email {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
  margin-top: 0.1rem;
}

.client-card-notes {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.3);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-arrow {
  font-size: 1.1rem;
  color: rgba(212,168,75,0.6);
  flex-shrink: 0;
}

/* Client detail page */
.back-link {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover {
  color: #D4A84B;
}

.btn-edit-client {
  padding: 0.3rem 0.75rem;
  background: rgba(212,168,75,0.12);
  color: #D4A84B;
  border: 1px solid rgba(212,168,75,0.3);
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-edit-client:hover {
  background: rgba(212,168,75,0.2);
}

.client-inline-edit {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}

.client-detail-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.client-detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.client-detail-field label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.client-section-heading {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.75rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.client-section-heading:first-of-type {
  margin-top: 1rem;
  border-top: none;
  padding-top: 0;
}

.client-stmt-upload {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Danger zone — pinned right above footer */
.danger-zone {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 0.75rem 0;
}

.danger-zone p {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.28);
  margin: 0;
}

/* Audit log */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.audit-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.audit-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.75);
  vertical-align: top;
}

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

.audit-action {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

.audit-action.LOGIN       { background: rgba(212,168,75,0.15); color: #D4A84B; }
.audit-action.DOWNLOAD    { background: rgba(100,180,255,0.12); color: #7cc4ff; }
.audit-action.UPLOAD_CLIENT { background: rgba(100,220,130,0.12); color: #75d88e; }
.audit-action.UPLOAD_ADMIN  { background: rgba(200,130,255,0.12); color: #cc99ff; }

.audit-ts {
  color: rgba(255,255,255,0.35);
  font-size: 0.8rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .audit-table .audit-ip,
  .audit-table .audit-size { display: none; }
}

@media (max-width: 768px) {
  .file-item {
    flex-wrap: wrap;
  }

  .file-actions {
    width: 100%;
    padding-top: 0.5rem;
  }

  .btn-download,
  .btn-delete {
    flex: 1;
    text-align: center;
  }

  .admin-stats {
    gap: 1rem;
  }
}
