/* ===============================
   Asia Securities Portal Theme
   =============================== */

/* General Reset */
/* === Global Background for All Pages === */
html,
body {
  height: 100%;
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: #111827;
  background: url("/static/login_bg.png") no-repeat center center fixed;
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  position: relative;
}

/* Semi-transparent overlay for 50% dim effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.55);
  /* white overlay 50% */
  z-index: -1;
}

/* Containers & Cards stay readable */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 16px;
  margin: 16px 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}


/* Container */
.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px;
}

/* Header */
.main-header {
  background-color: #0f172a;
  /* Deep Navy Blue */
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  /* Allow wrapping on small screens */
  gap: 10px;
}

.header-left {
  display: flex;
  align-items: flex-start;
  /* ⬅️ aligns the text to the top of the logo */
  gap: 10px;
}

.logo {
  height: 32px;
  /* smaller, more balanced */
  max-height: 32px;
  width: auto;
}


.portal-title {
  font-size: 18px;
  font-weight: 600;
  margin-top: 4px;
  /* ⬅️ slight top margin for perfect balance */
}


.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.nav-links a {
  color: #e0e7ff;
  text-decoration: none;
  font-weight: 500;
}

.nav-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
  .header-left {
    width: 100%;
    justify-content: center;
    margin-bottom: 5px;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .portal-title {
    font-size: 16px;
  }

  .nav-links a {
    font-size: 13px;
  }
}

/* Footer */
.main-footer {
  background-color: #0f172a;
  color: #ffffffcc;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  margin-top: 40px;
}

/* Card */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Form Layout */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.field {
  display: flex;
  flex-direction: column;
}

.label-inline {
  font-weight: 600;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Buttons */
.btn {
  display: inline-block;
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover {
  background-color: #1d4ed8;
}

.btn.warn {
  background-color: #dc2626;
}

.btn.warn:hover {
  background-color: #b91c1c;
}

/* Flash message */
.flash {
  background: #ecfccb;
  border: 1px solid #84cc16;
  color: #374151;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
  /* Prevent table cells from crushing text */
}

/* Wrapper for tables to make them scroll horizontally on mobile */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

th {
  background-color: #f1f5f9;
}

.status {
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
}

.status.pending {
  background-color: #fef3c7;
  color: #92400e;
}

.status.approved {
  background-color: #dcfce7;
  color: #166534;
}

.status.rejected {
  background-color: #fee2e2;
  color: #991b1b;
}

/* === Sticky Footer Layout === */
html,
body {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  /* pushes footer to bottom */
}

.main-footer {
  background-color: #0f172a;
  color: #ffffffcc;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  margin-top: auto;
  /* ensures footer always at bottom */
}

/* === Action Buttons in Requests Table === */
.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}

.btn.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1.2;
}

/* === Action Buttons in Requests Table === */
.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}

.btn.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1.2;
}

/* === Submit Page Buttons === */
.form-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn.reset-btn {
  background-color: #6b7280;
  /* neutral gray */
  border: 1px solid #6b7280;
  color: white;
}

.btn.reset-btn:hover {
  background-color: #4b5563;
  border-color: #4b5563;
}

/* === Logs Filter Form Styling === */
.log-filter-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-filter-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .log-filter-form .form-grid {
    grid-template-columns: 1fr;
  }
}

.log-filter-form .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

/* Buttons same size */
.btn.btn-wide {
  min-width: 150px;
  text-align: center;
}

/* === Buttons (Standardized + CSV Green) === */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  /* ⬅️ reduced font size */
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

/* Blue primary button (Filter, etc.) */
.btn.primary {
  background-color: #2563eb;
  color: white;
}

.btn.primary:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
}

/* Green button (Download CSV) */
.btn.success {
  background-color: #16a34a;
  /* Green shade */
  color: white;
}

.btn.success:hover {
  background-color: #15803d;
  transform: translateY(-1px);
}

/* Button sizing consistency */
.btn.btn-wide {
  min-width: 150px;
  text-align: center;
}

