/* ========== Base / Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  margin: 30px;
  color: #222;
}

/* ========== Header (κοινό σελίδων) ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #007BFF;
  color: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.header h2 {
  margin: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1.2;
}

.logout-btn {
  color: #fff;
  background: #dc3545;
  padding: 8px 15px;
  text-decoration: none;
  border-radius: 4px;
  font-weight: bold;
}

.logout-btn:hover {
  background: #b52a37;
}

/* ========== Containers / Cards ========== */
.container {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  max-width: 1100px;
  margin: auto;
}

/* ========== Forms ========== */
form {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

input[type=file],
input[type=date],
input[type=text],
input[type=password],
button,
select {
  padding: 12px;
  margin: 6px 0;
  width: 100%;
  max-width: 460px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button {
  display: inline-block;
  width: auto;                /* όχι full width */
  min-width: 180px;
  max-width: 260px;
  padding: 10px 18px;
  background: #007BFF;
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.2s ease-in-out;
  margin-top: 6px;
}

button:hover {
  background: #0056b3;
}

/* ========== Tables (index) ========== */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  background: #007BFF;
  color: #fff;
  font-weight: 700;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.table-controls select {
  padding: 6px 10px;
  font-size: 14px;
}

.table-controls button.delete-page {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}

.table-controls button.delete-page:hover {
  background: #b52a37;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

/* ========== Alerts ========== */
.alert {
  padding: 10px 12px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.success {
  background: #d4edda;
  color: #155724;
}

.error {
  background: #f8d7da;
  color: #721c24;
}

/* ========== Drag & Drop (index) ========== */
#dropZone {
  border: 2px dashed #007BFF;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  background: #fafafa;
  cursor: pointer;
}

#dropZone.dragover {
  background: #e6f0ff;
  border-color: #0056b3;
}

#pdfInput {
  display: none;
}

#fileList {
  margin-top: 10px;
  font-size: 0.95em;
  color: #333;
}

#fileList ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#fileList li {
  background: #eef3ff;
  padding: 6px 10px;
  border-radius: 4px;
  margin: 4px 0;
}

/* ========== Delete icon ========== */
.delete-icon {
  color: #dc3545;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  font-size: 18px;
}

.delete-icon:hover {
  color: #b52a37;
}

/* ========== Verify page: embed + download button ========== */
.container embed {
  width: 100%;
  height: 70vh;               /* πιο φυσικό ύψος PDF */
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-top: 20px;
}

a.download {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 22px;
  background: #28a745;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 700;
  transition: background 0.2s ease-in-out;
}

a.download:hover {
  background: #1e7e34;
}

/* ========== Login page (responsive, centered) ========== */
.login-container {
  width: 100%;
  max-width: 720px;           /* πιο φαρδιά φόρμα για FHD κινητά */
  margin: 8vh auto;
  background: #fff;
  padding: 50px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.15);
  text-align: center;         /* Κεντράρει όλα τα περιεχόμενα */
}

.login-container h2 {
  margin-bottom: 25px;
  color: #007BFF;
  font-size: 26px;            /* Μεγαλύτερη γραμματοσειρά */
}

.login-container input {
  display: block;
  width: 80%;
  margin: 12px auto;
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 18px;
}

.login-container button {
  display: block;
  width: 84%;
  margin: 18px auto 0;
  padding: 16px;
  background: #007BFF;
  border: none;
  color: #fff;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.login-container button:hover {
  background: #0056b3;
}

/* ========== Responsive tweaks ========== */
@media (max-width: 992px) {
  .container { padding: 18px; }
  .header { flex-wrap: wrap; }
}

@media (max-width: 768px) {
  body { margin: 18px; }
  .header { padding: 12px 14px; border-radius: 8px; }
  .header h2 { font-size: 18px; }
  form, .container { padding: 16px; }
  input[type=text], input[type=password], input[type=date], input[type=file], select, button {
    max-width: 100%;
  }
  .login-container {
    max-width: 94%;
    padding: 36px;
  }
  .login-container h2 {
    font-size: 22px;
  }
  .login-container input,
  .login-container button {
    width: 100%;
    font-size: 17px;
  }
  .container embed {
    height: 65vh;
  }
}

@media (max-width: 480px) {
  body { margin: 12px; }
  .header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .login-container {
    max-width: 100%;
    padding: 28px 20px;
    margin: 6vh auto;
  }
  .login-container input,
  .login-container button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }
  .container embed {
    height: 60vh;
  }
}

/* ========== Fix for date fields (index page) ========== */
input[type=date] {
  width: auto;
  min-width: 200px;
  max-width: 240px;
  display: inline-block;
  margin-right: 8px;
  padding: 8px 10px;
  font-size: 15px;
}

/* === Θέση QR Code σε μία γραμμή === */
.qr-controls {
  display: flex;
  justify-content: center;   /* κέντρο οριζόντια */
  align-items: center;       /* στοίχιση κάθετα */
  flex-wrap: wrap;           /* επιτρέπει αλλαγή γραμμής σε μικρές οθόνες */
  gap: 10px;                 /* απόσταση ανάμεσα στα στοιχεία */
  margin: 20px 0;
}

.qr-controls label {
  font-weight: 600;
  color: #333;
  margin: 0 5px;
}

.qr-controls select {
  padding: 10px 12px;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: auto;
  min-width: 180px;
}

.qr-controls button {
  padding: 10px 16px;
  font-size: 15px;
  background: #007BFF;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease-in-out;
}

.qr-controls button:hover {
  background: #0056b3;
}

/* --- PROGRESS BAR --- */
.progress-container {
  width: 100%;
  background: #eee;
  border-radius: 6px;
  height: 26px;
  margin-top: 15px;
  position: relative;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: #007BFF;
  transition: width 0.3s ease;
}
.progress-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  color: #f1f1f1; /* πιο σκουρόχρωμο λευκό */
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6); /* σκιά για ευκρίνεια */
  font-weight: 700;
  line-height: 26px;
  font-size: 0.95em;
}

/* --- FILE PREVIEW --- */
#fileList ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
}
#fileList li {
  background: #eef3ff;
  border: 1px solid #d0d8ff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9em;
  color: #333;
  display: inline-block;
}

/* --- PAGINATION & TABLE CONTROLS --- */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 10px;
}

.pagination-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-right {
  display: flex;
  justify-content: flex-end;
}

.pagination-center button {
  padding: 6px 12px;
  background: #007BFF;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.pagination-center button:hover { background: #0056b3; }

#deletePage {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}
#deletePage:hover { background: #b52a37; }

#rowsPerPage {
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 4px;
}

/* --- SORTABLE TABLE HEADERS --- */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

th.sortable:hover {
  background: #0056b3;
}

th.sortable .sort-arrow {
  font-size: 12px;
  margin-left: 5px;
  opacity: 0.3;
  display: inline-block;
}

/* --- SEARCH INPUT --- */
#searchInput {
  width: 100%;
  max-width: 500px;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 15px;
}

#searchInput:focus {
  outline: none;
  border-color: #007BFF;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}
