body {
  font-family: "Bookman Old Style", serif;
  margin: 0;
  background: #f7f7f7;
}

header {
  background: #0d4c85;
  color: white;
  padding: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

header img {
  height: 60px;
  margin: 0;
}

.left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.left img {
  height: 100px;
  margin: 0;
}

.left-text {
  display: flex;
  flex-direction: column;
  justify-content: center;

  line-height: 1.2;
}

.left-text h3,
.left-text h1 {
  margin: 0;
}

.left-text hr {
  margin: 4px 0;
  border: none;
  border-top: 1px solid white;
}

header .right {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 14px;
  text-align: center;
}

header .right img {
  height: 70px;
  margin-bottom: 10px;
}

main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  padding: 20px;
}

section {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  padding-bottom: 20px;
}

/* footer inside section */
.report-footer {
  margin-top: 60px;
  border-top: 1px solid #ddd;
  padding: 15px 0 0;
  text-align: center;
  font-size: 14px;
  color: #363636;
}

.report-footer .footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.report-footer .footer-logo {
  height: 45px;
  margin-left: 10px;
}

.side-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #f5f7fa;
  border-radius: 8px;
  border-style: dotted;
  border-color: #0056b3;
  background-color: #7aa8da4f;
  padding: 30px 30px 70px 30px;
}

.side-box h3 {
  margin: 20px 0 10px 0;
  color: #0d4c85;
}

.side-box .doc-icon {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-top: 20px;
  margin-bottom: 20px;
}

.side-box p {
  font-size: 15px;
  margin-bottom: 15px;
}

.side-box button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.side-box button:hover {
  background: #218838;
}

.side-box2 {
  margin-top: 20px;
  background: white;
  padding: 30px 30px 174px 30px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

h2 {
  margin-top: 0;
  color: #0d4c85;
}

.stats {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.stat {
  flex: 1;
  padding: 20px;
  text-align: center;
  border-radius: 8px;
  color: white;
  font-weight: bold;
}

.received {
  background: #28a745;
}

.released {
  background: #007bff;
}

.side-box button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.search-box {
  display: flex;
  margin-top: 15px;
}

.search-box input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 5px 0 0 5px;
}

.search-box button {
  background: #0056b3;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
}

.qr-scan {
  text-align: center;
  margin-top: 15px;
}

.login-btn {
  display: block;
  width: 100%;
  background: #28a745;
  color: white;
  border: none;
  padding: 15px;
  font-size: 18px;
  margin-top: 20px;
  border-radius: 8px;
  cursor: pointer;
}

.scan-btn {
  background: linear-gradient(135deg, #0d4c85, #1e6ebc);
  color: white;
  border: none;
  padding: 12px 25px;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

.scan-btn:hover {
  background: linear-gradient(135deg, #1e6ebc, #0d4c85);
  transform: scale(1.05);
}

/* Modal Overlay */
.modal,
.modal2 {
  display: none;
  /* hidden by default */
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  justify-content: center;
  align-items: center;
}

/* Modal Content */
.modal-content {
  background: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  overflow: hidden;
  animation: popIn 0.8s ease-out;
}

@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Close Button */
.close {
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
}

/* QR Reader Styling */
#reader {
  width: 100%;
  height: 300px;
  margin-top: 15px;
  overflow: hidden;
  position: relative;
  border-radius: 8px;
  /* optional */
}

#reader video,
#reader canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

/*modal sa form*/
.modal-content2 {
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: popIn 0.3s ease-out;
}

.close2 {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
}

.close2:hover {
  color: #000;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
}

.required {
  color: red;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.form-group textarea {
  height: 80px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-row .form-group {
  flex: 1;
}

.upload-area {
  border: 2px dashed #4caf50;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  background-color: #f9f9f9;
  cursor: pointer;
  transition: background-color 0.3s;
}

.upload-area:hover {
  background-color: #f0f0f0;
}

.upload-area .upload-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.btn-primary {
  background: #4caf50;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex: 1;
  font-size: 16px;
}

.btn-secondary {
  background: #2196f3;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex: 1;
  font-size: 16px;
}

.btn-primary:hover {
  background: #45a049;
}

.btn-secondary:hover {
  background: #1976d2;
}

.modal3 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content3 {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
}

.close2 {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}

#downloadQrBtn {
  display: inline-block;
  padding: 8px 15px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 5px;
}

#downloadQrBtn:hover {
  background: #0056b3;
}

#copyControlNumberBtn {
  background: none;
  border: 1px solid #ccc;
  color: #555;
  border-radius: 6px;
  padding: 3px 8px;
  margin-left: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.2s ease-in-out;
}

#copyControlNumberBtn:hover {
  background: #f4f4f4;
  border-color: #bbb;
}

#copyControlNumberBtn:active {
  background: #e0e0e0;
}

