/* Module Common Styles
 * Shared styles for all modules
 * Keep module-specific overrides in individual module stylesheets
 */

/* Toggle Switch Component */
.toggle-switch {
  position: relative;
  width: 32px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  flex-grow: 0;
}
.toggle-switch.active {
  background: #4caf50;
}
.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.toggle-switch.active .toggle-slider {
  transform: translateX(14px);
}
.toggle-switch:hover {
  background: rgba(255, 255, 255, 0.15);
}
.toggle-switch.active:hover {
  background: #66bb6a;
}
.toggle-switch-input {
  display: none;
}

/* Permission Grid Layout */
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.permission-category-card {
  padding: 16px;
  min-width: 320px;
}
.permission-category-card-full-width {
  grid-column: 1 / -1;
}
.settings-sub-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.settings-sub-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}
.permission-category-title {
  margin: 0 0 12px 0;
  font-size: 1em;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.permissions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.permission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  white-space: nowrap;
  width: 100%;
  overflow: hidden;
}
.permission-label {
  font-weight: 500;
  font-size: 0.9em;
  white-space: nowrap;
  flex: 1 1 0;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.permission-toggle-label {
  display: block;
  cursor: pointer;
  flex-shrink: 0;
  flex-grow: 0;
  margin: 0;
  padding: 0;
  line-height: 0;
}

/* Roles Page Layout */
.roles-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) {
  .roles-layout {
    grid-template-columns: 1fr;
  }
}

/* Action Buttons Container */
.action-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.form-inline {
  display: inline;
  margin: 0;
  padding: 0;
}

/* Roles Table Responsive */
@media (max-width: 768px) {
  /* Hide less important columns on mobile */
  #roles-table .col-role-description,
  #roles-table .col-role-users-list,
  #roles-table .col-role-level,
  #roles-table .col-role-users,
  #roles-table .col-role-permissions {
    display: none;
  }
  
  /* Show counts under role name on mobile */
  #roles-table .role-counts-mobile {
    display: block !important;
  }
  
  /* Make table fit mobile width */
  #roles-table {
    table-layout: auto !important;
    width: 100% !important;
  }
  
  #roles-table thead th,
  #roles-table tbody td {
    width: auto !important;
    padding: 8px 4px;
    font-size: 0.9em;
  }
  
  /* Name column - allow wrapping */
  #roles-table thead th:first-child,
  #roles-table tbody td:first-child {
    min-width: 120px;
    max-width: 60%;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal !important;
  }
  
  /* Actions column - stack buttons vertically */
  #roles-table tbody td:last-child {
    min-width: 100px;
  }
  
  #roles-table .action-buttons {
    flex-direction: row;
    gap: 2px;
    align-items: stretch;
  }
  
  #roles-table .action-buttons .btn,
  #roles-table .action-buttons .form-inline {
    flex: 1 1 0;
    min-width: 0;
  }
  
  #roles-table .action-buttons .form-inline .btn {
    width: 100%;
  }
  
  #roles-table .action-buttons .btn {
    width: 100%;
    text-align: center;
    padding: 2px 6px !important;
    font-size: 10px !important;
    min-height: 24px !important;
    line-height: 1.2 !important;
  }
  
  #roles-table .action-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  /* Adjust table wrapper for mobile */
  .table-wrapper {
    margin-left: -18px;
    margin-right: -18px;
    padding: 0;
  }
}

/* Status Messages */
.card-success {
  background: rgba(76, 175, 80, 0.1);
  border-color: #4caf50;
  margin-bottom: 16px;
}
.card-error {
  background: rgba(197, 75, 75, 0.1);
  border-color: #c54b4b;
  margin-bottom: 16px;
}
.card-warning-bg {
  background: #2a1a1a;
  border-color: #d32f2f;
  color: #ffcdd2;
  margin-bottom: 16px;
}
.card-success-bg {
  background: #1a2a1a;
  border-color: #4caf50;
  color: #c8e6c9;
  margin-bottom: 16px;
}

/* System Role Notice */
.system-role-notice {
  padding: 12px;
  background: #1a1a1a;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* Section Dividers */
.section-divider {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* KPI Flex Layouts */
.kpi-flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}
.kpi-content {
  min-height: 2.5em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.kpi-content-padded {
  min-height: 2.5em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0 4px;
}

/* Status Breakdown Items */
.status-breakdown {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.85em;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.status-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: all 0.2s ease;
  min-width: 150px;
  width: 150px;
  text-decoration: none;
  color: inherit;
}
.status-breakdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.status-breakdown-item--auto {
  width: auto;
  min-width: fit-content;
}
.status-breakdown-active {
  background: rgba(77, 163, 255, 0.15);
  border-color: rgba(77, 163, 255, 0.3);
}

/* Navigation User Menu */
.nav-user-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Help Page Dividers */
.help-divider-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.help-divider-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* EOL Display Components - moved to dates.css */

