/* 
  Drug Wars — Modern Web Version
  File: styles.css
  Layout + Theming for HTML UI
*/

/* Reset & Base
   ---------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #0a0a0a;
  color: #e8e8e8;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: #4eb1ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

/* Utility classes
   ---------------------------- */
.hidden {
  display: none !important;
}
.muted {
  opacity: 0.75;
}
.money {
  color: #9eff9e;
}
.debt {
  color: #ff7979;
}
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: #444;
  border-radius: 4px;
  font-size: 0.8rem;
}
.badge.hidden {
  display: none;
}

/* Layout: App container
   ---------------------------- */
.app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #111;
  border-bottom: 1px solid #222;
}

.app-header .title {
  margin: 0;
  font-size: 1.5rem;
}
.app-header .subtitle {
  font-size: 0.85rem;
  color: #aaa;
}
.session-controls {
  display: flex;
  gap: 0.5rem;
}

/* Status bar
   ---------------------------- */
.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background-color: #181818;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #222;
}
.stat {
  display: flex;
  flex-direction: column;
  min-width: 70px;
}
.stat-label {
  font-size: 0.75rem;
  color: #aaa;
}
.stat-value {
  font-weight: bold;
  font-size: 1rem;
}

/* Main content
   ---------------------------- */
.content {
  flex: 1;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.content section {
  background-color: #141414;
  border: 1px solid #222;
  border-radius: 6px;
  padding: 0.5rem;
}

/* Actions panel */
.actions-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  grid-column: 1 / -1;
  background-color: transparent;
  border: none;
  padding: 0;
}

/* Market table
   ---------------------------- */
.table-responsive {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 0.5rem;
  text-align: left;
}
.table th {
  background-color: #222;
  font-weight: bold;
}
.table tr:nth-child(even) {
  background-color: #1a1a1a;
}
.table tr:hover {
  background-color: #222;
}
.actions-col {
  width: 130px;
}
.row-actions {
  display: flex;
  gap: 0.25rem;
}

/* Event log
   ---------------------------- */
.event-log {
  grid-column: 1 / -1;
}
#log {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.9rem;
  padding: 0.25rem;
}
#log div {
  border-bottom: 1px solid #222;
  padding: 0.25rem 0;
}
#btn-clear-log {
  margin-left: auto;
}

/* Footer
   ---------------------------- */
.app-footer {
  background-color: #111;
  border-top: 1px solid #222;
  padding: 0.5rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #888;
}

/* Buttons
   ---------------------------- */
.btn {
  background-color: #333;
  border: 1px solid #555;
  color: #eee;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}
.btn:hover {
  background-color: #444;
}
.btn.primary {
  background-color: #4eb1ff;
  border-color: #4eb1ff;
  color: #000;
}
.btn.primary:hover {
  background-color: #74c6ff;
}
.btn.danger {
  background-color: #e04f4f;
  border-color: #e04f4f;
  color: #fff;
}
.btn.danger:hover {
  background-color: #f26565;
}
.btn.ghost {
  background-color: transparent;
  border: 1px solid #555;
  color: #eee;
}
.btn.ghost:hover {
  background-color: #222;
}
.btn.small {
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
}
.btn.block {
  display: block;
  width: 100%;
}

/* Modals
   ---------------------------- */
.modal {
  border: none;
  border-radius: 6px;
  padding: 0;
  background-color: #1b1b1b;
  color: #eee;
  max-width: 400px;
  width: 90%;
}
.modal.danger {
  border: 2px solid #e04f4f;
}
.modal-card {
  display: flex;
  flex-direction: column;
}
.modal-header,
.modal-footer {
  padding: 0.5rem;
  background-color: #111;
  border-bottom: 1px solid #222;
}
.modal-footer {
  border-top: 1px solid #222;
  border-bottom: none;
  justify-content: flex-end;
  display: flex;
  gap: 0.5rem;
}
.modal-body {
  padding: 0.75rem;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}
.icon-btn {
  background: transparent;
  border: none;
  color: #999;
  font-size: 1.2rem;
  cursor: pointer;
}
.icon-btn:hover {
  color: #fff;
}
.form-row {
  margin-bottom: 0.5rem;
}
.form-row label {
  display: block;
  margin-bottom: 0.25rem;
}
input[type="number"] {
  width: 100%;
  padding: 0.3rem;
  background-color: #222;
  border: 1px solid #444;
  color: #fff;
  border-radius: 4px;
}
.qty-input {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.form-error {
  color: #ff7979;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Toasts
   ---------------------------- */
.toasts {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background-color: #333;
  border: 1px solid #555;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
.toast.success {
  border-color: #9eff9e;
}
.toast.error {
  border-color: #ff7979;
}

/* Responsive
   ---------------------------- */
@media (max-width: 800px) {
  .content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================
   NEW: Price discount coloring
   ============================ */
.price-discount-green {
  color: #4eff4e; /* bright green for 1–4 soldiers */
  font-weight: bold;
}
.price-discount-blue {
  color: #4ea9ff; /* bright blue for 5 soldiers */
  font-weight: bold;
}
