/* FromInvest AG Portal Styling */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-color: #f04023;
  --dark-bg: #0b0f19;
  --dark-sidebar: #0b0f19;
  --sidebar-hover: #1e293b;
  --light-bg: #f8fafc;
  --border-color: #e2e8f0;
  --text-dark: #0f172a;
  --text-light: #64748b;
  --text-white: #ffffff;
  --success-color: #10b981;
  --success-bg: #dcfce7;
  --success-text: #15803d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--light-bg);
  color: var(--text-dark);
  min-height: 100vh;
}

/* --- LOGIN PAGE STYLES --- */
.login-body {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(240, 64, 35, 0.05) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 100vh;
}

.auth-container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header {
  padding: 40px 40px 10px;
  text-align: center;
}

.login-logo {
  margin-bottom: 25px;
  max-width: 200px;
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid #f1f5f9;
  margin-bottom: 25px;
}

.tab-btn {
  flex: 1;
  padding: 15px;
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
}

.tab-btn.active {
  color: var(--primary-color);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
}

.auth-body {
  padding: 0 40px 40px;
}

.form-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.form-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 15px;
  color: var(--text-dark);
  transition: all 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-submit:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.error-msg, .success-msg {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  display: none;
}

.error-msg {
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.success-msg {
  color: var(--success-text);
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 25px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.back-link:hover {
  color: var(--primary-color);
}

.row-group {
  display: flex;
  gap: 15px;
}

.row-group .form-group {
  flex: 1;
}

/* --- DASHBOARD LAYOUT --- */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--dark-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.sidebar-brand {
  padding: 30px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  color: #3b82f6;
  font-weight: 500;
}

.sidebar-menu {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  transition: all 0.2s;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.menu-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.menu-item:hover {
  background-color: var(--sidebar-hover);
  color: var(--text-white);
}

.menu-item.active {
  background-color: var(--primary-color);
  color: var(--text-white);
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-profile-name {
  font-weight: 700;
  font-size: 14px;
}

.user-profile-email {
  font-size: 12px;
  color: #64748b;
  word-break: break-all;
}

.btn-logout-sidebar {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fca5a5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  width: 100%;
  text-align: left;
  transition: color 0.2s;
}

.btn-logout-sidebar:hover {
  color: #f87171;
}

.btn-logout-sidebar svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.content-header {
  padding: 40px 40px 20px;
}

.content-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.content-subtitle {
  font-size: 15px;
  color: var(--text-light);
}

.content-body {
  padding: 0 40px 40px;
  flex: 1;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Personal Data Block */
.profile-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border-color);
  margin-bottom: 30px;
}

.profile-card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--text-dark);
}

.profile-card-title svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary-color);
  stroke-width: 2;
  fill: none;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-field-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.profile-field-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

/* Bank Investment Card */
.investment-card {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}

.investment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.04);
  border-color: #cbd5e1;
}

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

.bank-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bank-icon-box {
  width: 48px;
  height: 48px;
  background-color: var(--dark-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.bank-icon-box svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.bank-name-wrap {
  display: flex;
  flex-direction: column;
}

.bank-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.bank-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background-color: var(--success-bg);
  color: var(--success-text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: currentColor;
  border-radius: 50%;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.grid-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.grid-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: rgba(37, 99, 235, 0.08);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.grid-icon-box.green {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--success-color);
}

.grid-icon-box svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.grid-text-wrap {
  display: flex;
  flex-direction: column;
}

.grid-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.grid-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.card-footer-row {
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
}

/* Empty State */
.empty-portfolio {
  background: white;
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  border: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-text {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 16px;
}

/* --- BANK CERTIFICATE PAGE (DETAIL) --- */
.cert-container {
  max-width: 900px;
  margin: 40px auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  overflow: hidden;
  padding: 40px;
}

.cert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #002e6c;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.cert-bank-logo {
  height: 50px;
  display: flex;
  align-items: center;
}

.cert-bank-logo img {
  height: 100%;
  max-width: 220px;
  object-fit: contain;
}

.cert-bank-logo-placeholder {
  font-size: 24px;
  font-weight: 800;
  color: #002e6c;
}

.cert-title-wrap {
  text-align: center;
}

.cert-title {
  font-size: 28px;
  font-weight: 700;
  color: #002e6c;
  margin: 10px 0;
}

.cert-user-info-box {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  background-color: #fafbfc;
  min-width: 250px;
}

.cert-user-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cert-user-row:last-child {
  margin-bottom: 0;
}

.cert-user-label {
  color: var(--text-light);
  font-weight: 500;
}

.cert-user-value {
  font-weight: 700;
  color: var(--text-dark);
}

/* Certificate Data Grid */
.cert-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 30px;
  margin-bottom: 30px;
}

.cert-left-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.cert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.cert-row:last-child {
  border-bottom: none;
}

.cert-item-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

.cert-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
}

