/* Qualtrics Experiment App - Shared Styles */
/* Clean, neutral, professional design for research */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  background-color: #ffffff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

/* Container */
.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Card Layout */
.card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
  .card {
    padding: 1.5rem;
  }
}

/* Typography */
h1 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  text-align: center;
}

h2 {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.subtitle {
  font-size: 1rem;
  color: #666666;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Admin Header with Logo */
.admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  margin-top: -2rem;
  margin-left: -1.5rem;
}

.admin-header-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-header h1 {
  margin-bottom: 0;
  text-align: left;
}

.back-btn {
  width: fit-content;
}

.admin-logo {
  height: 240px;
  width: auto;
}

/* Admin page specific - reduce top whitespace */
body:has(.admin-header) {
  padding-top: 0.5rem;
}

/* Password Input Grid */
.password-section {
  margin-bottom: 1.5rem;
}

.password-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.password-input {
  width: 48px;
  height: 48px;
  text-align: center;
  font-size: 1.25rem;
  border: 2px solid #e5e5e5;
  border-radius: 4px;
  outline: none;
  background: #ffffff;
}

.password-input:focus {
  border-color: #2563eb;
}

@media (max-width: 320px) {
  .password-input {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}

.btn-primary {
  background-color: #2563eb;
  color: #ffffff;
}

.btn-primary:disabled {
  background-color: #e5e5e5;
  color: #9ca3af;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #1a1a1a;
  border: 1px solid #e5e5e5;
}

.btn-danger {
  background-color: #dc2626;
  color: #ffffff;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  width: auto;
}

/* Error Messages */
.error-message {
  color: #dc2626;
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
  display: none;
}

.error-message.visible {
  display: block;
}

/* Balance Display */
.balance-display {
  background: #f9fafb;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* Stock Panels */
.stocks-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 500px) {
  .stocks-container {
    grid-template-columns: 1fr;
  }
}

.stock-panel {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stock-title {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
}

.stock-info {
  margin-bottom: 0.75rem;
}

.stock-info span {
  display: block;
  margin-bottom: 0.25rem;
}

.stock-label {
  color: #666666;
  font-size: 0.875rem;
}

.stock-value {
  font-weight: 500;
  transition: color 0.3s ease;
}

.stock-value.price-up {
  color: #16a34a;
}

.stock-value.price-down {
  color: #dc2626;
}

/* Admin Table */
.admin-table-container {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid #e5e5e5;
}

.admin-table th {
  background: #f9fafb;
  font-weight: 500;
}

.admin-table td {
  background: #ffffff;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Detail Panel */
.detail-panel {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  display: none;
}

.detail-panel.visible {
  display: block;
}

.detail-panel h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.events-table th,
.events-table td {
  padding: 0.5rem;
  text-align: left;
  border: 1px solid #e5e5e5;
}

.events-table th {
  background: #f9fafb;
  font-weight: 500;
}

.events-table td {
  background: #ffffff;
  word-break: break-word;
}

.close-detail {
  margin-top: 1rem;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 2rem;
  color: #666666;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.hidden {
  display: none !important;
}

/* Finish Section */
.finish-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e5e5;
}

/* Filter Controls */
.filter-controls {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid #e5e5e5;
}

.filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-group {
  flex: 1;
  min-width: 120px;
}

.filter-group label {
  display: block;
  font-size: 0.75rem;
  color: #666666;
  margin-bottom: 0.25rem;
}

.filter-input {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.875rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  background: #ffffff;
}

.filter-input:focus {
  outline: none;
  border-color: #2563eb;
}

@media (max-width: 500px) {
  .filter-group {
    flex: 100%;
  }
}

/* Admin Controls */
.admin-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.admin-controls .btn {
  width: auto;
  flex: 1;
  min-width: 100px;
}

@media (max-width: 500px) {
  .admin-controls {
    flex-direction: column;
  }
  
  .admin-controls .btn {
    width: 100%;
  }
}

/* No Data Message */
.no-data {
  text-align: center;
  padding: 2rem;
  color: #666666;
  font-style: italic;
}

/* Warning Dialog */
.warning-dialog {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.warning-dialog.visible {
  display: flex;
}

.warning-content {
  background: #ffffff;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.warning-content h3 {
  margin-bottom: 1rem;
  color: #1a1a1a;
}

.warning-content p {
  margin-bottom: 1.5rem;
  color: #666666;
}

.warning-content .btn {
  width: auto;
  min-width: 150px;
}

/* Charts Section */
.charts-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e5e5;
}

.charts-section h2 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.stats-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 120px;
  background: #f9fafb;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 0.25rem;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: #666666;
}

.charts-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .charts-container {
    grid-template-columns: 1fr;
  }
}

.chart-panel {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 1rem;
}

.chart-panel h3 {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: #1a1a1a;
}

.bar-chart {
  min-height: 150px;
}

.chart-bar-container {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.chart-bar-label {
  width: 100px;
  font-size: 0.75rem;
  color: #666666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.chart-bar-wrapper {
  flex: 1;
  height: 20px;
  background: #f3f4f6;
  border-radius: 2px;
  overflow: hidden;
  margin-right: 0.5rem;
}

.chart-bar {
  height: 100%;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.chart-bar-value {
  width: 40px;
  font-size: 0.75rem;
  color: #1a1a1a;
  text-align: right;
  flex-shrink: 0;
}

.no-chart-data {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  color: #666666;
  font-size: 0.875rem;
  font-style: italic;
}

/* Line Chart */
.line-chart {
  min-height: 200px;
  width: 100%;
}

.line-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Trading App Styles */
.trading-app {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.trading-header {
  background: #1a1a1a;
  color: #ffffff;
  padding: 1rem 1.5rem;
  text-align: center;
}

.trading-header h1 {
  color: #ffffff;
  margin-bottom: 0;
  font-size: 1.25rem;
}

/* Portfolio Summary - simplified neutral design */
.portfolio-summary {
  display: flex;
  background: #f9fafb;
  border-bottom: 1px solid #e5e5e5;
  padding: 0.75rem 1rem;
  gap: 1rem;
  justify-content: center;
}

@media (max-width: 500px) {
  .portfolio-summary {
    flex-direction: row;
    gap: 1.5rem;
  }
}

.portfolio-item {
  text-align: center;
  padding: 0.25rem 0.5rem;
}

.portfolio-label {
  display: block;
  font-size: 0.7rem;
  color: #666666;
  margin-bottom: 0.125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.portfolio-value {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: #1a1a1a;
}

/* Trading Panels */
.trading-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.5rem;
}

@media (max-width: 500px) {
  .trading-panels {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
}

.trading-panel {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 1rem;
}

.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e5e5;
}

.stock-symbol {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.stock-price {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
}

/* Holdings Row */
.holdings-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.625rem;
  background: #f9fafb;
  border-radius: 4px;
  font-size: 0.8rem;
}

.holdings-label {
  color: #666666;
}

.holdings-value {
  font-weight: 600;
  color: #1a1a1a;
}

.holdings-worth {
  color: #666666;
  margin-left: auto;
}

/* Order Section */
.order-section {
  border-top: 1px solid #e5e5e5;
  padding-top: 0.75rem;
}

.order-input-row {
  margin-bottom: 0.5rem;
}

.order-input-row label {
  display: block;
  font-size: 0.7rem;
  color: #666666;
  margin-bottom: 0.125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quantity-input {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  text-align: center;
  font-weight: 500;
}

.quantity-input:focus {
  outline: none;
  border-color: #2563eb;
}

.quantity-input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
}

.order-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.order-label {
  font-size: 0.8rem;
  color: #666666;
}

.order-total {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a1a;
}

.order-preview.insufficient {
  background: #f9fafb;
  border-color: #666666;
}

.order-preview.insufficient .order-label {
  color: #666666;
}

.order-preview.insufficient .order-total {
  color: #1a1a1a;
}

.order-warning {
  font-size: 0.75rem;
  color: #666666;
  text-align: center;
  margin-bottom: 0.5rem;
}

.order-feedback {
  font-size: 0.75rem;
  color: #1a1a1a;
  text-align: center;
  padding: 0.375rem;
  background: #f3f4f6;
  border-radius: 4px;
  margin-top: 0.5rem;
  display: none;
}

.order-feedback.visible {
  display: block;
}

/* Buy Button - neutral styling */
.btn-buy {
  background-color: #1a1a1a;
  color: #ffffff;
  font-weight: 500;
}

.btn-buy:hover:not(:disabled) {
  background-color: #333333;
}

.btn-buy:disabled {
  background-color: #e5e5e5;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Finish Button */
.btn-finish {
  background-color: #1a1a1a;
  color: #ffffff;
  font-weight: 500;
}

.btn-finish:hover:not(:disabled) {
  background-color: #333333;
}

.btn-finish:disabled {
  background-color: #e5e5e5;
  color: #9ca3af;
  cursor: not-allowed;
}

.trading-app .finish-section {
  padding: 1.5rem;
  padding-top: 0;
  border-top: none;
  margin-top: 0;
}

.trading-app .error-message {
  padding: 0 1.5rem 1rem;
}
