* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

body.page-layout {
  align-items: flex-start;
}

.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px;
  width: 100%;
  max-width: 500px;
}

.container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.container .card {
  max-width: 100%;
  margin-bottom: 20px;
}

/* Logo */
.logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo svg {
  width: 48px;
  height: 48px;
  fill: white;
}

/* Typography */
h1 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 24px;
  text-align: center;
}

h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 18px;
}

.subtitle {
  color: #666;
  margin: 0 0 32px 0;
  font-size: 14px;
  text-align: center;
}

/* Header bar */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header h1 {
  text-align: left;
}

.nav-btns {
  display: flex;
  gap: 8px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  font-size: 14px;
}

input, select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e1e1e1;
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Buttons */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  padding: 10px 16px;
  font-size: 14px;
}

.btn-secondary:hover {
  background: #eee;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-microsoft {
  width: 100%;
  background: #ffffff;
  color: #333;
  border: 2px solid #e1e1e1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
}

.btn-microsoft:hover {
  border-color: #0078d4;
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 120, 212, 0.2);
}

.btn-microsoft svg {
  width: 20px;
  height: 20px;
}

/* Messages */
.message {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
}

.message.error {
  display: block;
  background: #fdeaea;
  color: #c0392b;
}

.message.success {
  display: block;
  background: #eafde7;
  color: #27ae60;
}

/* User info bar */
.user-info {
  color: #666;
  font-size: 14px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

th {
  font-weight: 600;
  color: #666;
  font-size: 12px;
  text-transform: uppercase;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-admin {
  background: #667eea;
  color: white;
}

.badge-user {
  background: #eee;
  color: #666;
}

.empty {
  text-align: center;
  color: #999;
  padding: 40px;
}

/* Language picker */
#langPicker {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  font-family: system-ui, -apple-system, sans-serif;
}

#langToggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: box-shadow 0.2s;
}

#langToggle:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

#langFlag svg {
  display: block;
  border-radius: 2px;
}

#langDropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  overflow: hidden;
  min-width: 90px;
}

#langDropdown.open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  text-align: left;
  transition: background 0.15s;
}

.lang-option:hover {
  background: #f5f5f5;
}

.lang-option.active {
  background: #f0f0ff;
  color: #667eea;
}

.opt-flag svg {
  display: block;
  border-radius: 2px;
}

/* Hide lang picker while a lightbox is open */
body.lb-open #langPicker { display: none; }

/* ── Mobile ── */
@media (max-width: 560px) {
  body {
    padding: 0;
    align-items: stretch;
  }
  body.page-layout {
    align-items: stretch;
  }
  .card {
    border-radius: 0;
    box-shadow: none;
    padding: 62px 18px 24px; /* top pad clears the fixed language picker */
    min-height: 100dvh;
  }
  .container {
    padding: 0;
  }
  .container .card {
    border-radius: 0;
    margin-bottom: 0;
    min-height: auto;
    padding-top: 62px;
  }
  h1 { font-size: 20px; }
  .header { margin-bottom: 18px; }
  .btn-secondary {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Lightbox arrows move to the bottom centre for thumb reach */
  .lb-prev {
    top: auto; bottom: 24px;
    left: calc(50% - 56px);
    transform: none;
  }
  .lb-next {
    top: auto; bottom: 24px;
    right: auto; left: calc(50% + 12px);
    transform: none;
  }
  .lb-counter { bottom: 82px; }
}
