/* --- Theme: Green & Grey (RTS Labs) --- */
:root {
  --green:        #8cc63f;
  --green-dark:   #6ea130;
  --green-light:  #a8d96a;
  --grey-dark:    #4a4a4a;
  --grey:         #666666;
  --grey-mid:     #999999;
  --grey-light:   #e8e8e8;
  --grey-bg:      #f4f4f4;
  --white:        #ffffff;
  --red:          #d9534f;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--grey-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--grey-bg);
}

a {
  color: var(--green-dark);
}

/* --- Navigation --- */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background-color: var(--grey-dark);
}

nav .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

nav .logo img {
  height: 40px;
  width: auto;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav ul a {
  color: var(--grey-light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

nav ul a:hover {
  color: var(--green);
}

/* --- Main content --- */
main {
  flex: 1;
  padding: 2rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  margin-bottom: 1rem;
  color: var(--grey-dark);
}

h2, h3 {
  color: var(--grey-dark);
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 1rem 2rem;
  background-color: var(--grey-dark);
  color: var(--grey-mid);
  font-size: 0.875rem;
}

/* --- Auth forms --- */
.auth-container {
  max-width: 420px;
  margin: 2rem auto;
  background-color: var(--white);
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid var(--grey-light);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--grey);
}

.form-group input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--grey-light);
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(140, 198, 63, 0.25);
}

.btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

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

.form-error {
  color: var(--red);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  background-color: #fdf0ef;
  border-radius: 4px;
}

.auth-switch {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* --- Stock lookup --- */
.stock-search {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.stock-search input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--grey-light);
  border-radius: 4px;
  font-size: 1rem;
  text-transform: uppercase;
}

.stock-search input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(140, 198, 63, 0.25);
}

.quote-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background-color: var(--white);
  border-radius: 8px;
  border: 1px solid var(--grey-light);
}

.quote-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.quote-header h2 {
  color: var(--grey-dark);
  margin: 0;
}

.quote-price {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--grey-dark);
}

.quote-change {
  margin-top: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.positive {
  color: var(--green-dark);
}

.negative {
  color: var(--red);
}

.quote-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--grey-light);
}

.quote-details .label {
  display: block;
  font-size: 0.8rem;
  color: var(--grey-mid);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

#candles-section {
  margin-top: 2rem;
}

#candles-section h3 {
  color: var(--grey-dark);
  margin-bottom: 0.5rem;
}

#candles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background-color: var(--white);
  border-radius: 8px;
  overflow: hidden;
}

#candles-table th,
#candles-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--grey-light);
}

#candles-table th {
  background-color: var(--grey-dark);
  font-weight: 600;
  color: var(--white);
  text-align: right;
}

#candles-table th:first-child,
#candles-table td:first-child {
  text-align: left;
}

#candles-table tbody tr:hover {
  background-color: rgba(140, 198, 63, 0.08);
}

#stock-loading {
  margin-top: 1rem;
  color: var(--grey-mid);
  font-style: italic;
}

/* --- Utility --- */
#api-status {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--white);
  border-radius: 6px;
  border: 1px solid var(--grey-light);
  font-family: monospace;
  font-size: 0.9rem;
}
