/* styles.css - Stili per l'applicazione di gestione utenti */

/* Reset e stili base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: auto;
}

:root {
  /* Brand Colors */
  --brand-color: #1a4480;
  --brand-color-hover: #153666;
  /* Button Colors */
  --btn-primary-bg: #1a4480;
  --btn-primary-hover: #153666;
  --btn-secondary-bg: #2084c6;
  --btn-secondary-hover: #1a6fa8;
  --btn-danger-bg: #dc3545;
  --btn-danger-hover: #c82333;
  --btn-text-color: #ffffff;
  /* Header & Navigation */
  --header-bg: #ffffff;
  --header-text: #1a4480;
  --sidebar-bg: #ffffff;
  --sidebar-active-bg: #e7f3ff;
  --sidebar-active-border: #10bcc7;
  /* Tables */
  --table-header-bg: #2084c6;
  --table-header-text: #ffffff;
  /* Links */
  --link-color: #2084c6;
  /* Base Colors */
  --primary-color: #10bcc7;
  --tab-active-text: #1a4480;
  --primary-hover: #0da5af;
  --secondary-color: #6c757d;
  --secondary-hover: #5a6268;
  --text-color: #1a4480;
  --background: #f5f5f5;
  --card-background: #ffffff;
  --border-color: #dee2e6;
  /* Status Colors */
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #2084c6;
  --info-color: var(--text-color);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-color);
  line-height: 1.6;
}

a {
  color: var(--link-color);
}

/* Force standard font inheritance for inputs */
input,
select,
textarea,
button {
  font-family: inherit;
}

/* Maintenance Banners */
.maintenance-banner {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 20px;
  color: #721c24;
}

.scheduled-maintenance-banner {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 20px;
  color: #856404;
}

.banner-content {
  flex: 1;
}

.banner-content strong {
  display: block;
  margin-bottom: 4px;
}

.banner-time {
  font-size: 0.9rem;
  margin-top: 8px;
  opacity: 0.9;
}

/* ============= LAYOUT & DASHBOARD ============= */
.dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.header {
  height: 90px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-title-block {
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-logo {
  width: 250px;
  height: auto;
  max-height: 70px;
  object-fit: contain;
  object-position: center;
}

.header-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--brand-color);
  margin: 0;
}


.user-info {
  font-size: 16px;
  color: var(--brand-color);
  font-weight: bold;
}

