@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --primary-color: #007bff;
  --primary-hover-color: #0056b3;
  --secondary-color: #6c757d;
  --dark-color: #212529;
  --light-color: #f8f9fa;
  --white-color: #ffffff;
  --text-color: #495057;
  --border-color: #dee2e6;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --font-family: "Inter", sans-serif;
  --hue: 210;
  --input-bg-dark: #3a3a3f;
}

html.dark-mode {
  --primary-color: #0d8eff;
  --primary-hover-color: #0076d1;
  --secondary-color: #a0a7b0;
  --dark-color: #f0f2f5;
  --light-color: #2a2a2e;
  --white-color: #1f1f22;
  --text-color: #c9ced3;
  --border-color: #4a4a4f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--white-color);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.page-wrapper,
.content-wrapper {
  padding-top: 100px;
  padding-bottom: 60px;
  background-color: var(--white-color);
}

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 5px;
  text-decoration: none;
  color: #ffffff;
  font-weight: 600;
  transition:
    background-color 0.3s ease,
    transform 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-color);
}
.btn-primary:hover {
  background-color: var(--primary-hover-color);
  transform: translateY(-2px);
}

.page-title {
  font-size: 2.5rem;
  color: var(--dark-color);
  text-align: center;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 3rem;
  color: var(--secondary-color);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.plan-selection-container {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.plan-card {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  width: 100%;
  max-width: 280px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  background-color: var(--white-color);
}

.plan-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.plan-card.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 15px hsla(var(--hue), 100%, 50%, 0.3);
  transform: translateY(-5px);
}

html.dark-mode .plan-card.active {
  box-shadow: 0 0 15px hsla(var(--hue), 100%, 50%, 0.5);
}

.plan-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.plan-card h4 {
  font-size: 1.4rem;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

.plan-description {
  font-size: 0.9rem;
  min-height: 40px;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.plan-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-color);
}

.search-box-page {
  display: flex;
  max-width: 700px;
  margin: 0 auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.search-box-page input {
  flex-grow: 1;
  border: none;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-family: var(--font-family);
  background-color: var(--white-color);
  color: var(--text-color);
}
.search-box-page input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.search-box-page button {
  background: var(--primary-color);
  border: none;
  color: #ffffff;
  padding: 0 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background-color 0.3s ease;
  font-family: var(--font-family);
}

.search-box-page button:hover {
  background: var(--primary-hover-color);
}

.search-box-page button i {
  margin-left: 8px;
}

.history-section {
  margin-top: 4rem;
}

.history-section h2 {
  font-size: 1.8rem;
  color: var(--dark-color);
  margin-bottom: 2rem;
  text-align: center;
}

.table-container {
  overflow-x: auto;
  background: var(--white-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th,
.history-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  max-width: 50ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-table thead {
  background-color: var(--light-color);
}

.history-table th {
  font-weight: 600;
  color: var(--dark-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.history-table tbody tr:hover {
  background-color: var(--light-color);
}

.status {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-completed {
  background-color: #d4edda;
  color: #155724;
}

.status-pending {
  background-color: #fff3cd;
  color: #856404;
}

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

html.dark-mode .status-completed {
  background-color: #1c4b27;
  color: #a3e6b3;
}
html.dark-mode .status-pending {
  background-color: #4d442a;
  color: #fde083;
}
html.dark-mode .status-error {
  background-color: #582c30;
  color: #f5c6cb;
}

.btn-view {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}
.btn-view:hover {
  text-decoration: underline;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.page-header h1 {
  font-size: 2rem;
  color: var(--dark-color);
  margin: 0;
}

.page-header p {
  margin: 5px 0 0 0;
  color: var(--secondary-color);
  font-size: 1rem;
}

.plan-badge {
  background-color: var(--primary-color);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: capitalize;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background-color: #1d976c;
  color: var(--white-color);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition:
    background-color 0.3s ease,
    transform 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-export:hover {
  background-color: #167a56;
  transform: translateY(-2px);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.col-full {
  width: 100%;
}

.col-main {
  flex: 2;
  min-width: 0;
}

.col-side {
  flex: 1;
  min-width: 0;
}

.panel {
  background: var(--white-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

html.dark-mode .panel {
  background: var(--light-color);
}

.panel h3 {
  font-size: 1.2rem;
  color: var(--dark-color);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
}

.title-icon {
  color: var(--primary-color);
  margin-right: 10px;
  font-size: 1.1rem;
}

.panel hr {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin-bottom: 1.25rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.form-row:last-child {
  margin-bottom: 0;
}

.coolinput {
  position: relative;
  flex-grow: 1;
  min-width: 150px;
}

.coolinput .text {
  font-size: 0.75rem;
  color: var(--secondary-color);
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--white-color);
  padding: 0 5px;
  transition: 0.2s ease-in-out;
  font-weight: 600;
  z-index: 1;
}

html.dark-mode .coolinput .text {
  background: var(--light-color);
}

.coolinput .input {
  padding: 1rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 100%;
  background-color: var(--light-color);
  color: var(--dark-color);
  font-family: var(--font-family);
}

html.dark-mode .coolinput .input {
  background-color: var(--input-bg-dark);
}

.coolinput .input:disabled {
  cursor: text;
  background-color: var(--light-color);
}

html.dark-mode .coolinput .input:disabled {
  background-color: var(--input-bg-dark);
}

.w-full {
  width: 100%;
}
.w-50 {
  width: calc(50% - 0.625rem);
}
.w-33 {
  width: calc(33.333% - 0.833rem);
}
.w-25 {
  width: calc(25% - 0.9375rem);
}

.placeholder-box {
  background-color: var(--light-color);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  color: var(--secondary-color);
}

.placeholder-box p {
  margin: 0;
}

.loader {
  border: 5px solid var(--border-color);
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  display: flex;
  gap: 15px;
  align-items: center;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

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

.btn-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--secondary-color);
  padding: 5px;
  line-height: 1;
}

.btn-action:hover {
  color: var(--primary-color);
}

.btn-remove:hover {
  color: #dc3545;
}

.status-card {
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border-color);
  background-color: var(--white-color);
  box-shadow: var(--shadow);
}

html.dark-mode .status-card {
  background-color: var(--light-color);
}

.status-card .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.status-card .icon.active {
  color: #28a745;
}

.status-card .icon.inactive {
  color: #dc3545;
}

.status-card h4 {
  font-size: 1.5rem;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

.status-card p {
  color: var(--secondary-color);
}

.theme-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background-color: var(--light-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

html.dark-mode .theme-switcher {
  background-color: var(--white-color);
}

.theme-switcher label {
  font-weight: 600;
  color: var(--dark-color);
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.panel-item,
.party-card,
.decision-content {
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 10px;
  background-color: var(--white-color);
}

html.dark-mode .panel-item,
html.dark-mode .party-card,
html.dark-mode .decision-content {
  background-color: var(--input-bg-dark);
}

.panel-item p,
.party-card p,
.decision-content p {
  margin: 5px 0;
}

.panel-item:last-child,
.party-card:last-child {
  margin-bottom: 0;
}

.party-name {
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--dark-color);
}

.party-doc,
.party-rep {
  font-size: 0.9rem;
  color: var(--secondary-color);
}

.decision-timeline {
  position: relative;
  padding-left: 30px;
}

.decision-timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 2px;
  background-color: var(--border-color);
}

.decision-item {
  position: relative;
  margin-bottom: 25px;
}

.decision-item:last-child {
  margin-bottom: 0;
}

.decision-date {
  position: relative;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--dark-color);
  margin-bottom: 10px;
}

.decision-date::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--primary-color);
  box-shadow: 0 0 0 3px hsla(var(--hue), 70%, 55%, 0.25);
}

.decision-text {
  white-space: pre-line;
  color: var(--text-color);
}

.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.store-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  background-color: var(--light-color);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.store-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.store-name {
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 8px;
}

.store-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #28a745;
  margin-bottom: 8px;
}

.store-info {
  font-size: 0.85rem;
  color: var(--secondary-color);
  margin-bottom: 12px;
}

.store-link {
  display: inline-block;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.store-link:hover {
  text-decoration: underline;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.summary-item {
  text-align: center;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--white-color);
}

html.dark-mode .summary-item {
  background-color: var(--light-color);
}

.summary-item .label {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-bottom: 8px;
  display: block;
}

.summary-item .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark-color);
}

.value-critical {
  color: #dc3545;
}
.value-high {
  color: #fd7e14;
}
.value-medium {
  color: #ffc107;
}
.value-low {
  color: #28a745;
}

.grade-a,
.grade-a-plus {
  color: #28a745;
}
.grade-b {
  color: #17a2b8;
}
.grade-c {
  color: #ffc107;
}
.grade-d {
  color: #fd7e14;
}
.grade-f {
  color: #dc3545;
}

.result-section {
  margin-bottom: 20px;
}
.result-section h4 {
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 5px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.result-list {
  list-style: none;
  padding: 0;
}
.result-list li {
  background: var(--light-color);
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary-color);
}

html.dark-mode .result-list li {
  background: var(--input-bg-dark);
}

.result-list li strong {
  color: var(--dark-color);
}

.table-responsive {
  overflow-x: auto;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
}
.result-table th,
.result-table td {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
  font-size: 0.9rem;
  max-width: 50ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-table th {
  background-color: var(--light-color);
  font-weight: 600;
  color: var(--dark-color);
}

html.dark-mode .result-table th {
  background-color: var(--input-bg-dark);
}

.info-tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-left: auto;
}

.info-tooltip .tooltip-text {
  visibility: hidden;
  width: 220px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  margin-left: -110px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
}

.info-tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.info-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 1279px) {
  .content-wrapper {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .col-main {
    flex-basis: 60%;
  }
  .col-side {
    flex-basis: 35%;
  }
}

@media (max-width: 768px) {
  .page-wrapper,
  .content-wrapper {
    padding-top: 80px;
  }
  .page-title {
    font-size: 2rem;
  }
  .page-subtitle {
    font-size: 1rem;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .col-main,
  .col-side {
    flex-basis: 100%;
    width: 100%;
  }
  .form-row {
    flex-direction: column;
    gap: 1.25rem;
  }
  .w-50,
  .w-33,
  .w-25 {
    width: 100%;
  }
  .search-box-page {
    flex-direction: column;
  }
  .search-box-page input {
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
  }
  .search-box-page button {
    border-radius: 0 0 8px 8px;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  .content-wrapper {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .page-title {
    font-size: 1.8rem;
  }
  .page-subtitle {
    font-size: 0.9rem;
    margin-bottom: 2rem;
  }
  .plan-selection-container {
    gap: 1rem;
  }
  .plan-card {
    padding: 1.25rem;
  }
  .history-section h2 {
    font-size: 1.5rem;
  }
  .history-table th,
  .history-table td {
    padding: 0.75rem 1rem;
  }
  .panel {
    padding: 1.25rem;
  }
}
