/* Font loading */
@font-face {
  font-family: 'Open Sans';
  src: url('tipografias/OpenSans-VariableFont_wdth,wght.ttf') format('truetype');
  font-weight: 1 999;
  font-stretch: 75% 100%;
  font-style: normal;
}

/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Open Sans', sans-serif;
}

body {
  background-image: url('img/bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #333;
  position: relative;
}

.login-page {
  justify-content: center;
  align-items: center;
  padding-bottom: 50px;
}

/* Glassmorphism style */
.glass {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  padding: 20px;
}

.login-container {
  width: 400px;
  max-width: 90%;
  margin: auto;
}

body.login-page .login-container {
  margin: 0;
  display: flex;
  flex-direction: column;
}

body.login-page .login-container .logo {
  margin: 0 auto 28px;
}

body.login-page .login-container h2 {
  text-align: center;
  margin: 0 0 24px;
}

.panel-section {
  width: 95%;
  max-width: 1600px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin: auto;
  margin-bottom: 40px;
  min-height: auto;
  margin-top: 10px;
  padding-top: 0;
  padding-bottom: 40px;
  flex: 1;
}

/* Asegura que cualquier sección que siga a los botones quede pegada con margen limpio */
.panel-section + .panel-section {
  margin-top: 16px;
  padding-top: 0;
}

/* Espaciado consistente: los botones separados del header y las cajas separadas de los botones */
.nav-section {
  margin-top: 24px;   /* separación respecto del header */
  margin-bottom: 0;
}

.content-section {
  margin-top: 24px;   /* misma separación por debajo de los botones */
}

.panel-item {
  padding: 20px;
  margin-bottom: 20px;
}

/* Dashboard box width classes */
.box-size-1 {
  flex: 0 1 calc(25% - 15px);
  min-width: 220px;
  max-width: calc(25% - 15px);
}

.box-size-2 {
  flex: 0 1 calc(50% - 15px);
  min-width: 440px;
  max-width: calc(50% - 15px);
}

.box-size-3 {
  flex: 0 1 calc(75% - 15px);
  min-width: 660px;
  max-width: calc(75% - 15px);
}

.box-size-4 {
  flex: 0 1 100%;
  min-width: 100%;
  max-width: 100%;
}

@media (max-width: 768px) {
  .box-size-1, .box-size-2, .box-size-3 {
    flex: 0 1 calc(50% - 15px);
    max-width: calc(50% - 15px);
    min-width: 300px;
  }
  
  .box-size-4 {
    flex: 0 1 100%;
    max-width: 100%;
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .box-size-1, .box-size-2, .box-size-3, .box-size-4 {
    flex: 0 1 100%;
    max-width: 100%;
    min-width: 100%;
  }
}

/* Header styles - YA NO ES FIJO */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 20px 2.5%;
  position: relative; /* Cambiado de fixed a relative */
  top: auto;
  left: auto;
  z-index: auto;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
  width: 164px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  text-align: center;
}

.logo img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* Contenedor para los botones de navegación */
.nav-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Estilos para los botones del header */
.nav-btn, .logout-btn {
  background: rgba(128, 128, 128, 0.8); /* Color gris */
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  text-decoration: none;
  color: white;
  font-size: 14px;
}

.nav-btn:hover, .logout-btn:hover {
  background: rgba(128, 128, 128, 1);
  transform: translateY(-1px);
}

/* Botón activo */
.nav-btn.active {
  background: #16194f;
}

.nav-btn.active:hover {
  background: #132382;
}

h2 {
  margin-bottom: 15px;
  color: #333;
  font-weight: 600;
}

p {
  margin-bottom: 10px;
  line-height: 1.5;
  font-size: 14px;
  font-weight: 400;
}

footer {
  width: 100%;
  text-align: center;
  padding: 20px 0;
  position: relative; 
  bottom: auto;
  color: rgba(255, 255, 255, 0.8);
  margin-top: auto;
}

/* Login form styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  color: #333;
  font-family: 'Open Sans', sans-serif;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.3);
}

/* Numeric input specific styles */
.form-group input[style*="width: 12.5ch"] {
  width: 12.5ch !important;
  min-width: 12.5ch;
  max-width: 12.5ch;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: #3f734d;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.submit-btn:hover {
  background: #014a3f;
}

/* Error message styles */
.error-message {
  color: #f44336;
  margin-bottom: 15px;
  background: rgba(244, 67, 54, 0.1);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Success message styles */
.success-message {
  color: #4CAF50;
  margin-bottom: 15px;
  background: rgba(76, 175, 80, 0.1);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid rgba(76, 175, 80, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .panel-item {
    flex: 1 1 calc(50% - 20px);
  }
  
  .nav-buttons {
    gap: 5px;
  }
  
  .nav-btn, .logout-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .container {
    margin: 10px;
    padding: 15px;
  }
  
  .top-scores-table {
    font-size: 12px;
  }
  
  .top-scores-table th,
  .top-scores-table td {
    padding: 8px 4px;
  }
  
  .form-group {
    margin-bottom: 15px;
  }
  
  .form-group label {
    margin-bottom: 5px;
  }
  
  /* En móvil, las tolerancias vuelven al layout original */
  form[method="post"] div[style*="grid-template-columns: repeat(6, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .panel-item {
    flex: 1 1 100%;
  }
  
  .panel-section {
    margin-top: 20px;
    margin-bottom: 60px;
  }
  
  header {
    flex-direction: column;
    gap: 15px;
    padding: 15px 5%;
  }
  
  .nav-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* GRAFICO DE SCORE Y FECHAS */
.top-scores-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Open Sans', sans-serif;
    color: rgb(50, 50, 50);
    font-size: 10px;
    font-weight: 400;
}

.top-scores-table th, .top-scores-table td {
    border: 1px solid rgb(80, 80, 80);
    padding: 5px;
    text-align: left;
}

.top-scores-table th {
    background-color: rgba(50, 50, 50, 0.2);
    font-weight: bold;
}

.top-scores-table tr:nth-child(even) {
    background-color: rgba(50, 50, 50, 0.1);
}

/* Download page styles */
.download-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

.main-panel, .info-panel {
    /* Reusing existing .glass styles with additional properties */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    padding: 30px;
    margin-bottom: 20px;
}

.info-panel {
    padding: 20px;
    margin-top: 20px;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.table-card {
    /* Similar to .glass but with specific properties for cards */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    padding: 20px;
    transition: all 0.3s ease;
}

.table-card:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
    transform: translateY(-3px);
}

.table-card h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.2em;
    font-weight: 600;
}

.table-info {
    color: #555;
    font-size: 0.9em;
    margin-bottom: 15px;
    font-weight: 400;
}

.download-btn {
    /* Using existing nav-btn active colors */
    background: #16194f;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
}

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

.fields-list {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    font-size: 0.8em;
}

.field-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(3px);
    padding: 3px 8px;
    margin: 2px;
    border-radius: 5px;
    font-size: 0.75em;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
}

.page-header h1 {
    color: #333;
    margin: 0;
    font-weight: 600;
}

.page-header p {
    color: #555;
    margin: 10px 0 0 0;
    font-weight: 400;
}

.info-panel h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.info-panel ul {
    color: #555;
    margin: 0;
    padding-left: 20px;
}

.info-panel li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Alert styles enhancement */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.alert-danger {
    color: #721c24;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Responsive adjustments for download page */
@media (max-width: 768px) {
    .table-grid {
        grid-template-columns: 1fr;
    }
    
    .download-container {
        margin: 10px;
        padding: 10px;
    }
    
    .main-panel, .info-panel {
        padding: 20px;
    }
}

/* ===== VARIABLES BLANDAS - SLIDERS ===== */

.variables-container {
    max-width: 900px;
    margin: 0 auto;
}

.client-selector {
    margin-bottom: 30px;
}

.save-button-container {
    margin-top: 40px;
    text-align: center;
    padding: 20px;
}

.save-btn {
    background: #16194f;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.save-btn:hover {
    background: #132382;
    transform: translateY(-2px);
}

.save-btn:active {
    transform: translateY(0);
}

.variable-item {
    margin-bottom: 40px;
    padding: 25px;
}

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

.variable-title {
    flex: 0 0 auto;
    min-width: 200px;
}

.variable-title h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-weight: 600;
    font-size: 1.1em;
}

.variable-description {
    flex: 1;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
    font-style: italic;
}

.slider-container {
    position: relative;
    padding: 20px 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 0;
    width: 70%;
    margin-left: auto;
    margin-right: auto;
}

.slider-label {
    font-size: 0.7em;
    color: #555;
    font-weight: 500;
    text-align: center;
    flex: 0 0 auto;
    width: 0;
    position: relative;
}

.slider-wrapper {
    position: relative;
    height: 50px;
    display: flex;
    align-items: center;
    width: 70%;
    margin-left: auto;
    margin-right: auto;
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, 
        #95a5a6 0%, 
        #95a5a6 33%, 
        #f39c12 33%, 
        #f39c12 66%, 
        #e74c3c 66%, 
        #e74c3c 100%);
    border-radius: 2px;
}

.slider-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: transparent;
    outline: none;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(145deg, #b8b8b8, #888888);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 
                inset 0 -2px 4px rgba(0, 0, 0, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(145deg, #b8b8b8, #888888);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 
                inset 0 -2px 4px rgba(0, 0, 0, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-input::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.slider-marks {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    padding: 0 2px;
}

.slider-mark {
    width: 2px;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1px;
}

.current-value {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    color: #333;
    font-weight: 600;
}

/* Responsive adjustments for sliders */
@media (max-width: 768px) {
    .variable-header {
        flex-direction: column;
        gap: 10px;
    }

    .variable-title {
        min-width: 100%;
    }

    .slider-labels {
        font-size: 0.65em;
        width: 100%;
    }
    
    .slider-wrapper {
        width: 100%;
    }

    .variable-item {
        padding: 20px;
        margin-bottom: 30px;
    }
}