/* Interactive Governance Components Styles */

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--border-radius);
  color: white;
  font-weight: 500;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
}

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

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

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

.toast-warning {
  background-color: var(--warning-color);
}

.toast-info {
  background-color: var(--primary-color);
}

/* User Interface */
.user-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.user-address {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary-color);
}

.user-balance {
  color: var(--text-secondary);
  font-size: 0.9rem;
}



/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #475569;
}

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

.btn-success:hover:not(:disabled) {
  background-color: #16a34a;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn:disabled,
.btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.form-error {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-help {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Proposal Submission Form */
.proposal-form {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
}

.proposal-form h3 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.file-upload {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.file-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-upload-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  transition: border-color 0.2s;
}

.file-upload:hover .file-upload-label {
  border-color: var(--primary-color);
}

/* Voting Interface */
.voting-section {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
}

.vote-options {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.vote-option {
  flex: 1;
}

.vote-radio {
  display: none;
}

.vote-label {
  display: block;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.vote-radio:checked + .vote-label {
  border-color: var(--primary-color);
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.vote-label.for {
  border-color: var(--success-color);
}

.vote-radio:checked + .vote-label.for {
  border-color: var(--success-color);
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success-color);
}

.vote-label.against {
  border-color: var(--danger-color);
}

.vote-radio:checked + .vote-label.against {
  border-color: var(--danger-color);
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}

.vote-amount-input {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.vote-amount-input input {
  flex: 1;
}

.token-suffix {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Progress Tracking */
.progress-section {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
}

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

.stat-item {
  text-align: center;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius);
}

.stat-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.progress-bars {
  margin-bottom: 1.5rem;
}

.progress-bar {
  margin-bottom: 1rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.progress-track {
  height: 20px;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-fill.success {
  background-color: var(--success-color);
}

.progress-fill.danger {
  background-color: var(--danger-color);
}

.threshold-info {
  text-align: center;
  color: var(--text-secondary);
}

/* Countdown Timer */
.countdown-section {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  text-align: center;
  margin: 2rem 0;
}

.countdown {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin: 1rem 0;
}

.countdown.expired {
  color: var(--danger-color);
  background-color: rgba(239, 68, 68, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
}

/* Proposal Cards */
.proposal-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
  overflow: hidden;
}

.proposal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.proposal-title {
  margin: 0 0 0.5rem 0;
  color: var(--primary-color);
}

.proposal-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.proposal-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-draft {
  background-color: #f3f4f6;
  color: #374151;
}

.status-reviewing {
  background-color: #fef3c7;
  color: #92400e;
}

.status-voting {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-established {
  background-color: #d1fae5;
  color: #065f46;
}

.status-rejected {
  background-color: #fee2e2;
  color: #991b1b;
}

.proposal-body {
  padding: 1.5rem;
}

.proposal-summary {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.proposal-actions {
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* User Vote History */
.vote-history {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  margin: 2rem 0;
}

.vote-entry {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.vote-entry:last-child {
  border-bottom: none;
}

.vote-direction {
  font-weight: 600;
  text-transform: uppercase;
}

.vote-direction.for {
  color: var(--success-color);
}

.vote-direction.against {
  color: var(--danger-color);
}

.vote-amount {
  font-family: var(--font-mono);
  font-weight: 600;
}

.vote-time {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Disabled States */
.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.requires-connection.disabled::after {
  content: 'Connect wallet to interact';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  white-space: nowrap;
  z-index: 10;
}

.requires-connection.disabled {
  position: relative;
}

/* Settlement Dashboard */
.settlement-section {
  background: linear-gradient(135deg, var(--success-color), #16a34a);
  color: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  margin: 2rem 0;
}

.settlement-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.settlement-stat {
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
}

.settlement-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.settlement-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Responsive Design for Interactive Elements */
@media (max-width: 768px) {
  .user-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .user-profile {
    flex-direction: column;
    text-align: center;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .vote-options {
    flex-direction: column;
  }
  
  .vote-amount-input {
    flex-direction: column;
    align-items: stretch;
  }
  
  .tally-stats {
    grid-template-columns: 1fr;
  }
  
  .proposal-actions {
    flex-direction: column;
  }
  
  .vote-entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    text-align: center;
  }
  
  .settlement-stats {
    grid-template-columns: 1fr;
  }
  
  .toast {
    min-width: auto;
    margin: 0 10px;
  }
}

/* Accessibility Improvements */
.btn:focus,
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.vote-label:focus-within {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }
  
  .progress-fill {
    border: 1px solid #000;
  }
  
  .vote-label {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .toast,
  .progress-fill,
  .btn,
  .vote-label {
    transition: none;
  }
  
  .btn.loading::after {
    animation: none;
  }
}