/* === Global reset-ish === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* === Base layout === */
html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #111827;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* === Top nav === */
nav {
  background: #111827;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between; /* left + right sections */
}

/* left side: app nav + user info */
.nav-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-user {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* right side: copyright */
.nav-right.copyright {
  font-size: 0.9rem;
  opacity: 0.85;
  white-space: nowrap; /* keep on one line when possible */
}

/* nav links */
nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 500;
  margin-left: 0.5rem;
}

nav a:first-of-type {
  margin-left: 0;
}

nav a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* === Main content area === */
main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
}

/* Shared page title */
.page-title,
h1,
h2 {
  margin-top: 0;
  color: #111827;
}

/* === Generic form styling === */
form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 480px;
}

label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #374151;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"],
select {
  padding: 0.6rem 0.7rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  width: 100%;
  max-width: 100%;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}

/* Password input + toggle button row */
.password-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.password-row input[type="password"],
.password-row input[type="text"] {
  flex: 1;
}

.password-row .toggle-password {
  flex-shrink: 0;
  padding-inline: 1rem;
  white-space: nowrap;
}

/* Buttons */
button {
  border-radius: 0.375rem;
  border: none;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button.primary,
button[type="submit"] {
  background: #2563eb;
  color: #ffffff;
}

button.primary:hover,
button[type="submit"]:hover {
  background: #1d4ed8;
}

button.secondary,
.toggle-password {
  background: #e5e7eb;
  color: #111827;
}

button.secondary:hover,
.toggle-password:hover {
  background: #d1d5db;
}

/* Message styles on upload page, etc. */
.message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
  white-space: pre-wrap;
}

.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* === Dashboard iframe === */
.dashboard-frame,
iframe {
  width: 100%;
  min-height: 70vh;
  border: 0;
}

/* Container for dashboard page if needed */
.dashboard-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* === Responsive tweaks === */

/* Tablets & below */
@media (max-width: 768px) {
  nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .nav-left {
    width: 100%;
    justify-content: space-between;
  }

  .nav-right.copyright {
    font-size: 0.85rem;
  }

  main {
    padding-inline: 1rem;
  }

  /* Make text-style inputs + buttons full width on small screens */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  input[type="file"],
  button,
  select {
    width: 100%;
    max-width: 100%;
    font-size: 1rem;
  }

  /* Stack password input + toggle vertically if space is tight */
  .password-row {
    flex-direction: column;
    align-items: stretch;
  }

  .password-row .toggle-password {
    width: 100%;
  }
}

/* Small phones */
@media (max-width: 480px) {
  nav {
    padding: 0.6rem 0.9rem;
  }

  main {
    padding: 1rem 0.9rem 1.5rem;
  }

  h1,
  h2 {
    font-size: 1.35rem;
  }

  button {
    padding-block: 0.7rem;
  }
}

