/* ============================================================
   Valleypoint Accounting – Shared Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #2e7d32;
  --accent:    #1b5e20;
  --light:     #f1f8f1;
  --border:    #c8e6c9;
  --danger:    #c0392b;
  --text:      #222;
  --muted:     #555;
  --radius:    6px;
  --shadow:    0 2px 8px rgba(0,0,0,.1);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--primary);
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
header .logo { font-size: 1.2rem; font-weight: 700; letter-spacing: .5px; }
header .logo span { color: #90caf9; }
header nav a {
  color: #c8e6c9;
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: .9rem;
  transition: color .2s;
}
header nav a:hover { color: #fff; }

/* ── Main containers ── */
.container {
  max-width: 760px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

h1 { font-size: 1.6rem; color: var(--primary); margin-bottom: .25rem; }
h2 { font-size: 1.25rem; color: var(--primary); margin-bottom: 1rem; }
.subtitle { color: var(--muted); margin-bottom: 1.75rem; font-size: .95rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; color: #444; }
input, select, textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  color: var(--text);
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,125,50,.15);
}
textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .6rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #224e7a; }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { background: #256427; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #a93226; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
  display: none;
}
.alert.show { display: block; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-error   { background: #fdecea; color: #b71c1c; border: 1px solid #ef9a9a; }
.alert-info    { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--primary); color: #fff; padding: .65rem .85rem; text-align: left; font-weight: 600; }
td { padding: .6rem .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f0f4f9; }

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-pending   { background: #fff3cd; color: #856404; }
.badge-confirmed { background: #d4edda; color: #155724; }
.badge-cancelled { background: #f8d7da; color: #721c24; }

/* ── Tabs ── */
.tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.tab-btn {
  padding: .5rem 1.2rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  color: var(--muted);
  font-weight: 600;
  transition: all .2s;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Filters ── */
.filters { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: flex-end; }
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }

/* ── Availability grid ── */
.avail-grid { display: grid; gap: .75rem; }
.avail-row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr 1fr auto;
  gap: .5rem;
  align-items: center;
}
.avail-row .day-label { font-weight: 600; }
@media (max-width: 600px) {
  .avail-row { grid-template-columns: 1fr 1fr; }
  .avail-row .day-label { grid-column: 1 / -1; }
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid #ccc;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: .4rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Monthly Calendar ── */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-day-header {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: .4rem;
  font-size: .8rem;
  font-weight: 700;
}
.cal-cell {
  min-height: 80px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: .35rem;
  background: #fff;
  cursor: pointer;
  transition: background .15s;
}
.cal-cell:hover { background: #f0faf0; }
.cal-cell.other-month { background: #f9f9f9; color: #bbb; }
.cal-cell.today { background: #e8f5e9; }
.cal-cell.selected { outline: 2px solid var(--primary); }
.cal-date {
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .25rem;
}
.cal-cell.other-month .cal-date { color: #ccc; }
.cal-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin: 1px;
}
.cal-dot-pending   { background: #f0a500; }
.cal-dot-confirmed { background: var(--primary); }
.cal-dot-cancelled { background: var(--danger); }
.cal-event-label {
  font-size: .72rem;
  border-radius: 3px;
  padding: 1px 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.cal-event-pending   { background: #fff3cd; color: #856404; }
.cal-event-confirmed { background: #d4edda; color: #155724; }
.cal-event-cancelled { background: #f8d7da; color: #721c24; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light);
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo h1 { font-size: 1.4rem; }
.login-logo p  { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
