/* ==========================================
   TradeOne styles.css – Unified Branded Edition
   ========================================== */

/* ==========================================
   1. BASE & SHARED STYLES
   ========================================== */
body {
  background-image: url('/images/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #f9f6ef;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  margin: 0;
  color: #1c1c1c;
}

a {
  color: #007b83;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease-in-out;
}

a:hover {
  color: #005f65;
}

/* ==========================================
   2. AUTHENTICATION PAGES (Glassy Style)
   Login, Register, Index
   ========================================== */
/* NOTE: These generic selectors target the main auth forms.
   We must override them if used elsewhere (like the dashboard header). */
.container,
form {
  margin: 40px auto;
  width: 90%;
  max-width: 420px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  text-align: center;
  box-sizing: border-box;
}

/* Typography (Auth Scope) */
.container h1, .container h2,
form h1, form h2 {
  color: #1c1c1c;
  margin-bottom: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.container p,
form p {
  font-size: 0.92rem;
  color: #333;
  margin-bottom: 18px;
}

/* Forms (Auth Scope) */
label {
  display: block;
  text-align: left;
  margin-bottom: 6px;
  color: #2a2a2a;
  font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  margin-bottom: 18px;
  padding: 11px 10px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  transition: all 0.2s ease-in-out;
  font-size: 0.95rem;
  box-sizing: border-box;
}

input:focus {
  border-color: #007b83;
  box-shadow: 0 0 5px rgba(0, 123, 131, 0.4);
  outline: none;
}

/* Buttons (Auth Scope) */
button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.25s ease-in-out;
  letter-spacing: 0.3px;
}

.login-button,
button[name="login"] {
  background-color: #007b83;
  color: #fff;
}

.login-button:hover,
button[name="login"]:hover {
  background-color: #00656c;
  transform: translateY(-1px);
}

.register-button,
button[name="register"] {
  background-color: #e0b347;
  color: #1a1a1a;
}

.register-button:hover,
button[name="register"]:hover {
  background-color: #c89b2f;
  transform: translateY(-1px);
}

/* ==========================================
   3. DASHBOARD (Scoped via .dashboard-page)
   ========================================== */
.dashboard-page {
  background: #f4f6fa;
  color: #1c1c1c;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Header --- */
.dashboard-page .app-header {
  background-color: #002d72;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* FIX: Reset form styles specifically for the header logout button */
.dashboard-page .app-header form {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  width: auto;
  max-width: none;
}

.dashboard-page .app-header .welcome-text {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.4px;
  color: #ffffff;
}

.dashboard-page .app-header .logout-button {
  background-color: #c62828;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.1s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  /* Ensure button itself doesn't have huge margins if it inherited them */
  margin-bottom: 0; 
}

.dashboard-page .app-header .logout-button:hover {
  background-color: #a82222;
  transform: scale(1.03);
}

/* --- Main Layout --- */
.dashboard-page .dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  padding: 40px 20px 80px;
}

/* --- Components: Cards --- */
.dashboard-page .card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 960px;
  padding: 25px 30px;
  box-sizing: border-box;
}

.dashboard-page .card h3 {
  color: #002d72;
  border-bottom: 2px solid #e0e4eb;
  padding-bottom: 6px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* --- Components: Charts & Summary --- */
.dashboard-page #portfolioChart {
  width: 100%;
  max-height: 300px;
}

.dashboard-page .account-summary p {
  margin: 6px 0;
}

.dashboard-page .account-summary span {
  font-weight: 600;
  color: #004aad;
}

/* --- Components: Tables --- */
.dashboard-page table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  font-size: 0.95rem;
}

.dashboard-page th {
  background: #e7eef9;
  padding: 12px;
  font-weight: 600;
  color: #002d72;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dashboard-page td {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e4eb;
}

.dashboard-page tbody tr:hover {
  background: #f9fbff;
  transition: background 0.15s ease;
}

.dashboard-page td:first-child,
.dashboard-page th:first-child {
  text-align: left;
  padding-left: 18px;
}

.dashboard-page td.positive { color: #2e7d32; }
.dashboard-page td.negative { color: #c62828; }

/* --- Footer --- */
.dashboard-page .footer {
  text-align: center;
  padding: 25px 0;
  color: #666;
  background: #f0f2f6;
  font-size: 0.9rem;
  border-top: 1px solid #ddd;
}

/* ==========================================
   4. RESPONSIVE MEDIA QUERIES
   ========================================== */
@media (max-width: 768px) {
  .dashboard-page .app-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    padding: 20px;
  }

  .dashboard-page .app-header .logout-button {
    width: 100%;
    max-width: 240px;
  }

  .dashboard-page .card {
    padding: 20px;
  }

  .dashboard-page table {
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .container,
  form {
    width: 95%;
    padding: 22px;
  }

  .container h1, .container h2,
  form h1, form h2 {
    font-size: 1.4rem;
  }

  button {
    font-size: 15px;
  }
}