.cert-item-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.cert-item-value {
  font-weight: 800;
  font-size: 16px;
  color: var(--text-dark);
}

.cert-right-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cert-date-box {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.cert-date-icon {
  color: #002e6c;
  margin-top: 2px;
}

.cert-date-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.cert-date-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cert-date-label {
  font-size: 12px;
  font-weight: 700;
  color: #002e6c;
  text-transform: uppercase;
}

.cert-date-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.cert-date-sub {
  font-size: 11px;
  color: var(--text-light);
}

/* Result Table */
.cert-table-wrap {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 30px;
}

.cert-table-header {
  background-color: #002e6c;
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
}

.cert-table-row {
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.cert-table-row:last-child {
  border-bottom: none;
}

.cert-table-row.total-row {
  background-color: #e6f0fa;
  font-weight: 800;
  font-size: 16px;
}

.cert-info-bar {
  background-color: #fff7ed;
  border: 1px solid #ffedd5;
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 30px;
}

.cert-info-icon {
  color: #f97316;
  flex-shrink: 0;
  margin-top: 2px;
}

.cert-info-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.cert-info-text {
  font-size: 13px;
  color: #c2410c;
  line-height: 1.5;
  font-weight: 600;
}

.cert-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.btn-cert {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-cert.back {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}

.btn-cert.back:hover {
  background: #f1f5f9;
}

.btn-cert.print {
  background: #002e6c;
  border: 1px solid #002e6c;
  color: white;
}

.btn-cert.print:hover {
  background: #001f4d;
}

/* --- ADMIN PANEL STYLES --- */
.admin-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.admin-sidebar {
  width: 320px;
  background-color: #1e293b;
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #0f172a;
}

.admin-sidebar-header {
  padding: 24px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.admin-sidebar-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: #3b82f6;
  margin-bottom: 4px;
}

.admin-sidebar-header p {
  font-size: 12px;
  color: #64748b;
}

.admin-user-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-user-item {
  padding: 14px 16px;
  border-radius: 8px;
  background: #334155;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.admin-user-item:hover {
  background: #475569;
}

.admin-user-item.active {
  background: var(--primary-color);
  border-color: #3b82f6;
}

.admin-user-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.admin-user-email {
  font-size: 12px;
  color: #cbd5e1;
}

.admin-user-item.active .admin-user-email {
  color: #bfdbfe;
}

.admin-main {
  flex: 1;
  background-color: #f1f5f9;
  padding: 40px;
  overflow-y: auto;
}

.admin-empty-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 18px;
  font-weight: 600;
}

.admin-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.admin-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.btn-admin {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-admin.primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-admin.primary:hover {
  background-color: var(--primary-hover);
}

.btn-admin.danger {
  background-color: #ef4444;
  color: white;
}

.btn-admin.danger:hover {
  background-color: #dc2626;
}

.btn-admin.warning {
  background-color: #f59e0b;
  color: #0f172a;
}

.btn-admin.warning:hover {
  background-color: #d97706;
}

.admin-portfolio-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
}

/* Loading Overlay for Verification Check */
#authOverlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: #0f172a;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: white;
  gap: 16px;
}

#authOverlay h2 {
  color: #ef4444;
  font-weight: 800;
}

/* Print Overrides */
@media print {
  body {
    background-color: white;
  }
  .cert-container {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .cert-actions, .btn-cert {
    display: none !important;
  }
}

/* Responsiveness */
@media (max-width: 992px) {
  .dashboard-wrapper {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
  }
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
  }
  .menu-item {
    white-space: nowrap;
    padding: 10px 14px;
  }
  .main-content {
    height: auto;
    overflow-y: visible;
  }
  .content-header, .content-body {
    padding-left: 20px;
    padding-right: 20px;
  }
  .cert-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .style-mobile-padding {
    padding-left: 15px !important;
    margin-top: 20px;
    border-top: 1px solid #f1f5f9;
    padding-top: 20px;
  }
  #statsCardLeftPart {
    border-right: none !important;
    padding-right: 15px !important;
  }
}