.logout-btn {
  color: var(--error-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.logout-btn:hover {
  text-decoration: underline;
}

.layout-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  transition: width 0.3s ease, padding 0.3s ease;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-logo {
  text-align: center;
  padding: 5px 15px;
}

.sidebar-logo img {
  width: 80%;
  max-width: 80%;
  max-height: 176px;
  height: auto;
  object-fit: contain;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link::after {
  display: none;
}

.sidebar.collapsed .nav-menu {
  overflow-x: hidden;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .nav-link svg {
  margin-right: 0;
}

.nav-menu {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.nav-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-menu li {
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 6px 20px;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link:hover {
  background-color: #f8f9fa;
  color: var(--brand-color);
}

.nav-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--brand-color);
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  flex-shrink: 0;
}

.nav-link span {
  font-size: 14px;
}

/* Submenu styles */
.nav-menu li.has-submenu>.nav-link::after {
  content: '▼';
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.3s;
  opacity: 0.5;
}

.nav-menu li.has-submenu.open>.nav-link::after {
  transform: rotate(180deg);
}

.submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
  background-color: #f8f9fa;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.submenu.open {
  display: block;
}

.submenu .nav-link {
  padding: 5px 20px 5px 48px;
  font-size: 13px;
  border-left: none;
}

.submenu .nav-link:hover {
  background-color: #e9ecef;
}

.submenu .nav-link.active {
  background-color: #d7eafc;
  font-weight: 600;
  color: var(--brand-color);
}

.menu-toggle {
  position: absolute;
  top: 10px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-toggle svg {
  width: 14px;
  height: 14px;
  color: var(--text-color);
}

.sidebar-footer {
  padding: 8px 20px;
  border-top: 1px solid var(--border-color);
  background: white;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
  margin-top: auto;
}

.sidebar-powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: var(--brand-color);
}

.sidebar-powered-by img {
  height: 22px;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-version {
  font-size: 11px;
  color: #666;
  font-weight: 500;
}

.lang-selector {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lang-flag {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  padding: 2px;
  border-radius: 2px;
  display: inline-flex;
}

.lang-flag:hover {
  opacity: 1;
}

.lang-flag.active {
  opacity: 1;
  outline: 1.5px solid var(--primary-color, #2c3e50);
  outline-offset: 1px;
}

.lang-flag svg {
  width: 20px;
  height: 14px;
}

/* Required field validation */
.field-error,
.field-error:focus {
  border-color: var(--error-color, #dc3545) !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.required-mark {
  color: var(--error-color, #dc3545);
}

/* Modal message bar (between header/tabs and body) */
.modal-message-bar {
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color, #dee2e6);
  padding: 3px 16px;
  flex-shrink: 0;
}

.modal-message-bar > .modal-message-content {
  font-size: 14px;
  font-weight: 500;
  line-height: normal;
}

.modal-message-content.default {
  color: var(--info-color);
}

.modal-message-content.error {
  color: var(--error-color, #dc3545);
}

.modal-message-content.success {
  color: var(--success-color, #28a745);
}

.modal-message-content.warning {
  color: var(--warning-color);
}

.modal-message-content.info {
  color: var(--info-color);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow: hidden;
  background-color: var(--background);
  display: flex;
  flex-direction: column;
}

/* ============= PUBLIC PAGES ============= */
.page-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 10px;
  background: var(--brand-color);
  background-attachment: fixed;
}

.page-card {
  background: var(--card-background);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  width: 100%;
  max-width: 400px;
}

.page-logos {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: nowrap;
}

.page-logo-provider {
  height: 40px;
  width: auto;
}

.page-logo-client {
  height: auto;
  width: 130px;
}

/* Landscape logo (wider than tall): fill the form width */
.page-logo-landscape {
  width: 100%;
  max-width: 100%;
  height: auto;
}

.page-card h1 {
  color: var(--brand-color);
  margin-bottom: 2px;
  font-size: 20px;
  text-align: center;
  line-height: 1.2;
}

.subtitle {
  text-align: center;
  color: var(--brand-color);
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
}

/* Reduce spacing for login page */
.page-card .form-group {
  margin-bottom: 8px;
}

.page-card .btn {
  margin-top: 6px;
}

.page-card .error-message {
  margin-top: 10px;
  /* Fix for stuck message */
}

.forgot-password-link {
  color: var(--link-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.page-powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--brand-color);
}

.page-powered-by img {
  height: 20px;
  vertical-align: middle;
}

.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============= FORM ELEMENTS ============= */
.form-group {
  margin-bottom: 4px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text-color);
}

.form-group.checkbox-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-group.checkbox-group label {
  display: inline;
  margin-bottom: 0;
  cursor: pointer;
  white-space: nowrap;
}

.form-group.checkbox-group input[type="checkbox"] {
  width: auto;
}

.form-row .form-group.checkbox-group {
  align-self: flex-end;
  padding-bottom: 10px;
}

/* Toggle buttons (Yes/No switch) */
.toggle-group {
  display: flex;
  gap: 0;
}

.toggle-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-color, #dee2e6);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-color);
  transition: background 0.15s, color 0.15s;
}

.toggle-btn:first-child {
  border-radius: 4px 0 0 4px;
}

.toggle-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.toggle-btn.active {
  background: var(--brand-color);
  color: #fff;
  border-color: var(--brand-color);
}

.toggle-btn.active + .toggle-btn {
  border-left: 1px solid var(--border-color, #dee2e6);
}

.form-group.inline-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.form-group.inline-label label {
  margin-bottom: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.form-group.inline-label input,
.form-group.inline-label select {
  flex: 1;
  min-width: 0;
}

.form-hint {
  font-size: 13px;
  color: #6c757d;
  margin: 0 0 10px 0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:disabled,
.form-group select:disabled {
  background-color: #e9ecef;
  cursor: not-allowed;
}

.form-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

/* ============= BUTTONS ============= */
.btn {
  padding: 7px 13px;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-text-color);
  width: auto;
  min-width: fit-content;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--btn-primary-hover);
}

.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-text-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--btn-secondary-hover);
}

.btn-danger,
.btn-delete {
  background-color: var(--btn-danger-bg);
  color: var(--btn-text-color);
}

.btn-danger:hover,
.btn-delete:hover {
  background-color: var(--btn-danger-hover);
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  margin: 0 4px;
}

.btn-edit {
  background-color: transparent;
  color: #555;
  padding: 4px;
  line-height: 0;
  border: none;
  vertical-align: middle;
}

.btn-edit:hover {
  background-color: transparent;
  color: #333;
  transform: scale(1.1);
}

.btn-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.btn-clear:hover {
  color: var(--text-color);
  background-color: #f0f0f0;
}

.btn-clear-color {
  background: none;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  margin-left: 4px;
}

.btn-clear-color:hover {
  color: var(--error-color, #dc3545);
}

.button-group {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
}

/* ============= MESSAGES & ALERTS ============= */
.text-danger {
  color: var(--error-color) !important;
}

.error-message,
.message {
  padding: 6px 10px;
  border-radius: 4px;
  margin: 0;
  font-size: 13px;
  min-height: 0;
  box-sizing: border-box;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.error-message:empty,
.message:empty {
  visibility: hidden;
  opacity: 0;
  background-color: transparent;
  border: 1px solid transparent;
}

.error-message,
.message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message.info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-warning {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
}

.alert strong {
  font-weight: 600;
}

.info-box {
  background-color: #e7f3ff;
  border-left: 4px solid var(--primary-color);
  padding: 15px;
  margin-top: 25px;
  border-radius: 6px;
  font-size: 14px;
}

.info-box p {
  margin: 5px 0;
}

.info-box code {
  background-color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  color: var(--error-color);
}

/* Message Bar Container */
.message-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  padding: 0px 24px;
  min-height: 0;
  margin-bottom: 0;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  margin-right: 15px;
}

.message-content.error {
  color: var(--error-color);
}

.message-content.success {
  color: var(--success-color);
}

.message-content.info {
  color: var(--info-color);
}

.message-content.grid-count {
  color: var(--info-color);
}

.message-content.warning {
  color: var(--warning-color);
}

/* Empty state for tables and lists */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted, #6c757d);
}

.empty-state.error {
  color: var(--error-color, #dc3545);
}

.help-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-color);
  text-decoration: none;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
  visibility: visible;
  opacity: 1;
}

.help-icon-link:hover {
  background-color: #e9ecef;
}

.help-icon-link svg {
  width: 24px;
  height: 24px;
}

/* Toast Message */
.message-toast {
  position: fixed;
  top: 90px;
  right: 24px;
  z-index: 1000;
  min-width: 320px;
  max-width: 450px;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideInRight 0.3s ease-out forwards;
  font-weight: 500;
  border-left: 4px solid transparent;
  background-color: white;
}

.message-toast.info {
  background-color: #e3f2fd;
  color: #0c5460;
  border-left-color: #17a2b8;
}

.message-toast.success {
  background-color: #d4edda;
  color: #155724;
  border-left-color: #28a745;
}

.message-toast.warning {
  background-color: #fff3cd;
  color: #856404;
  border-left-color: #ffc107;
}

.message-toast.error {
  background-color: #f8d7da;
  color: #721c24;
  border-left-color: #dc3545;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.6;
  padding: 0;
  color: inherit;
}

@keyframes slideInRight {
  to {
    opacity: 0;
  }
}

/* ============= TABLES ============= */
.table-responsive,
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background-color: var(--table-header-bg);
  color: var(--table-header-text);
  position: sticky;
  top: 0;
  z-index: 10;
}

thead tr:first-child th:first-child {
  border-top-left-radius: 3px;
}

thead tr:first-child th:last-child {
  border-top-right-radius: 3px;
}

th,
td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reduced row height */
#usersTable th,
#usersTable td,
#dataTable th,
#dataTable td,
#logsTable th,
#logsTable td,
#versionsTable th,
#versionsTable td,
.data-table th,
.data-table td {
  padding: 5px 15px;
}

th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* Standardize Data Table Checkboxes */
.data-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  vertical-align: middle;
  margin: 0;
}

.action-col {
  width: 35px;
  /* Fixed narrow width */
  min-width: 35px;
  max-width: 35px;
  text-align: center;
  padding: 0;
  /* minimal padding */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  /* Prevent dots */
}

th.checkbox-col,
td.checkbox-col {
  width: 35px;
  min-width: 35px;
  max-width: 35px;
  text-align: center;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  /* Prevent dots */
}

.controls-col .btn-edit {
  margin-right: 2px;
}


/* BRAND UTILITIES */
.bg-brand-secondary {
  background-color: var(--btn-secondary-bg) !important;
  color: var(--btn-text-color) !important;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 30px;
  transition: background-color 0.2s;
  position: relative;
}

th.sortable:hover {
  background-color: #0056b3;
}

.sort-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  opacity: 0.3;
}

/* Sort icon arrows */
.sort-icon::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid white;
  left: -5px;
  top: -8px;
}

.sort-icon::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid white;
  left: -5px;
  top: 3px;
}

