/* ============================================================
 * Urenregistratie – IJswinkel Terschelling
 * Stylesheet
 * ============================================================ */

:root {
  --gold: #e0a93a;
  --gold-light: #f5d98a;
  --gold-dark: #b8872e;
  --cream: #f6f4ef;
  --cream-dark: #ebe7dd;
  --text: #2c2c2c;
  --text-light: #666;
  --white: #fff;
  --border: #ddd;
  --success: #4caf50;
  --error: #e53935;
  --info: #1976d2;
  --weekend-bg: #f9f6f0;
  --filled-bg: #f0f8f0;
  --locked-bg: #fef3e0;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- Auth Pages ---- */
.auth-container {
  max-width: 380px;
  margin: 80px auto 0;
  padding: 40px 32px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo { font-size: 48px; margin-bottom: 8px; }

.auth-container h1 {
  font-size: 24px;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-container h2 {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 400;
  margin-bottom: 28px;
}

.auth-container form { display: flex; flex-direction: column; gap: 12px; }

.auth-container input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.auth-container input:focus { border-color: var(--gold); }

.btn-primary {
  padding: 12px;
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--gold-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-link {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-light);
}

.auth-link a { color: var(--gold-dark); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }

.error-msg {
  margin-top: 12px;
  color: var(--error);
  font-size: 14px;
  min-height: 20px;
}

.error-msg.info { color: var(--info); }

/* ---- App Header ---- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo { font-size: 24px; }

.header-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.admin-badge {
  font-size: 14px;
  font-weight: 600;
  background: var(--gold);
  color: var(--white);
  padding: 3px 10px;
  border-radius: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-tag {
  font-size: 11px;
  color: var(--text-light);
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold-dark);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-link:hover { text-decoration: underline; }

.btn-back {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--text-light);
  line-height: 1;
}
.btn-back:hover { color: var(--text); }

/* ---- Employee Dashboard ---- */
.months-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.month-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow 0.15s;
}

.month-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.13); }

.month-card--current {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light), var(--shadow);
}

.month-card__name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.month-card__hours {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold-dark);
  line-height: 1.2;
  margin: 4px 0 2px;
}

.month-card__days {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.month-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.badge--locked { background: var(--locked-bg); color: #8a6200; }
.badge--open   { background: var(--filled-bg); color: #2e7d32; }

.btn-card-action {
  background: none;
  border: none;
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.btn-card-action:hover { text-decoration: underline; }

.dashboard-loading { color: var(--text-light); padding: 24px 0; text-align: center; }

/* ---- Main Content ---- */
.main-content { padding: 20px; max-width: 900px; margin: 0 auto; }

/* ---- Month Navigation ---- */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.month-title {
  font-size: 20px;
  min-width: 200px;
  text-align: center;
}

.btn-nav {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* ---- Period Status ---- */
.period-locked {
  text-align: center;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--locked-bg);
  border-radius: 6px;
  font-weight: 500;
  color: #e65100;
}

/* ---- Admin Actions ---- */
.admin-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn-action {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* ---- Tables ---- */
.table-container { overflow-x: auto; }

.uren-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.uren-table th {
  background: var(--gold);
  color: var(--white);
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.uren-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

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

.weekend-row { background: var(--weekend-bg); }
.weekend-row .col-day { color: var(--text-light); }
.filled-row { background: var(--filled-bg); }

.col-date { white-space: nowrap; font-weight: 500; width: 70px; }
.col-day { width: 36px; color: var(--text-light); }
.col-total { width: 60px; text-align: center; font-weight: 500; }
.col-time { width: 70px; }
.col-remarks { color: var(--text-light); font-size: 13px; }

.print-time { display: none; }

.uren-table select {
  width: 100%;
  min-width: 80px;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  cursor: pointer;
  appearance: auto;
}

.uren-table select:focus { border-color: var(--gold); outline: none; }

.uren-table input[type="text"] {
  width: 100%;
  min-width: 80px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
}

.uren-table input[type="text"]:focus { border-color: var(--gold); outline: none; }

/* ---- Month Total ---- */
.month-total {
  text-align: right;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-dark);
}

/* ---- Admin Table ---- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-table th {
  background: var(--gold);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
}

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

.clickable-row { cursor: pointer; transition: background 0.15s; }
.clickable-row:hover { background: var(--cream); }

.btn-detail {
  padding: 6px 14px;
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

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

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
  font-size: 15px;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

.modal-content {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-content--wide { max-width: 960px; }

.admin-edit-hint {
  font-size: 13px;
  color: var(--text-light);
  margin: -8px 0 12px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 18px; }

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-light);
}

.btn-close:hover { color: var(--text); }

/* ---- Loading ---- */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 6px;
  color: var(--white);
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-info { background: var(--info); }

/* ---- Save feedback animations ---- */
.save-ok {
  animation: flash-green 1.5s ease;
}

.save-error {
  animation: flash-red 1.5s ease;
}

@keyframes flash-green {
  0% { background-color: inherit; }
  20% { background-color: #c8e6c9; }
  100% { background-color: inherit; }
}

@keyframes flash-red {
  0% { background-color: inherit; }
  20% { background-color: #ffcdd2; }
  100% { background-color: inherit; }
}

/* ---- Print / PDF ---- */
@media print {
  body { background: #fff; }

  #page-login, #page-register, #page-admin, #page-employee-dashboard, #loading, #toast-container { display: none !important; }

  #page-employee { display: block !important; }

  .app-header { box-shadow: none; border-bottom: 2px solid #222; padding: 8px 0 6px; margin-bottom: 12px; }
  .app-header .header-right { display: none; }

  .month-nav .btn-nav, #btn-download-pdf, #btn-logout { display: none; }

  #period-status { margin-bottom: 6px; }

  .main-content { padding: 0; }

  .uren-table { font-size: 11pt; width: 100%; border-collapse: collapse; }
  .uren-table th, .uren-table td { border: 1px solid #aaa; padding: 4px 6px; }
  .uren-table thead { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .uren-table select { display: none; }
  .print-time { display: inline !important; }
  .uren-table input[type="text"] { border: none; background: transparent; padding: 0; }

  .weekend-row td { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .month-total { font-weight: bold; margin-top: 8px; font-size: 12pt; }

  .version-tag { display: none; }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .auth-container { margin: 40px 16px 0; padding: 28px 20px; }
  .main-content { padding: 12px; }
  .month-title { font-size: 17px; min-width: 160px; }
  .app-header { padding: 10px 12px; }
  .uren-table { font-size: 13px; }
  .uren-table th, .uren-table td { padding: 5px 4px; }
  .uren-table input[type="time"] { min-width: 75px; padding: 4px; }
  .admin-table th, .admin-table td { padding: 10px 8px; font-size: 14px; }
  .admin-actions { flex-direction: column; }
  .modal-content { width: 95%; padding: 16px; }
}
