/* ==========================================================================
   Base Styles & Layout
   ========================================================================== */

html,
body {
  font-family: "Inter", sans-serif;
  font-optical-sizing: auto;
  background: #dad6c9;
}

/* Layout Components */
.navbar,
.sidebar,
.stage,
.entrance_panel {
  background: #efeeeb;
  border-radius: 12px;
}

.navbar {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
}

.sidebar {
  position: absolute;
  top: 84px;
  left: 8px;
  right: auto;
  bottom: 8px;
  width: 240px;
  padding: 12px;
}

.sidebar .copyright {
  margin: 12px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
}

.sidebar .dropdown,
.sidebar .dropdown-toggle {
  width: 100%;
}

.sidebar .dropdown-toggle:hover {
  color: #000;
}

.stage {
  position: fixed;
  top: 84px;
  right: 8px;
  left: auto;
  bottom: 8px;
  width: calc(100% - 265px);
  padding: 30px;
  overflow-y: auto;
}

.stage.full {
  left: 8px;
  width: auto;
  box-sizing: border-box;
}

/* ==========================================================================
   Alert & Messages
   ========================================================================== */

.alert-debug {
  color: black;
  background-color: white;
  border-color: #d6e9c6;
}

.alert-error {
  color: #b94a48;
  background-color: #f2dede;
  border-color: #eed3d7;
}