th.sort-asc .sort-icon::before {
  opacity: 1;
  border-bottom-color: white;
}

th.sort-asc .sort-icon::after {
  opacity: 0.3;
}

th.sort-desc .sort-icon::before {
  opacity: 0.3;
}

th.sort-desc .sort-icon::after {
  opacity: 1;
  border-top-color: white;
}

th.sortable .sort-icon {
  opacity: 1;
}

tbody tr {
  transition: background-color 0.2s;
}

tbody tr:hover {
  background-color: #f8f9fa;
}

/* Row Highlighting */
.row-hidden {
  background-color: #f8f9fa !important;
  opacity: 0.7;
}

.row-hidden:hover {
  background-color: #e9ecef !important;
  opacity: 1;
}

.row-excluded {
  background-color: #ffe6e6 !important;
}

.row-excluded:hover {
  background-color: #ffd4d4 !important;
}

.row-hidden td,
.row-excluded td {
  color: #333 !important;
}

/* ============= SECTIONS ============= */
.users-table-section,
.content-card {
  background: white;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 10px;
  margin-bottom: 10px;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.inner-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
}

.form-section {
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.form-section-title {
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0;
  margin: 0 0 12px 0;
  color: var(--brand-color);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  flex-wrap: wrap;
  gap: 15px;
}

.section-header h2 {
  margin: 0;
  color: var(--brand-color);
  font-size: 1.5rem;
}

.search-bar {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  /* Right padding increased for clear button, Left for icon */
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #adb5bd;
}

/* ============= FILTERS ============= */
.filters-section {
  background: white;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 10px;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  align-items: end;
}

.filters-section.flex {
  display: flex;
  align-items: center;
  gap: 20px;
  grid-template-columns: none;
}

.filters-section.flex .filter-group {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.filters-section.block {
  display: block;
  grid-template-columns: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
}

.filter-input {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  transition: border-color 0.15s;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: 10px;
}

.results-counter {
  margin-top: 15px;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
}

/* ============= SINGLE LINE FILTERS (Strict Layout) ============= */
/* ============= SINGLE LINE FILTERS (Strict Layout) ============= */
.filters-section-layout {
  display: flex !important;
  gap: 15px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Fix for Search Bar size: 
   Default .search-bar has 'flex: 1' which causes issue in this flex row context.
   We reset it to respect its content/max-width behavior. */
.filters-section-layout .search-bar {
  flex: 0 0 auto;
  width: 100%;
  /* Will stop at max-width: 400px defined in .search-bar */
}

.filters-section-layout .filter-group-row {
  flex-shrink: 0;
}


.filter-group-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.filter-label {
  font-size: 13px;
  color: #666;
  font-weight: 500;
  margin-right: 4px;
}

/* ============= MODALS ============= */
.modal,
.modal-overlay {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Force Flex when Style is set to Block by legacy JS - NOT WORKING
   We must ensure JS uses 'flex' or we use a workaround */
.modal[style*="display: block"] {
  display: flex !important;
}

.modal-content {
  background-color: var(--card-background);
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--brand-color);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 5px;
  padding: 6px 10px 0;
  gap: 2px;
}

.modal-tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-color);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  transition: color 0.2s, background 0.2s;
}

.modal-tab:hover {
  color: #334155;
  background: #f1f5f9;
}

.modal-tab.active {
  color: var(--tab-active-text);
  background: #fff;
  border-color: var(--border-color);
  border-bottom: 1px solid #fff;
  font-weight: 600;
}

.modal-tab.disabled {
  color: #ccc;
  cursor: not-allowed;
  pointer-events: none;
}

/* Modals with tabs: fixed height so switching tabs doesn't resize the modal */
.modal-content:has(.modal-tabs) {
  height: 85vh;
  max-width: 850px;
}
.modal-content:has(.modal-tabs) .modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.modal-content:has(.modal-tabs) .tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.tab-content {
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 5px;
}

.tab-content.active {
  display: block;
}


.close,
.modal-close {
  font-size: 24px;
  font-weight: bold;
  color: #adb5bd;
  cursor: pointer;
  line-height: 1;
}

.close:hover,
.modal-close:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 12px;
}