/* Full-screen overlay */
#loadingOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 999999;
  text-align: center;
  padding-top: 20%;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #f1f1f1;
}

.loader {
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top: 6px solid rgba(0, 117, 252, 0.938);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 15px;
  box-shadow: 0 0 10px rgba(0, 195, 255, 0.6);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#loadingOverlay p {
  font-size: 1.1rem;
  margin-top: 10px;
  color: #dcdcdc;
}

/*login*/
.login-trigger {
  padding: 8px 18px;
  background: linear-gradient(135deg, #007aff, #0056d6);
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}

.login-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 122, 255, 0.3);
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(10px);
  background: rgba(0, 0, 0, 0.3);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

/* Modal Box */
.modal-content4 {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 25px 30px;
  width: 300px;
  animation: slideUp 0.8s ease-out;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  text-align: center;
}

/* Title and subtitle */
.modal-content4 h2 {
  font-weight: 600;
  margin-bottom: 5px;
}

.subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

/* Close Button */
.close-btn4 {
  position: absolute;
  top: 15px;
  right: 18px;
  font-size: 20px;
  cursor: pointer;
  color: #555;
  transition: 0.2s;
}

.close-btn:hover {
  color: #000;
}

/* Inputs */
.modal-content4 input {
  width: 91%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  outline: none;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.6);
  transition: 0.2s;
}

.passtoggle {
  position: relative;
}

.passtoggle #togglePassword {
  position: absolute;
  right: 10px;
  top: 40%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.modal-content4 input:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* Login Button */
.login-btn4 {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #007aff, #0056d6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.login-btn4:hover {
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 4px solid rgba(255, 255, 255, 0.6);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-btn4:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.stats {
  display: flex;
  gap: 20px;
}

.stat h2 {
  font-size: 2rem;
  margin: 0;
  color: #ffffff;
}

.stat p {
  margin: 0;
  font-size: 1rem;
  color: #ffffff;
}

/* =========================
   Tracking Slip Modal
========================= */
.modal4 {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);

  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* Modal Container */
.Tracking-modal-content4 {
  background: #fff;
  width: 100%;
  max-width: 900px;              /* Fixed professional width */
  max-height: 95vh;
  padding: 16px;
  border-radius: 10px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Close Button */
.tracking-close-btn4 {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 22px;
  cursor: pointer;
  color: #333;
}

/* =========================
   Header
========================= */
.tracking-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #ddd;
}

.tracking-header .header-logo {
  width: 42px;
}

.tracking-header .header-text {
  flex: 1;
  text-align: center;
  font-size: clamp(0.65rem, 1vw, 0.75rem);
  color: #000;
}

.tracking-header h2 {
  margin: 0;
  font-size: clamp(0.85rem, 1.3vw, 1rem);
  font-weight: 700;
}

.tracking-header p {
  margin: 2px 0 0;
  font-size: clamp(0.65rem, 1vw, 0.75rem);
}
.tracking-info {
  margin-top: 8px;
  display: grid;
  gap: 4px ;
  font-size: clamp(0.65rem, 1vw, 0.75rem);
  color: #333;
}

.tracking-info p {
  margin: 0;
  line-height: 1.3;
}

.tracking-info strong {
  font-weight: 600;
}
/* =========================
   Table Wrapper (IMPORTANT)
========================= */
.tracking-table-wrapper {
  width: 100%;
  overflow-x: auto;               /* Mobile safety */
}

/* =========================
   Table
========================= */
.tracking-table {
  width: 100%;
  min-width: 700px;               /* Fixed table structure */
  border-collapse: collapse;
  margin-top: 10px;
  font-size: clamp(0.65rem, 1vw, 0.75rem);
}

.tracking-table th,
.tracking-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;               /* Compact & readable */
  text-align: center;
  white-space: nowrap;
}

.tracking-table th {
  background: #f2f2f2;
  font-weight: 600;
}

.tracking-table tr:nth-child(even) {
  background: #fafafa;
}

/* =========================
   Footer
========================= */
.tracking-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  font-size: clamp(0.65rem, 1vw, 0.75rem);
  color: #555;
}

.tracking-footer .footer-logo {
  width: 40px;
}

.tracking-footer .footer-text {
  margin-left: auto;      /* PUSHES IT TO THE RIGHT */
  text-align: right; 
  gap: 4px;  
  max-width: 60%;
}

