/* ===============================
   Loan Application Form + Slip (UPDATED)
   =============================== */

/* ===== Wrapper ===== */
.ala-wrapper {
  max-width: 520px;
  margin: 30px auto;
  padding: 24px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  font-family: Arial, sans-serif;
}

/* ===== Form ===== */
.ala-form .ala-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}

.ala-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #222;
  font-size: 14px;
}

/* Inputs & Selects */
.ala-form input[type="text"],
.ala-form input[type="tel"],
.ala-form input[type="file"],
.ala-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc !important;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box;
  transition: border 0.2s;
  background-color: #fff !important;   /* force white bg */
  color: #000 !important;              /* force black text */
  min-height: 40px !important;         /* visible height */
  display: block !important;
}

/* Placeholder text */
.ala-form input::placeholder,
.ala-form select::placeholder {
  color: #666 !important;
  opacity: 1 !important;
}

.ala-form input:focus,
.ala-form select:focus {
  border-color: #1976d2 !important;
  outline: none;
}

.ala-form input[readonly] {
  background: #f5f5f5 !important;
  color: #444 !important;
  cursor: not-allowed;
}

/* Buttons */
.ala-form button {
  width: 100%;
  padding: 12px;
  background: #1976d2;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.ala-form button:hover {
  background: #125ea4;
}

/* ===== Note ===== */
.ala-note {
  margin-top: 15px;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
  background: #f9f9f9;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #1976d2;
}

/* ===============================
   Popup Slip Styling (UPDATED - Responsive)
   =============================== */

/* ===== Overlay ===== */
.ala-slip-overlay {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); /* Darker background for better focus */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999999;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto; /* Allow body scroll if window is very small */
}

/* ===== Popup Box ===== */
.ala-slip-popup {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  /* FIX: Prevents 100vh overflow */
  max-height: 95vh; 
  overflow-y: auto; /* Enables scroll INSIDE the popup */
  font-family: Arial, Helvetica, sans-serif;
  position: relative;
  box-shadow: 0 15px 40px rgba(0,0,0,0.4);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 2px solid #1976d2;
  margin: auto; /* Center vertically when using flex */
}

/* ===== Close Button ===== */
.ala-slip-popup .ala-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  line-height: 32px;
  text-align: center;
  z-index: 10;
  transition: transform 0.2s, background 0.2s;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.ala-slip-popup .ala-close:hover {
  background: #c0392b;
  transform: scale(1.1);
}

/* ===== Header ===== */
.ala-slip-header {
  background: #388e3c;
  color: #fff;
  text-align: center;
  padding: 16px 10px;
  font-weight: bold;
  font-size: 18px;
  border-bottom: 2px solid #2e7d32;
  letter-spacing: 0.5px;
  border-radius: 10px 10px 0 0;
}