/* ============= SETTINGS DROPDOWN ============= */
.settings-dropdown {
  position: relative;
  display: inline-block;
}

.settings-dropdown #settingsBtn {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--brand-color);
  transition: opacity 0.2s;
}

.settings-dropdown #settingsBtn:hover {
  opacity: 0.8;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1100;
  overflow: hidden;
  display: none;
}

.dropdown-item {
  display: block;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s;
  font-weight: normal;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

.dropdown-divider {
  height: 1px;
  background-color: #e9ecef;
  margin: 8px 0;
}

/* ============= PAGE SPECIFIC ============= */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h2 {
  margin: 0;
  color: var(--brand-color);
  font-size: 1.75rem;
  font-weight: 600;
}

.page-description {
  color: var(--secondary-color);
  margin-top: 8px;
  font-size: 0.95rem;
  max-width: 800px;
}

.page-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.page-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 71px;
    height: calc(100vh - 71px);
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  }

  .sidebar.collapsed {
    transform: translateX(-250px);
  }

  .main-content {
    padding: 20px 15px;
  }

  .header {
    padding: 15px 20px;
  }

  .header h1 {
    font-size: 20px;
  }

  .form-row {
    flex-direction: column;
  }

  .btn-small {
    display: block;
    margin: 4px 0;
    width: 100%;
  }
}