.messages {
  margin-bottom: 20px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary {
  background: #f3311d;
  color: #fff;
  border-color: #f3311d;
  opacity: 1;
  transform: scale(1);
}

.btn-primary:hover {
  background: #d92915;
  opacity: 0.8;
  transform: scale(1.04);
}

.btn-secondary {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.btn-success {
  background: #0f5132;
  color: #fff;
}

.btn-success:hover {
  background: #0a3622;
}

.btn-danger {
  background: #842029;
  color: #fff;
}

.btn-danger:hover {
  background: #6c1823;
}

.action-section .btn.btn-primary {
  font-size: 22px;
  padding: 16px 42px;
  border-radius: 30px;
}

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

.btn-start {
  display: inline-block;
  padding: 20px 50px;
  background: #f3311d;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
  transition: .2s ease all;
}

.btn-start:hover {
  opacity: .8;
  transform: scale(1.04);
  color: #fff;
}

.btn-retrieve {
  background: #6c757d;
  color: #fff;
  padding: 12px 30px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s ease all;
}

.btn-retrieve:hover {
  background: #5a6268;
}

.btn-continue {
  background: #28a745;
  color: #fff;
  padding: 8px 20px;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: .2s ease all;
}

.btn-continue:hover {
  background: #218838;
  color: #fff;
}

.btn-view {
  padding: 6px 16px;
  background: #f3311d;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
  transition: all 0.2s;
}

.btn-view:hover {
  background: #d92915;
  transform: translateY(-1px);
}

.btn-new {
  display: inline-block;
  padding: 12px 24px;
  background: #f3311d;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-new:hover {
  background: #d92915;
  transform: translateY(-1px);
}

.btn-filter {
  padding: 10px 20px;
  background: #f3311d;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-filter:hover {
  background: #d92915;
}

.btn-clear {
  padding: 10px 20px;
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-clear:hover {
  background: #f5f5f5;
}

/* ==========================================================================
   Links
   ========================================================================== */

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: #f3311d;
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

.save-draft {
  color: #666;
  text-decoration: none;
  font-size: 14px;
}

.save-draft:hover {
  color: #f3311d;
  text-decoration: underline;
}

/* ==========================================================================
   Loan Landing Pages
   ========================================================================== */

.loan-landing {
  max-width: 800px;
  margin: 0 auto;
  padding: 0px 20px;
}

.loan-landing h1 {
  text-align: center;
  margin-bottom: 20px;
  color: #333;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.loan-landing .subtitle {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #666;
  margin-bottom: 20px;
}

.loan-info {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
}

.loan-info h2 {
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 22px;
  margin-bottom: 15px;
  color: #333;
}

.loan-info p {
  font-size: 14px;
  line-height: 1.4;
  color: #555;
  margin-bottom: 15px;
}

.loan-info ul {
  margin: 15px 0;
  padding-left: 20px;
}

.loan-info ul li {
  margin-bottom: 8px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.action-section {
  text-align: center;
  margin: 40px 0;
}

.highlight-box {
  background: #fff3cd;
  border-left: 4px solid #856404;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
}

.highlight-box strong {
  color: #856404;
}

/* ==========================================================================
   Retrieval & Draft Applications
   ========================================================================== */

.retrieval-section {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 30px;
  margin-top: 40px;
}

.retrieval-section h3 {
  font-size: 20px;
  margin-bottom: 15px;
  color: #333;
}

.retrieval-section p {
  color: #666;
  margin-bottom: 20px;
}

.retrieval-form .form-group {
  margin-bottom: 15px;
}

.retrieval-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
}

.retrieval-form input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.draft-applications {
  margin-top: 30px;
}

.draft-applications h4 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #333;
}

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

.draft-list li {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.draft-info {
  flex-grow: 1;
}

.draft-info strong {
  display: block;
  margin-bottom: 5px;
  color: #333;
}

.draft-info small {
  color: #666;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress-bar {
  display: flex;
  flex-direction: row !important;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding: 0 20px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
}

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 60%;
  width: 80%;
  height: 2px;
  background: #ddd;
  z-index: -1;
}

.progress-step.completed::after {
  background: #f3311d;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #999;
  margin-bottom: 8px;
}

.step-circle.active {
  background: #f3311d;
  border-color: #f3311d;
  color: #fff;
}

.step-circle.completed {
  background: #f3311d;
  border-color: #f3311d;
  color: #fff;
}

.step-label {
  font-size: 14px;
  color: #999;
  text-align: center;
}

.step-label.active {
  color: #333;
  font-weight: 600;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.step-content {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.step-content h1 {
  margin: 0 0 10px;
  color: #333;
  font-size: 28px;
}

.step-description {
  color: #666;
  margin: 0 0 30px;
  font-size: 16px;
}

.form-section {
  margin-bottom: 30px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

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

.form-group label,
label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

.required {
  color: #f3311d;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #f3311d;
}

.form-group textarea,
textarea {
  min-height: 100px;
  resize: vertical;
}

.helper-text {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.form-check {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.form-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
}

.form-check label {
  margin: 0;
  cursor: pointer;
  font-weight: 400;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #eee;
  margin-top: 40px;
}

.form-actions > div {
  display: flex;
  gap: 12px;
}

.errorlist {
  list-style: none;
  padding: 0;
  margin: 5px 0 0;
}

.errorlist li {
  color: #f3311d;
  font-size: 12px;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: #f3311d;
}

.error-message {
  color: #b94a48;
  font-size: 13px;
  margin-top: 5px;
  display: none;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.loan-type-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.loan-type-badge.marketing {
  background: #e3f2fd;
  color: #1976d2;
}

.loan-type-badge.renovation {
  background: #f3e5f5;
  color: #7b1fa2;
}

.loan-type-badge.deposit {
  background: #e8f5e9;
  color: #388e3c;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.draft {
  background: #e0e0e0;
  color: #666;
}

.status-badge.submitted {
  background: #fff3cd;
  color: #856404;
}

.status-badge.under_review {
  background: #cfe2ff;
  color: #084298;
}

.status-badge.approved {
  background: #d1e7dd;
  color: #0f5132;
}

.status-badge.rejected {
  background: #f8d7da;
  color: #842029;
}

.status-badge.withdrawn {
  background: #e0e0e0;
  color: #666;
}

/* ==========================================================================
   Applications Lists
   ========================================================================== */

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

.applications-header h1 {
  margin: 0;
  color: #333;
}

.filter-section {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  gap: 15px;
  align-items: end;
}

.filter-group {
  flex: 1;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

.filter-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.filter-actions {
  display: flex;
  gap: 10px;
}

.loan-type-section {
  margin-bottom: 40px;
}

.loan-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.loan-type-header h2 {
  margin: 0;
  color: #333;
  font-size: 22px;
}

.applications-table {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.applications-table table {
  width: 100%;
  border-collapse: collapse;
}

.applications-table thead {
  background: #f8f9fa;
}

.applications-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #333;
  font-size: 14px;
  border-bottom: 2px solid #e0e0e0;
}

.applications-table td {
  padding: 15px;
  color: #666;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
}

.applications-table tr:hover {
  background: #f8f9fa;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 10px;
  color: #666;
}

.empty-state p {
  margin: 0 0 20px;
  color: #999;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.summary-card-value {
  font-size: 32px;
  font-weight: 700;
  color: #f3311d;
  margin-bottom: 5px;
}

.summary-card-label {
  font-size: 14px;
  color: #666;
}

.results-count {
  padding: 15px 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  color: #666;
  font-size: 14px;
}

.results-count strong {
  color: #333;
}

/* ==========================================================================
   Application Detail
   ========================================================================== */

.application-header {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

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

.header-info h1 {
  margin: 0 0 10px;
  color: #333;
  font-size: 28px;
}

.header-info .reference {
  color: #666;
  font-size: 14px;
}

.header-info .reference strong {
  color: #333;
}

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

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.meta-value {
  font-size: 16px;
  color: #333;
  font-weight: 600;
}

.detail-section {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.detail-section h2 {
  margin: 0 0 20px;
  color: #333;
  font-size: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

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

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 13px;
  color: #666;
  margin-bottom: 5px;
  font-weight: 600;
}

.detail-value {
  font-size: 15px;
  color: #333;
}

.detail-value.empty {
  color: #999;
  font-style: italic;
}

.detail-value.large {
  font-size: 24px;
  font-weight: 700;
  color: #f3311d;
}

.detail-full {
  grid-column: 1 / -1;
}

.detail-full .detail-value {
  line-height: 1.6;
  white-space: pre-wrap;
}

.boolean-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.boolean-value.true {
  color: #0f5132;
}

.boolean-value.false {
  color: #666;
}

.boolean-value::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.boolean-value.true::before {
  background: #0f5132;
}

.boolean-value.false::before {
  background: #999;
}

.actions-section {
  background: #fff;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  gap: 15px;
  justify-content: space-between;
}

.actions-left,
.actions-right {
  display: flex;
  gap: 10px;
}

.notes-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

.notes-section h3 {
  margin: 0 0 15px;
  color: #333;
  font-size: 16px;
}

.notes-section textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  resize: vertical;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

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

  .progress-bar {
    padding: 0;
    overflow-x: auto;
  }

  .step-label {
    font-size: 11px;
  }

  .step-content {
    padding: 20px;
  }

  .form-actions {
    flex-direction: column;
    gap: 12px;
  }

  .form-actions > div {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .applications-table {
    overflow-x: auto;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-actions {
    width: 100%;
  }

  .btn-filter,
  .btn-clear {
    flex: 1;
  }

  .applications-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .header-row {
    flex-direction: column;
    gap: 15px;
  }

  .actions-section {
    flex-direction: column;
  }

  .actions-left,
  .actions-right {
    width: 100%;
    flex-direction: column;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}


table small {
  color: #999;
}


.card {
  background: #efeeeb;
  border-color: #dad6c9;
}


.card .card-header {
  border-color: #dad6c9;
}

.card .list-group .list-group-item {
  background: #efeeeb;
}

.card .list-group .list-group-item:hover {
  background: #787878;
  color: #fff;
}
