@import url('../utilities.css');

.historico-page {
  height: 100%;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.historico-header {
  width: 100%;
  text-align: center;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.historico-header h1 {
  color: var(--primary-color);
  font-size: 2.5rem;
}

.historico-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  width: 100%;
}

/* Main Sections */
.historico-price-section,
.historico-chart-section,
.historico-stats-section {
  background: var(--primary-color-light);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid var(--primary-color-dark);
  border-radius: 15px;
  padding: 2rem;
  width: 100%;
}

/* Price Section */
.historico-price-display {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.historico-price-card {
  padding: 1.2rem;
  text-align: center;
  color: var(--primary-color);
  background: var(--primary-color-light);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.historico-price-card-main {
  grid-column: span 1;
  color: var(--text-color);
  background: var(--primary-color-medium);
}

.historico-price-card h3 {
  margin-bottom: 0.5rem;
  font-size: clamp(1rem, 1.5vw, 1rem);
  opacity: 0.8;
}

.historico-price-card h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 600;
}

.historico-price-card-main h2 {
  font-size: clamp(1.8rem, 3vw, 2rem);
  font-weight: 700;
}

/* Form Controls */
.historico-search-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.historico-search-buttons-group {
  display: flex;
  flex-direction: row;
  width: 100%;
  justify-content: center;
}

.historico-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.historico-input-group label {
  font-weight: 500;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.historico-input-group select,
.historico-input-group input {
  width: 100%;
  padding: 1rem;
  background: var(--primary-color-light);
  border: 1px solid var(--primary-color-dark);
  color: white;
  border-radius: 10px;
  font-size: 1.1rem;
}

.historico-form-control {
  padding: 1rem;
  background: var(--primary-color-light);
  border: 1px solid var(--primary-color-dark);
  color: white;
  border-radius: 10px;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.historico-form-control:hover:not(:disabled) {
  background: var(--primary-color-focus);
  border-color: var(--primary-color-medium);
}

.historico-form-control:focus {
  outline: none;
  background: var(--primary-color-focus);
  border-color: var(--primary-color);
}

.historico-form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.historico-form-label {
  font-weight: 500;
  color: var(--primary-color);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.historico-btn-primary,
.historico-btn-secondary {
  width: 100%;
  background: var(--primary-color);
  color: var(--bg-color);
  border: 1px solid var(--primary-color-dark);
  padding: 1rem;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: bold;
}

.historico-btn-primary:hover:not(:disabled),
.historico-btn-secondary:hover:not(:disabled) {
  background: var(--primary-color-hover);
  transform: translateY(-1px);
}

.historico-btn-primary:disabled,
.historico-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.historico-btn-secondary {
  background: hsla(97, 50%, 87%, 0.2);
  color: white;
  font-weight: 400;
}

.historico-btn-secondary:hover:not(:disabled) {
  background: hsla(97, 50%, 87%, 0.25);
}

/* Use in calculator button width animation */
#useInCalculator {
  display: block;
  width: 0;
  height: 56px;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: all;
}

#useInCalculator.show {
  margin-left: 0.5rem;
  width: 33%;
  opacity: 1;
  pointer-events: auto;
  padding: 1rem;
  border-width: 1px;
}

/* Chart Section */
.historico-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.historico-chart-header h2 {
  color: var(--primary-color);
  font-size: 1.5rem;
}

.historico-chart-controls {
  display: flex;
  gap: 0.5rem;
}

.historico-btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

.historico-btn-icon:hover {
  transform: scale(1.1);
  color: white;
}

#chart {
  height: 300px;
  width: 100%;
  background: var(--primary-color-light);
  border-radius: 10px;
  padding: 1rem;
}

/* Stats Section */
.historico-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.historico-stats-title {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.historico-stat-card {
  padding: 1.5rem;
  text-align: center;
  background: var(--primary-color-light);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.historico-stat-card:hover {
  background: var(--primary-color-focus);
}

.historico-stat-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--primary-color);
  opacity: 0.8;
}

.historico-stat-card p {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

/* Back button now inherits from .back-button in style.css */

.hidden {
  display: none;
}

/* Date input styling */
input[type='date'] {
  color-scheme: dark;
}

input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

@media (max-width: 768px) {
  .historico-page {
    padding: 1rem;
    gap: 1.5rem;
  }

  .historico-price-section,
  .historico-chart-section,
  .historico-stats-section {
    padding: 1.5rem;
  }

  .historico-price-display {
    grid-template-columns: 1fr;
  }

  .historico-price-card {
    padding: 1rem;
  }

  .historico-header h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  .historico-price-card h2 {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
  }

  .historico-price-card-main {
    grid-column: span 1;
  }

  .historico-price-card-main h2 {
    font-size: clamp(1.5rem, 5vw, 1.8rem);
  }
}

/* Additional styles from calculadora.css */
.historico-input-group {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  position: relative;
  width: 100%;
}

.historico-input-group-wrapper {
  position: relative;
  flex: 1;
  min-width: 0; /* Prevent flex item from overflowing */
}

.historico-form-control-numeric {
  text-align: right;
}

.historico-currency-symbol {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color-medium-light);
  font-size: 1.5rem;
  pointer-events: none;
  z-index: 1;
}

.historico-form-control-select {
  font-size: 1.2rem;
  padding: 0.8rem 1rem;
  padding-right: 3rem;
}

.historico-form-control-select option {
  background-color: var(--bg-color);
  color: white;
}

.historico-form-control::placeholder {
  color: var(--primary-color-medium-light);
}

.historico-form-control:empty {
  background: var(--primary-color-light);
}

.historico-conversion-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.historico-price-type-selector {
  display: flex;
  flex-direction: row;
  background: var(--primary-color-light);
  border: 1px solid var(--primary-color-dark);
  border-radius: 10px;
  overflow: hidden;
}

.historico-price-type-selector.standalone {
  max-width: 400px;
  margin: 0 auto;
}

.historico-price-type-option {
  padding: 0.8rem 1.5rem;
  margin: 0;
  font-size: 1rem;
  text-align: center;
  transition: all 0.2s ease;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color-medium-light);
  cursor: pointer;
  border-right: 1px solid var(--primary-color-dark);
  user-select: none;
}

.historico-price-type-option:last-child {
  border-right: none;
}

.historico-price-type-option:hover {
  background: var(--primary-color-focus);
  color: white;
}

.historico-price-type-option-active {
  background: var(--primary-color-focus);
  color: white;
  font-weight: 500;
}

.historico-conversion-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.historico-arrow-symbol {
  font-size: 2rem;
  color: var(--primary-color-medium-light);
  transition: transform 0.3s ease;
}

.historico-arrow-symbol-left {
  transform: rotate(180deg);
}