/* ===== Body Layout ===== */
.ala-slip-body {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

/* Sidebar (vertical text) */
.ala-slip-sidebar {
  background: #1976d2;
  color: #fff;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 14px 8px;
  font-weight: bold;
  font-size: 15px;
  text-align: center;
  letter-spacing: 2px;
}

/* ===== Table ===== */
.ala-slip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ala-slip-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
.ala-slip-table tr:last-child td {
  border-bottom: none;
}
.ala-slip-table td:first-child {
  font-weight: 600;
  color: #222;
  width: 45%;
}
.ala-slip-table td:last-child {
  font-weight: normal;
  color: #333;
}

/* ===== Status Badge ===== */
.ala-status {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
}
.ala-status.eligible { background: #388e3c; }      /* Green */
.ala-status.not-eligible { background: #c62828; }  /* Red */
.ala-status.pending { background: #f9a825; }       /* Yellow */

/* ===============================
   NEW: Account Details & Timer Styles (UPDATED)
   =============================== */

/* Account Details Row */
.account-details-row {
    background: #f4f6f9;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    margin: 0;
    font-size: 13px;
    border-left: 4px solid #1976d2; /* Left accent border */
}
.account-details-row h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
    text-align: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 5px;
    font-weight: 700;
}
.account-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    text-align: left;
    margin-bottom: 15px;
}
.account-details-grid div strong {
    display: block;
    color: #555;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.account-details-grid div span {
    color: #000;
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
}

/* Professional Timer Widget */
.ala-timer-widget {
    font-weight: bold;
    color: #f39c12; /* Default Yellow/Orange */
    text-align: center;
    padding: 12px;
    background: #2c3e50; /* Dark professional background */
    border: 1px solid #34495e;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace; /* Monospace for digits */
    font-size: 18px;
    letter-spacing: 2px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); /* Inset shadow for depth */
    margin-top: 10px;
}
.ala-timer-widget.approved {
    color: #2ecc71; /* Bright Green */
    background: #fff;
    border-color: #2ecc71;
    box-shadow: none;
}
/* ===============================
   End NEW Styles
   =============================== */

/* ===== Notice ===== */
.ala-slip-notice {
  background: #fff3cd;
  padding: 12px;
  font-size: 13px;
  border-top: 1px solid #ddd;
  color: #333;
  text-align: center;
  line-height: 1.5;
}
.ala-slip-notice span {
  color: #d35400;
  font-weight: bold;
}

/* ===== Footer ===== */
.ala-slip-footer {
  text-align: center;
  font-size: 11px;
  color: #555;
  padding: 8px;
  background: #f1f1f1;
  border-top: 1px solid #ddd;
  font-style: italic;
}

/* ===== Download Button ===== */
.ala-slip-download {
  text-align: center;
  padding: 14px;
  border-top: 1px solid #ddd;
}
.ala-slip-download button {
  background: #2e7d32;
  color: #fff;
  padding: 10px 26px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: 0.3s;
}
.ala-slip-download button:hover {
  background: #1b5e20;
}

/* ===== Animation ===== */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive (UPDATED) ===== */
@media screen and (max-width: 480px) {
  .ala-slip-overlay {
    padding: 10px; /* Less padding on small screens */
    align-items: flex-start; /* Start from top on very small screens */
  }
  
  .ala-slip-popup {
    max-height: 90vh;
    width: 100%;
    border-radius: 8px;
  }
  
  .ala-slip-body {
    flex-direction: column;
  }
  
  .ala-slip-sidebar {
    writing-mode: horizontal-tb;
    padding: 8px;
    font-size: 14px;
  }
  
  .ala-slip-table td {
    padding: 7px;
    font-size: 13px;
  }
  
  .account-details-grid {
    grid-template-columns: 1fr; /* Stack account details on mobile */
    gap: 8px;
  }
  
  .ala-timer-widget {
    font-size: 16px; /* Slightly smaller font */
    padding: 10px;
  }
}
/* Force visibility for Akhuwat Loan Form fields */
.ala-wrapper .ala-form label {
  color: #222 !important;       /* dark labels */
  font-weight: 600 !important;
  font-size: 14px !important;
  display: block !important;
}

.ala-wrapper .ala-form select option {
  background: #fff !important;  /* dropdown bg */
  color: #000 !important;       /* dropdown text */
}

.ala-wrapper .ala-form select {
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #444 !important;
}

.ala-wrapper .ala-form input,
.ala-wrapper .ala-form textarea {
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #444 !important;
}
/* Force loan form fields to display correctly */
.ala-form input,
.ala-form select,
.ala-form textarea,
.ala-form label {
  display: block !important;
  width: 100% !important;
  clear: both !important;
  margin-bottom: 15px !important;
  box-sizing: border-box !important;
  position: relative !important;
}

/* ===== Viewer Form Styling ===== */
.ala-viewer {
  max-width: 400px;
  margin: 30px auto;
  padding: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.ala-wrapper.ala-viewer label {
  display: block !important;
  font-weight: 600 !important;
  margin-bottom: 6px !important;
  font-size: 14px !important;
  color: #222 !important;
  text-transform: none !important;  /* prevent uppercase */
  letter-spacing: normal !important;
}


.ala-viewer select,
.ala-viewer input[type="text"],
.ala-viewer input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 15px;
  background: #fff;
  color: #000;
  box-sizing: border-box;
}

.ala-viewer button {
  width: 100%;
  padding: 12px;
  background: #1976d2;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.ala-viewer button:hover {
  background: #125ea4;
}
/* Force CNIC & ID input text visible */
.ala-viewer select,
.ala-viewer input[type="text"],
.ala-viewer input[type="number"] {
  width: 100% !important;
  padding: 10px 12px !important;
  border: 1px solid #ccc !important;
  border-radius: 6px !important;
  font-size: 15px !important;
  margin-bottom: 15px !important;
  background: #fff !important;
  color: #000 !important;
  box-sizing: border-box !important;
}

.ala-viewer input::placeholder {
  color: #666 !important;
  opacity: 1 !important;
}
/* Fix DataTables top bar text */
div.dataTables_wrapper div.dataTables_length label,
div.dataTables_wrapper div.dataTables_filter label {
    color: #000 !important;   /* black text */
    font-weight: 600;         /* make it bold for clarity */
}

/* Fix dropdown and search input text */
div.dataTables_wrapper select,
div.dataTables_wrapper input[type="search"] {
    color: #000 !important;   /* visible input text */
    background-color: #fff !important;
    border: 1px solid #ccc;   /* clean border */
    padding: 4px 6px;
    border-radius: 4px;
}
/* Fix DataTables entries dropdown width */
div.dataTables_wrapper .dataTables_length select {
    min-width: 70px !important;   /* enough for 10, 25, 50, 100 */
    padding: 4px 6px;
    text-align: center;           /* center numbers inside */
}
/* Make DataTables search bar prominent */
div.dataTables_wrapper div.dataTables_filter input[type="search"] {
    width: 250px !important;       /* bigger width */
    height: 40px !important;       /* taller box */
    font-size: 16px !important;    /* larger text */
    font-weight: 600;              /* bold text */
    color: #000 !important;        /* dark text */
    background-color: #fff !important;
    border: 2px solid #f1a200 !important;  /* highlight with theme color */
    border-radius: 6px;            /* rounded corners */
    padding: 6px 12px;             /* comfortable padding */
    box-shadow: 0 2px 6px rgba(0,0,0,0.1); /* subtle shadow */
}
/* Fix CNIC Search Input Visibility */
#cnic_search {
    color: #000 !important;
    background-color: #fff !important;
    border: 1px solid #ccc !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    font-weight: normal !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

#cnic_search::placeholder {
    color: #666 !important;
    opacity: 1 !important;
}

#cnic_search:focus {
    color: #000 !important;
    background-color: #fff !important;
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    outline: none !important;
}
/* Fix slip table styling for PDF generation */
.ala-slip-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 20px 0 !important;
}

.ala-slip-table td {
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 14px !important;
}

.ala-slip-table td:first-child {
    background: #f8f9fa !important;
    font-weight: bold !important;
    width: 40% !important;
}

.ala-slip-table tr:nth-child(even) td {
    background: #f8f9fa !important;
}