.btn-menu {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  border-radius: 6px;
  transition: background-color 0.2s, color 0.2s;
  margin: 0 10px 0 auto;
  width: 40px;
}

.btn-menu:hover {
  background-color: #f8f9fa;
  color: var(--brand-color);
}

.sidebar.collapsed .btn-menu {
  margin: 0 auto;
}

.sidebar.collapsed .btn-menu svg {
  transform: rotate(180deg);
}

/* content-padding replaced by standard-page-content */

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s, background-color 0.3s;
  background: #fdfdfd;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary-color);
  background: #f0f8ff;
}

/* Active Row Highlight */
.row-active {
  background-color: color-mix(in srgb, var(--btn-primary-bg), transparent 80%) !important;
  color: var(--brand-color) !important;
}

.row-active td,
.row-active strong,
.row-active small,
.row-active code,
.row-active svg {
  color: var(--brand-color) !important;
}

/* BRAND UTILITIES */
.bg-brand-secondary {
  background-color: var(--btn-secondary-bg) !important;
  color: var(--btn-text-color) !important;
}

/* Standard Page Content Wrapper */
.standard-page-content {
  padding: 0 10px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.standard-page-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 10px;
}

/* Home page: cards should NOT stretch — let the page scroll */
.standard-page-body > #communicationBanner,
.standard-page-body > #competitionCard {
  flex: none;
  overflow: visible;
}
/* When competition card is hidden, banner fills available height */
.standard-page-body:has(> #competitionCard[style*="display: none"]) {
  flex: 1;
}
.standard-page-body:has(> #competitionCard[style*="display: none"]) > #communicationBanner {
  flex: 1;
}

