/* public/styles.css — Modern & Mobile-Friendly */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --danger: #ef4444;
  --light: #f9fafb;
  --dark: #111827;
  --gray: #6b7280;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8fafc;
  color: var(--dark);
  line-height: 1.6;
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.user-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-weight: 500;
}

/* Navigation */
nav {
  padding: 0.75rem 1rem;
  background: #1e40af;
  overflow-x: auto;
  white-space: nowrap;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  margin-right: 0.5rem;
  display: inline-block;
  transition: background 0.2s;
}

nav a:hover {
  background: rgba(255,255,255,0.15);
}

/* Main Content */
main {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Typography */
h2 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--dark);
  font-size: 1.75rem;
}

h3 {
  margin: 1.5rem 0 1rem;
  color: var(--dark);
}

h4 {
  margin: 1.25rem 0 0.75rem;
  color: var(--dark);
}

/* Buttons */
.btn, button, .btn-inline {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
  font-weight: 500;
}

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

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

.btn-inline {
  background: var(--success);
  color: white;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

.btn-inline:hover {
  background: #0da273;
}

button[type="submit"] {
  background: var(--primary);
  color: white;
}

button[type="submit"]:hover {
  background: var(--primary-dark);
}

a.btn {
  background: var(--primary);
  color: white;
  text-align: center;
}

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

/* Forms */
form {
  margin: 1.5rem 0;
}

.field-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: white;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: var(--dark);
}

tr:last-child td {
  border-bottom: none;
}

/* Status badges */
td:has(button) {
  white-space: nowrap;
}

/* Alerts & Messages */
.center {
  text-align: center;
  margin: 3rem auto;
  max-width: 500px;
}

/* Inline Forms */
.field-group > div[style*="display"] {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.75rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.25rem;
  }

  nav a {
    padding: 0.5rem;
    font-size: 0.9rem;
    margin-right: 0.25rem;
  }

  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
  }

  td {
    border: none;
    position: relative;
    padding-left: 50%;
    padding-right: 1rem;
  }

  td:before {
    content: attr(data-label) ": ";
    position: absolute;
    left: 1rem;
    width: 45%;
    font-weight: bold;
    color: var(--gray);
  }

  /* Make actions full-width on mobile */
  td:has(button), td:has(a) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem !important;
  }

  td:has(button):before, td:has(a):before {
    display: none;
  }

  button, a {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
  }
}

/* Chart container */
canvas {
  max-width: 100%;
  height: auto !important;
}