.email-line,
.facebook-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.email-icon {
  width: 15px;
  height: 15px;
}
.facebook-icon {
  width: 20px;
  height: 20px;
}
/* =========================
   Print Optimization
========================= */
@media print {
  .tracking-close-btn4 {
    display: none;
  }

  .Tracking-modal-content4 {
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
}
@media (max-width: 600px) {
  .tracking-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .tracking-footer .footer-text {
    margin-left: 0;
    text-align: left;
    max-width: 100%;
  }
}

.status-received {
  background-color: #d4edda;
  /* light green */
  color: #155724;
  font-weight: bold;
  text-align: center;
  border-radius: 4px;
  padding: 4px;
}

.status-incoming {
  background-color: #fff3cd;
  /* yellowish */
  color: #856404;
  font-weight: bold;
  text-align: center;
  border-radius: 4px;
  padding: 4px;
}

.status-released {
  background-color: #f8d7da;
  color: #721c24;
  font-weight: bold;
  text-align: center;
  border-radius: 4px;
  padding: 4px;
}
.status-filed {
  background: #e0f7fa;
  color: #006064;
  font-weight: bold;
  text-align: center;
  border-radius: 4px;
  padding: 4px;
}

.upload-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

#selectedFileName {
  font-style: italic;
  color: #555;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons */
.btn-upload {
  padding: 10px 20px;
  background: #3498db;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-upload:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-upload-action {
  padding: 10px 20px;
  background: #2ecc71;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-upload-action:hover {
  background: #27ae60;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-upload-action:active {
  transform: translateY(1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.refresh-btn {
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.refresh-btn:hover {
  background: #e0e0e0;
  transform: rotate(20deg);
}

.refresh-btn:active {
  background: #d0d0d0;
  transform: rotate(0deg);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Animation */
@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.attached-files-list {
    margin-top: 10px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    padding: 8px;
}

.attached-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 14px;
}

.attached-file-item button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
}
.attachment-preview {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 12px 14px;
    border-radius: 8px;
    transition: 0.2s ease;
}

.attachment-item:hover {
    background-color: #f3f4f6;
}

.attachment-info {
    display: flex;
    flex-direction: column;
}

.attachment-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attachment-filename {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-top: 2px;
    word-break: break-word;
}

.attachment-remove-btn {
    background: none;
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #dc2626;
    cursor: pointer;
    transition: 0.2s ease;
}

.attachment-remove-btn:hover {
    background-color: #fee2e2;
    border-color: #dc2626;
}


/* Tablet (max-width: 900px) */
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
    /* stack sections */
    gap: 15px;
    padding: 15px;
  }

  header {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  header img {
    height: 50px;
  }

  .left img {
    height: 70px;
  }

  .side-box,
  .side-box2 {
    padding: 20px;
  }

  .stats {
    flex-direction: column;
    gap: 15px;
  }

  .stat {
    padding: 15px;
    font-size: 14px;
  }

  #reader {
    height: 250px;
  }
}

/* Mobile (max-width: 600px) */
@media (max-width: 600px) {
  header {
    padding: 15px;
  }

  .left {
    flex-direction: column;
    gap: 8px;
  }

  .left img {
    height: 60px;
  }

  .left-text h1 {
    font-size: 20px;
  }

  .left-text h3 {
    font-size: 14px;
  }

  .right {
    font-size: 12px;
  }

  section {
    padding: 20px;
    padding-bottom: 50px;
  }

  .side-box {
    padding: 20px 15px;
  }

  .side-box button,
  .login-btn,
  .scan-btn {
    width: 100%;
    /* full width buttons */
    font-size: 14px;
    padding: 12px;
  }

  .search-box {
    flex-direction: column;
  }

  .search-box input {
    border-radius: 5px;
    margin-bottom: 8px;
  }

  .search-box button {
    border-radius: 5px;
    width: 100%;
  }

  /* Forms */
  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .form-buttons {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    font-size: 14px;
    padding: 10px;
  }

  /* Modal */
  .modal-content2 {
    width: 95%;
    padding: 20px;
  }

  .modal-content4 {
    width: 90%;
  }

  .tracking-header h2 {
    font-size: 18px;
  }

  .tracking-table th,
  .tracking-table td {
    font-size: 10px;
    padding: 4px;
  }

  #reader {
    height: 200px;
  }
}

/* Extra small screens (max-width: 400px) */
@media (max-width: 400px) {
  header {
    padding: 10px;
  }

  .left img {
    height: 50px;
  }

  .side-box h3 {
    font-size: 16px;
  }

  .stat h2 {
    font-size: 1.4rem;
  }

  .stat p {
    font-size: 0.9rem;
  }

  #reader {
    height: 150px;
    /* very small screen optimization */
  }
}