/* ============= UI COMPONENTS ============= */

/* --- Segmented Control (View Switcher - Global) --- */
.view-switcher-control {
  background-color: #f1f3f5;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  gap: 4px;
  border: 1px solid #e9ecef;
}

/* When view switcher is inside action row, push it left */
.filter-actions .view-switcher-control {
  margin-right: auto;
}

.view-switcher-btn {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.view-switcher-btn:hover {
  color: #212529;
}

.view-switcher-btn.active {
  background-color: #ffffff;
  color: #007bff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* 3-Column Form Layout */
.form-group.third {
  width: 32%;
}

/* ============= LOGS LOADING ============= */
.loading-sentinel {
  height: 20px;
  margin: 10px 0;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s;
  font-style: italic;
  color: #888;
}

.loading-sentinel.visible {
  opacity: 1;
}

/* ============= SELECTION CARDS ============= */
/* Generic selectable card grid — used for competition calendar, etc. */

/* Allow box-shadow overflow on selected cards */
/* ============= COMMUNICATION BANNER (home page) ============= */
#communicationBanner {
  padding: 20px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-color, #1e293b);
  margin-bottom: 16px;
}

#communicationBanner h1,
#communicationBanner h2,
#communicationBanner h3 {
  color: var(--brand-color, #1a4480);
  margin: 0 0 14px 0;
}

#communicationBanner h2 { font-size: 1.6rem; }
#communicationBanner h3 { font-size: 1.3rem; }
#communicationBanner p { margin: 0 0 10px 0; }

#communicationBanner ul,
#communicationBanner ol {
  margin: 0 0 10px 0;
  padding-left: 24px;
}

#communicationBanner li { margin-bottom: 4px; }
#communicationBanner li p { margin: 0; }

#communicationBanner blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--brand-color, #1a4480);
  background: #f8f9fa;
  border-radius: 0 4px 4px 0;
}

#communicationBanner blockquote p { margin: 0; }
#communicationBanner a { color: var(--link-color, #2084c6); }
#communicationBanner img { max-width: 100%; height: auto; }

/* Communication layout in Maintenance (editor left, photo right) */
.communication-layout {
  display: flex;
  gap: 20px;
}
.communication-editor-col {
  flex: 1;
  min-width: 0;
}
.communication-photo-col {
  width: 300px;
  flex-shrink: 0;
}

/* Home page photo inside communication banner */
.home-photo {
  text-align: center;
  margin-bottom: 16px;
}
.home-photo img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
.home-communication + .home-photo {
  margin-top: 16px;
  margin-bottom: 0;
}
/* Left/Right layout for photo + communication */
.home-layout-horizontal {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.home-layout-horizontal .home-photo {
  flex-shrink: 0;
  width: 40%;
  margin-bottom: 0;
}
.home-layout-horizontal .home-communication {
  flex: 1;
  min-width: 0;
}
/* Background photo mode */
#communicationBanner.home-bg-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  min-height: 300px;
}
#communicationBanner.home-bg-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 30%, rgba(255, 255, 255, 0.4) 60%, rgba(255, 255, 255, 0) 100%);
  border-radius: inherit;
}
#communicationBanner.home-bg-photo > .home-communication {
  position: relative;
  z-index: 1;
  width: 50%;
}

