/* frontend/style.css */

/* --- BASE LAYOUT --- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  background: #f9f9f9;
  color: #333;
  margin: 0;
  padding: 2rem;
}

/* --- NAVBAR --- */
.navbar {
  background-color: #f8f8f8;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.navbar .logo {
  font-size: 1.4rem;
  font-weight: 600;
  color: #111;
  text-decoration: none;
}
.navbar .nav-links {
  display: flex;
  gap: 20px;
}
.navbar .nav-links a {
  text-decoration: none;
  color: #333;
  font-size: 1rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}
.navbar .nav-links a.active,
.navbar .nav-links a:hover {
  background: #007aff;
  color: #fff;
}

/* --- CONTAINER (CARD) --- */
.container {
  max-width: 480px;
  width: 95vw;
  margin: 40px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(60,60,60,0.08);
  padding: 28px 12px 24px 12px;
}

/* --- TRADE FORM --- */
form#tradeForm {
  width: 100%;
  margin: 0 auto;
  padding: 0;
}
h1 {
  font-size: 1.35rem;
  margin-bottom: 2rem;
  text-align: center;
}
.form-group {
  margin-bottom: 1.5rem;
}
label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 1.07rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #c5c5c5;
  border-radius: 12px;
  font-size: 1.08rem;
  margin-bottom: 0;
  box-sizing: border-box;
  background: #fafbfc;
}
input:focus, select:focus, textarea:focus {
  border-color: #0071e3;
  outline: none;
  background: #f5faff;
}
button, .button {
  width: 100%;
  background-color: #0071e3;
  color: white;
  padding: 1rem;
  border: none;
  border-radius: 10px;
  font-size: 1.12rem;
  cursor: pointer;
  transition: background 0.3s;
  text-decoration: none;
  outline: none;
  margin: 0;
  margin-top: 1.5rem;
}
button:hover, .button:hover {
  background-color: #005bb5;
}
.button:disabled,
button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* --- TABLE (View Trades) --- */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 1rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.07);
  background: inherit;
}
.table-wrapper::-webkit-scrollbar {
  height: 8px;
  background: #eee;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 4px;
}
#tradesTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
#tradesTable th, #tradesTable td {
  padding: 10px 12px;
  font-size: 1rem;
  text-align: left;
  white-space: nowrap;
}
#tradesTable th {
  background-color: #f8f8f8;
  font-weight: 600;
  border-bottom: 2px solid #ededed;
}
#tradesTable tr {
  border-bottom: 1px solid #f1f1f1;
}
#tradesTable tr:hover {
  background: #f5faff;
}
.action-buttons {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

/* --- FILTER BAR (if used) --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}
.filter-bar input, .filter-bar select, .filter-bar button {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #ccc;
  font-size: 0.95rem;
}

/* --- FULL RESPONSIVE/MOBILE OPTIMIZATION --- */
@media (max-width: 900px) {
  .container {
    max-width: 99vw;
    padding: 12px 1vw 18px 1vw;
  }
  #tradesTable th, #tradesTable td {
    font-size: 0.93rem;
    padding: 7px 6px;
  }
  .table-wrapper {
    box-shadow: none;
    border-radius: 0;
  }
}

@media (max-width: 600px) {
  .container {
    max-width: 99vw;
    min-width: 0;
    padding: 8px 2vw 18px 2vw;
    border-radius: 8px;
    box-shadow: none;
  }
  form#tradeForm {
    padding: 0;
  }
  .form-group label, .form-group input, .form-group select, .form-group textarea {
    font-size: 1rem !important;
  }
  input, select, textarea {
    font-size: 1rem;
    padding: 0.77rem 0.6rem;
  }
  button, .button {
    padding: 0.8rem;
    font-size: 1.01rem;
    border-radius: 7px;
  }
  h1 {
    font-size: 1.06rem;
    margin-bottom: 1.1rem;
  }
  .navbar {
    flex-direction: column;
    gap: 8px;
    padding: 8px 2px;
  }
  .navbar .logo {
    font-size: 1.1rem;
  }
}

/* --- Wide Table Container for Listing Pages --- */
.table-container {
  max-width: 1100px;
  width: 96vw;
  margin: 40px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(60,60,60,0.08);
  padding: 40px 24px 24px 24px;
}

/* Make table scrollable on mobile but always wide on desktop */
@media (max-width: 900px) {
  .table-container {
    max-width: 99vw;
    padding: 12px 2vw 18px 2vw;
    border-radius: 10px;
  }
}
@media (max-width: 600px) {
  .table-container {
    padding: 4px 0.5vw 10px 0.5vw;
    box-shadow: none;
    border-radius: 6px;
  }
}

/* Modal Overlay */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.23);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
/* Modal Card */
.modal-content {
  background: #fff;
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  border-radius: 18px;
  box-shadow: 0 8px 38px rgba(30,30,40,0.15);
  width: 98vw;
  max-width: 420px;
  max-height: 98vh;
  overflow-y: auto;
}
.modal-content h2 {
  text-align: center;
  margin-bottom: 1.3rem;
}
@media (max-width:600px){
  .modal-content { padding: 1rem 2vw 1.2rem 2vw; }
}
