/* --- Estilos Minimalistas y Elegantes --- */

/* Paleta de colores:
  - Fondo: #f8f9fa (gris muy claro)
  - Texto principal: #212529 (casi negro)
  - Bordes/Divisores: #dee2e6 (gris claro)
  - Primario: #007bff (azul)
  - Secundario: #6c757d (gris medio)
*/

/* Estilos generales y tipografías */
body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background-color: #f8f9fa;
  color: #212529;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 800px;
  margin: 30px auto;
  padding: 25px 30px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: #212529;
}

h2 {
  font-size: 22px;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 12px;
  margin-top: 0;
  margin-bottom: 25px;
}

h3 {
  font-size: 18px;
}

.section {
  margin-bottom: 40px;
}

/* Formularios */
.form-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: center;
}

label {
  font-weight: 600;
  text-align: right;
  color: #495057;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
}
input:focus, select:focus, textarea:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
input:disabled {
  background-color: #e9ecef;
  cursor: not-allowed;
}

button {
  background-color: #343a40;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  margin-right: 10px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #212529;
}

.btn-secondary, button[type="reset"], button#btnTestTicket, #btnExport {
  background-color: #6c757d;
}
.btn-secondary:hover, button[type="reset"]:hover, button#btnTestTicket:hover, #btnExport:hover {
  background-color: #5a6268;
}

.btn-danger {
  background-color: #dc3545;
}
.btn-danger:hover {
  background-color: #c82333;
}

.btn-icon {
  padding: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon .material-icons-outlined {
  font-size: 20px;
}

.form-actions {
  grid-column-start: 2;
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
.form-actions button {
  margin-right: 0;
  margin-left: 10px;
}

/* Tabla */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}

#tblMoves, #tblClients, #tblUsers {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

#tblMoves th, #tblMoves td,
#tblClients th, #tblClients td,
#tblUsers th, #tblUsers td {
  border-bottom: 1px solid #dee2e6;
  padding: 12px 15px;
  text-align: left;
  white-space: nowrap;
}
#tblMoves td:last-child, #tblMoves th:last-child,
#tblClients td:last-child, #tblClients th:last-child,
#tblUsers td:last-child, #tblUsers th:last-child {
  text-align: center;
}

#tblMoves th, #tblClients th, #tblUsers th {
  background-color: #f8f9fa;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  border-bottom-width: 2px;
}

#tblMoves tbody tr:last-child td,
#tblClients tbody tr:last-child td,
#tblUsers tbody tr:last-child td {
  border-bottom: none;
}

.action-btn {
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
  padding: 5px;
  font-size: 13px;
  text-decoration: none;
}
.action-btn:hover {
  text-decoration: underline;
}
button.action-btn {
  color: #dc3545;
}

/* Estilos del Ticket */
.ticket {
  width: 58mm;
  max-width: 58mm;
  background: #fff;
  color: #000;
  padding: 10px;
  box-sizing: border-box;
  font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  border: 1px solid #ccc; /* Visible en pantalla, no en impresión */
}
.t-logo {
  display: block;
  margin: 0 auto 8px auto;
  max-width: 75%;
  height: auto;
}
.t-center { text-align: center; }
.t-bold { font-weight: bold; }
.t-tagline { font-size: 11px; margin-bottom: 6px; }
.t-small { font-size: 10px; }
.t-divider { border-top: 1px dashed #000; margin: 8px 0; }
.t-row { display: flex; justify-content: space-between; }
.t-footer { margin-top: 10px; }

.t-qr-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #000;
  text-align: center;
}
#qr-canvas {
  margin: 5px auto;
  display: block;
}


/***** MODO IMPRESIÓN *****/
@media print {
  body {
    background: #fff;
    color: #000;
    margin: 0;
  }
  
  .no-print, .container, .main-footer-credits {
    display: none !important;
  }

  #printArea {
    display: block !important;
  }
  
  @page {
    size: 58mm auto;
    margin: 1cm 0;
  }
  
  .ticket {
    border: none;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
}

/* --- Estilos de Pestañas --- */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid #dee2e6;
}

.header-logo {
  height: 50px;
  width: auto;
  margin-right: 2rem;
}

.tabs {
  display: flex;
  flex-grow: 1;
}

.tab-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-link:hover {
  color: #343a40;
}

.tab-link.active {
  color: #343a40;
  border-bottom-color: #343a40;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Dashboard Styles */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  text-align: center;
}

.stat-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #555;
  font-weight: 500;
}

.stat-card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  color: #343a40;
}

.dashboard-chart {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  position: relative;
  height: 300px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.appointment-item {
  background-color: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appointment-item a {
  text-decoration: none;
  color: #343a40;
  font-weight: 600;
}
.appointment-item a:hover {
  color: #0056b3;
}

.appointment-item .date {
  color: #6c757d;
  font-size: 14px;
}

/* --- Estilos específicos de Clientes --- */
.form-grid-single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-grid-single label {
  text-align: left;
  margin-bottom: -5px; /* Acercar la etiqueta al campo */
}
.form-grid-single input[type="tel"] {
  max-width: 250px;
}
.form-grid-single .checkbox-container {
  margin-top: 10px;
}
.form-grid-single .checkbox-container label {
  font-weight: 400; /* Peso normal para checkboxes */
}
.form-actions-single {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.checkbox-container {
  display: flex;
  align-items: center;
}
.checkbox-container input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.hidden {
  display: none !important;
}

#m-subtipo-container {
  /* Esto asegura que el contenedor del subtipo se alinee correctamente en el grid */
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: center;
}

.client-history-row td {
  padding: 0 !important;
  background-color: #f8f9fa;
}
.client-history-content {
  padding: 15px;
}
.client-history-content h4 {
  margin-top: 0;
  font-family: 'Montserrat', sans-serif;
}
.client-history-content table {
  width: 100%;
  border-collapse: collapse;
}
.client-history-content th, .client-history-content td {
  padding: 8px;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
}
.client-history-content th {
  text-align: left;
  font-weight: 600;
}

/* --- Estilos de Configuración --- */
.data-location-info {
  background-color: #e9ecef;
  padding: 15px;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1.5;
}
.data-location-info strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.sub-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}
.sub-section h3 {
  margin-top: 0;
}

/* --- Estilos del Pie de Página --- */
.main-footer-credits {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
  color: #6c757d;
  font-size: 12px;
}

.main-footer-credits p {
  margin: 0 0 5px 0;
}
