/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-brand);
  color: var(--color-asphalt-deep);
  transition: all 300ms ease;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: var(--border-visible);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.card-elevated {
  background: var(--bg-elevated);
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: var(--border-subtle);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: var(--border-visible);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-sol-rosa);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Search */
.search-input {
  padding-left: var(--space-2xl);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--space-md) center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.badge-positive {
  background: rgba(74, 124, 89, 0.2);
  color: var(--color-positive);
}

.badge-negative {
  background: rgba(139, 74, 74, 0.2);
  color: var(--color-negative);
}

.badge-brand {
  background: var(--gradient-brand-subtle);
  color: var(--color-sol-rosa);
}

/* Metric Display */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.metric-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.metric-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Loading Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg-elevated);
  border-top-color: var(--color-sol-rosa);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-sm);
}

.empty-state-description {
  font-size: var(--text-sm);
}

/* Data Source Attribution */
.data-source {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-md);
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

/* Session Expired Modal */
.session-expired-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: var(--space-3xl);
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.session-expired-content .modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.session-expired-content .modal-icon svg {
  color: var(--text-muted);
  opacity: 0.6;
}

.session-expired-content h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin: 0 0 var(--space-md);
  color: var(--text-primary);
}

.session-expired-content p {
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 0 0 var(--space-xl);
  color: var(--text-secondary);
}

.session-expired-content .btn {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-2xl);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

/* Generic Modal Content */
.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
  padding: var(--space-xl);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.modal-header h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--text-xl);
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-md);
  transform: translateX(100%);
  opacity: 0;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  background: var(--color-positive);
  color: var(--color-white);
}

.toast-error {
  background: var(--color-negative);
  color: var(--color-white);
}