/* Photo preview in Maintenance */
.photo-preview-container {
  min-height: 80px;
  border: 2px dashed var(--border-color, #dee2e6);
  border-radius: 4px;
  padding: 8px;
  text-align: center;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-preview-container.has-photo {
  border-style: solid;
}
.photo-preview-container.drag-over {
  border-color: var(--brand-color, #2084c6);
  background: rgba(32, 132, 198, 0.05);
}
.photo-preview-container img {
  max-height: 200px;
  max-width: 100%;
  border-radius: 4px;
}
.photo-placeholder {
  color: #999;
  font-size: 13px;
}
.form-actions-inline {
  display: flex;
  gap: 8px;
}

.content-card:has(.selection-grid) {
  overflow: visible;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 360px));
  gap: 16px;
  padding: 16px;
  justify-content: start;
  width: 100%;
  box-sizing: border-box;
}

.selection-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}

.selection-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-color, #1a73e8);
}

.selection-card.selection-card-selected {
  border-color: var(--primary-color, #1a73e8);
  border-width: 2px;
  background: #e8f0fe;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
}

.selection-card-logo {
  text-align: center;
  margin-bottom: 8px;
}

.selection-card-logo img {
  max-height: 80px;
  max-width: 100%;
  object-fit: contain;
}

.selection-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color, #333);
  margin: 0 0 4px 0;
  text-transform: uppercase;
  text-align: center;
}

.selection-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted, #6c757d);
  margin: 0 0 6px 0;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
}

.selection-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted, #6c757d);
}

.selection-card-meta-year {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted, #6c757d);
}

.selection-card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.selection-card-meta-item svg {
  flex-shrink: 0;
}

.selection-card-subtitle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted, #6c757d);
  margin-top: 4px;
}

.selection-card-subtitle svg {
  flex-shrink: 0;
}

.selection-card-edit-btn {
  position: absolute;
  bottom: 10px;
  left: 12px;
  background: none;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  color: var(--text-muted, #6c757d);
  display: flex;
  align-items: center;
  transition: color 0.2s, border-color 0.2s;
}

.selection-card-edit-btn:hover {
  color: var(--primary-color, #1a73e8);
  border-color: var(--primary-color, #1a73e8);
}

.selection-card-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  justify-content: flex-end;
}

/* ============= ACTION GRID ============= */
/* Generic action button grid — used for quick actions, etc. */

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: var(--text-color, #333);
  font-size: 0.9rem;
  font-weight: 500;
}

.action-btn:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border-color: var(--primary-color, #1a73e8);
}

.action-btn svg {
  flex-shrink: 0;
  color: var(--primary-color, #1a73e8);
  stroke: var(--primary-color, #1a73e8);
}

@media (max-width: 700px) {
  .selection-grid {
    grid-template-columns: 1fr;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }
}

/* URL Copy Wrapper */
.url-copy-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.url-copy-wrapper input {
  flex: 1;
}

.url-copy-wrapper .btn {
  flex-shrink: 0;
  padding: 8px 10px;
}

/* Modal Footer Actions (inline buttons) */
.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
}

/* QR Code Display */
#qrCodeDisplay {
  text-align: center;
  padding: 16px 0;
}

#qrCodeDisplay img {
  max-width: 200px;
  image-rendering: pixelated;
}

/* Form help text */
.form-help-text {
  color: var(--text-color);
  opacity: 0.65;
  font-size: 13px;
  margin-bottom: 16px;
}

.form-group .form-help-text {
  margin-top: 4px;
  margin-bottom: 0;
}

/* Form section instructions */
.form-section-instructions {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-color);
  opacity: 0.8;
}

.form-section-instructions p {
  margin: 0 0 8px 0;
}

.form-section-instructions ol {
  margin: 0;
  padding-left: 20px;
}

.form-section-instructions li {
  margin-bottom: 4px;
}

.form-section-instructions a {
  color: var(--link-color, #2084c6);
}

.form-section-instructions code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}