/* GLOBAL SYSTEM STYLES */
:root {
  --primary-red: #E31B23;
  --primary-red-hover: #C11219;
  --primary-gold: #D4AF37;
  --primary-gold-dark: #B89320;
  --bg-color: #F8FAF9;
  --system-font: 'Book Antiqua', Palatino, 'Palatino Linotype', Georgia, serif;

  /* Card Display Metrics */
  --id-width: 270px;
  --id-height: 418px;

  --bc-width: 420px;
  --bc-height: 272px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--system-font);
}

body {
  background-color: var(--bg-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.brand-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 15px;
}

/* VIEW 1: LOGIN */
#view-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  padding: 40px 30px;
  border-radius: 16px;
  border-top: 5px solid var(--primary-gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  margin-top: 30px;
  text-align: center;
}

.brand-title-main {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-red);
  text-align: center;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.login-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 25px;
  font-style: italic;
}

.login-form-group {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 18px;
  width: 100%;
}

.login-form-group label {
  width: 100px;
  text-align: right;
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.login-input {
  flex: 1;
  padding: 10px 18px;
  border: 2px solid var(--primary-red);
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
}

.btn-red-pill {
  background-color: var(--primary-red);
  color: #ffffff;
  padding: 12px 36px;
  border: 2px solid var(--primary-gold);
  border-radius: 25px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.btn-red-pill:hover {
  background-color: var(--primary-red-hover);
}

#login-error-msg {
  display: none;
  color: var(--primary-red);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 15px;
}

/* VIEW 2: WELCOME HUB */
#view-welcome {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 650px;
  background: #ffffff;
  padding: 40px;
  border: 2px dashed var(--primary-red);
  border-radius: 24px;
  text-align: center;
  margin-top: 40px;
}

.welcome-header {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-red);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.welcome-subtitle {
  font-style: italic;
  color: var(--primary-gold-dark);
  margin-bottom: 25px;
}

.selection-buttons {
  display: flex;
  gap: 15px;
  width: 100%;
  justify-content: center;
  margin-top: 15px;
}

.btn-hub-option {
  flex: 1;
  background-color: var(--primary-red);
  color: #ffffff;
  padding: 14px 20px;
  border: 2px solid var(--primary-gold);
  border-radius: 25px;
  font-weight: 700;
  cursor: pointer;
}

/* VIEW 3: MAIN WORKSPACE */
#view-app {
  display: none;
  width: 100%;
  max-width: 1280px;
  flex-direction: column;
  align-items: center;
}

.nav-tabs-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 12px 24px;
  border-radius: 12px;
  border-bottom: 3px solid var(--primary-gold);
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.nav-tabs-group {
  display: flex;
  gap: 10px;
}

.nav-tab {
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  background: #f0f0f0;
  color: #555;
  border: 1px solid #ddd;
}

.nav-tab.active {
  background: var(--primary-red);
  color: #ffffff;
  border-color: var(--primary-gold);
}

.app-workspace {
  display: flex;
  gap: 32px;
  width: 100%;
  justify-content: center;
  align-items: flex-start;
}

/* FORM SIDEBAR */
.form-container {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  border-top: 4px solid var(--primary-red);
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--primary-red);
}

.form-group input, .form-group select {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.action-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-action {
  flex: 1;
  background-color: var(--primary-red);
  color: #ffffff;
  padding: 10px;
  border: 2px solid var(--primary-gold);
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
}

.btn-secondary {
  flex: 1;
  background-color: #333333;
  color: #ffffff;
  padding: 10px;
  border: 2px solid #555;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
}

#status-message {
  display: none;
  padding: 10px;
  background-color: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* PREVIEW BOARD (Enforced White Preview Workspace) */
.cards-preview-workspace {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #ffffff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.cards-preview {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.card-title {
  font-weight: bold;
  font-size: 0.85rem;
  color: var(--primary-red);
}

.card-frame {
  border: 1.5px solid #111111;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

/* ID CARD METRICS */
.id-card-front {
  width: var(--id-width);
  height: var(--id-height);
  background: url('cardfront.png') no-repeat center/cover;
}

.id-card-back {
  width: var(--id-width);
  height: var(--id-height);
  background: url('idback.png') no-repeat center/cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 35px;
}

.photo-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 135px;
  height: 135px;
  border-radius: 50%;
  border: 4px solid var(--primary-red);
  overflow: hidden;
  background-color: #eee;
}

.photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.id-front-details {
  position: absolute;
  bottom: 55px;
  width: 100%;
  text-align: center;
  padding: 0 8px;
}

.id-user-name {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #000000;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.id-user-number {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: var(--primary-red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.id-back-qr-box {
  width: 90px;
  height: 90px;
  background: #fff;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.id-back-qr-box img {
  width: 100% !important;
  height: 100% !important;
}

.id-back-text {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 8.5px;
  text-align: center;
  color: #333;
  padding: 0 15px;
  line-height: 1.3;
  font-weight: 600;
}

/* BUSINESS CARD METRICS */
.bc-card-front {
  width: var(--bc-width);
  height: var(--bc-height);
  background: url('Bcardfront.png') no-repeat center/cover;
}

.bc-card-back {
  width: var(--bc-width);
  height: var(--bc-height);
  background: url('Bcardback.png') no-repeat center/cover;
}

.bc-details-overlay {
  position: absolute;
  top: 25%;
  right: 25px;
  width: 55%;
  text-align: left;
}

.bc-user-name {
  font-size: 16px;
  color: #000000;
  font-weight: bold;
  margin-bottom: 4px;
}

.bc-user-title {
  font-size: 11px;
  color: #333333;
}

/* LETTERHEAD & FOOTER CONTROLS */
#letterhead-workspace {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 20px;
  align-items: center;
  width: 100%;
  max-width: 850px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: #ddd;
  margin: 0 4px;
}

.toolbar-group button, .toolbar-group select, .toolbar-group input {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.lh-page-container {
  width: 210mm;
  min-height: 297mm;
  max-height: 297mm;
  background: url('letterback.png') no-repeat center/cover;
  background-size: 100% 100%;
  padding: 40mm 20mm 25mm 20mm;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  position: relative;
  background-color: #ffffff;
  overflow: hidden;
}

.lh-content {
  height: 215mm;
  max-height: 215mm;
  outline: none;
  font-size: 12pt;
  line-height: 1.5;
  overflow-y: auto;
}

.page-footer {
  position: absolute;
  top: 15mm;
  right: 20mm;
  font-size: 10pt;
  color: var(--primary-gold);
  font-style: italic;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: bold;
}

/* Print Control Media Queries */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  body, html {
    width: 210mm;
    height: 297mm;
    background: #ffffff !important;
  }
  body * {
    visibility: hidden;
  }
  
  /* Print Letterhead */
  #letterhead-document, #letterhead-document * {
    visibility: visible;
  }
  #letterhead-document {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 40mm 20mm 25mm 20mm !important;
    overflow: hidden !important;
  }

  /* Print Active Cards */
  #id-card-preview-panel.printable-active,
  #id-card-preview-panel.printable-active *,
  #bc-card-preview-panel.printable-active,
  #bc-card-preview-panel.printable-active * {
    visibility: visible;
  }
  
  #id-card-preview-panel.printable-active,
  #bc-card-preview-panel.printable-active {
    position: absolute;
    left: 50%;
    top: 50mm;
    transform: translateX(-50%);
    display: flex !important;
    flex-direction: row !important;
    gap: 20px;
    background: transparent !important;
    box-shadow: none !important;
  }
}