/* Slight alignment adjustment for form actions */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

/* === Admin Users Table === */
.requests-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.requests-table th,
.requests-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  white-space: nowrap;
}

.requests-table th {
  background-color: #f1f5f9;
  font-weight: 600;
}

.requests-table-container {
  overflow-x: auto;
}

/* === Fix Request Table Alignment === */
.requests-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.requests-table th,
.requests-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
  white-space: nowrap;
}

.requests-table th {
  background-color: rgba(255, 255, 255, 0.9);
  text-align: left;
  font-weight: 600;
}

.requests-table td.action-cell {
  text-align: center;
  width: 160px;
  /* ⬅️ consistent action column width */
}

.action-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.btn.btn-sm.primary,
.btn.btn-sm.warn {
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1.2;
}

/* Center the dash placeholder */
.no-action {
  color: #9ca3af;
  font-size: 14px;
  display: inline-block;
  text-align: center;
}

.requests-table tr:hover {
  background-color: rgba(255, 255, 255, 0.4);
  transition: background-color 0.2s ease;
}

.btn.btn-sm.warn {
  background-color: #dc2626;
  color: white;
  padding: 5px 8px;
  font-size: 13px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn.btn-sm.warn:hover {
  background-color: #b91c1c;
}

/* === Login Page Styling === */
.login-container {
  position: relative;
  height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("/static/login_bg.png") no-repeat center center;
  background-size: cover;
}

/* Semi-transparent overlay for 50% transparency effect */
/* === Login Page Center Alignment Fix === */
.login-container {
  position: relative;
  min-height: calc(100vh - 120px);
  /* leave space for header/footer */
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  /* global background already applied */
}

/* Optional: ensure full viewport centering on large screens */
@media (min-height: 700px) {
  .login-container {
    height: calc(100vh - 120px);
  }
}

.login-card {
  position: relative;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}


.login-card h2 {
  color: #0f172a;
  margin-bottom: 8px;
}

.login-subtitle {
  color: #475569;
  font-size: 14px;
  margin-bottom: 20px;
}

.login-field {
  display: flex;
  flex-direction: column;
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
  color: #1e293b;
}

.login-field input {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

.login-field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.btn.btn-wide {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  box-sizing: border-box;
  display: block;
}

/* Center the login card regardless of header/footer */
.login-viewport {
  /* take the full viewport height minus typical header+footer space */
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* keeps some breathing room on small screens */
}

/* Ensure the main container doesn't fight our centering on the login page */
.login-viewport .login-card {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  width: 340px;
  text-align: center;
}

/* Optional: if your <main> was flex-centered globally, neutralize it here */
main .login-viewport {
  flex: 1 0 auto;
}

.flash {
  background-color: #eaffd0;
  border: 1px solid #c1e599;
  color: #2b2b2b;
  padding: 10px 15px;
  margin: 10px auto;
  border-radius: 8px;
  text-align: center;
  width: 90%;
  max-width: 800px;
  font-weight: 500;
}

.flash {
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 500;
  margin: 10px auto;
  width: 90%;
  max-width: 800px;
  text-align: center;
  transition: opacity 0.6s;
  font-size: 15px;
}

/* Success (green) */
.flash.success {
  background-color: #d4f8d4;
  border: 1px solid #64c864;
  color: #155724;
}

/* Error (red) */
.flash.error {
  background-color: #ffd6d6;
  border: 1px solid #e46464;
  color: #7a0b0b;
}

/* ==========================
   Logout Button - Header Style
   ========================== */
.logout-btn {
  background-color: transparent;
  color: #ffffff;
  border: 1px solid #ffffffcc;
  border-radius: 6px;
  padding: 6px 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.95em;
}

.logout-btn:hover {
  background-color: #ffffff;
  color: #0b2447;
  /* your deep navy tone */
  border-color: #ffffff;
}

/* Optional: Slight vertical alignment fix for nav bar buttons */
nav form {
  display: inline;
  margin: 0;
  padding: 0;
}

.home-card {
  text-align: center;
  margin-top: 50px;
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.btn.primary {
  background-color: #007bff;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
}

.btn.primary:hover {
  background-color: #0056b3;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

/* ==========================
   LOGS PAGE — CLEAN LAYOUT
   ========================== */

.logs-card {
  max-width: 300px;
  margin-left: 0;
  padding: 25px 35px;
}

.logs-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.logs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.logs-field label {
  font-weight: 600;
}

.logs-field input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.logs-btn {
  width: 50%;
  padding: 11px;
  font-size: 15px;
  text-align: center;
  border-radius: 6px;
}

/* Submit Trade Form Layout */
.trade-form {
  max-width: 900px;
  margin: 0 auto;
}

.trade-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 24px;
}

.trade-grid .field input,
.trade-grid .field select {
  width: 100%;
  max-width: 100%;
}

/* Center buttons */
.form-actions {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Smaller, cleaner inputs */
.field input,
.field select {
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 6px;
}

/* Mobile fallback */
@media (max-width: 768px) {
  .trade-grid {
    grid-template-columns: 1fr;
  }
}

/* Centered card with controlled width */
.card {
  max-width: 1100px;
  /* 👈 adjust this (800–1000px works best) */
  margin: 30px auto;
  /* center horizontally */
  padding: 30px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}



/* === Dashboard Stats === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  text-align: center;
  transition: transform 0.2s;
  border: 1px solid #e5e7eb;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 4px;
}

.stat-label {
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* Dashboard Actions */
.dashboard-actions {
  display: flex;
  justify-content: flex-start;
}

.dashboard-actions .action-card {
  text-align: left;
  padding: 25px;
  margin: 30px 0;
  /* Left align, remove auto centering */
  max-width: fit-content;
  /* Shrink card to fit content */
}

.dashboard-actions h3 {
  margin-top: 0;
  color: #1f2937;
  margin-bottom: 20px;
  font-size: 1.25rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
  /* Align buttons left */
}

.btn-group .btn {
  padding: 10px 20px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  /* Auto width based on text */
  min-width: auto;
  /* Remove minimum width constraints */
}

/* === Admin Layout === */
.admin-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  /* responsive wrap */
  max-width: 1400px;
  margin: 0 auto;
}

.create-user-card {
  width: 320px;
  /* Fixed width for sidebar */
  flex-shrink: 0;
  background-color: #f8fafc;
  /* slightly different bg to separate visually */
}

.users-list-card {
  flex: 1;
  /* Takes remaining space */
  min-width: 0;
  /* Prevents table overflow issues */
}

/* Responsive: Stack on smaller screens */
@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
  }

  .create-user-card,
  .users-list-card {
    width: 100%;
  }
}

/* Stack Form in Sidebar */
.stack-form .field {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.stack-form label {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
  color: #4b5563;
}

.stack-form input,
.stack-form select {
  padding: 8px 10px;
  font-size: 14px;
}

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

/* Role Badges */
.role-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.role-badge.staff {
  background-color: #dbeafe;
  color: #1e40af;
}

.role-badge.compliance {
  background-color: #fce7f3;
  color: #be185d;
}

.role-badge.advisor {
  background-color: #ffedd5;
  color: #c2410c;
}

.role-badge.admin {
  background-color: #f3f4f6;
  color: #1f2937;
  border: 1px solid #d1d5db;
}

/* Action buttons in table */
.action-buttons a,
.action-buttons button {
  text-decoration: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}


.action-buttons button {
  background: transparent;
}

/* === Compact Trade Form === */
.compact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.col-span-1 {
  grid-column: span 1;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-3 {
  grid-column: span 3;
}

.col-span-4 {
  grid-column: span 4;
}

@media (max-width: 900px) {
  .compact-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .col-span-1,
  .col-span-2 {
    grid-column: span 1;
  }

  .col-span-3,
  .col-span-4 {
    grid-column: span 2;
  }
}

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

  /* Grid items will naturally stack */
}