/* Modern UI styles for Stoði - Nemendakerfi */
:root {
  --primary-color: #4361ee;
  --primary-dark: #3a56d4;
  --secondary-color: #4f5d75;
  --success-color: #06d6a0;
  --info-color: #3a86ff;
  --warning-color: #ffd166;
  --danger-color: #ef476f;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-800: #343a40;
  --body-bg: #f5f7fa;
  --card-border-radius: 0.75rem;
  --btn-border-radius: 0.5rem;
  --transition-speed: 0.2s;
}

body {
  background-color: var(--body-bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
}

/* Navigation styling */
.navbar {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.075);
  padding: 0.75rem 1rem;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.5px;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 0.35rem;
  transition: all var(--transition-speed) ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Card styling */
.card {
  border: none;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.05);
  border-radius: var(--card-border-radius);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.card-header {
  border-bottom: 1px solid var(--gray-200);
  background-color: white;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

.card-header.bg-primary {
  background: var(--primary-color) !important;
  color: white;
}

.card-header.bg-info {
  background: var(--info-color) !important;
  color: white;
}

.card-header.bg-secondary {
  background: var(--secondary-color) !important;
  color: white;
}

/* Table styling */
.table {
  margin-bottom: 0;
  table-layout: auto;
  width: 100%;
}

.table th {
  font-weight: 600;
  background-color: var(--gray-100);
  border-top: none;
  border-bottom-width: 1px;
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table td {
  padding: 0.75rem 0.5rem;
  vertical-align: top;
  word-wrap: break-word;
  max-width: 0;
  overflow: visible;
}

/* Specific column widths */
.table th:nth-child(1), .table td:nth-child(1) { /* Nafn */
  width: 10%;
  min-width: 120px;
}

.table th:nth-child(2), .table td:nth-child(2) { /* Árgangur */
  width: 6%;
  min-width: 70px;
  text-align: center;
}

.table th:nth-child(3), .table td:nth-child(3) { /* Skóli (if super admin) */
  width: 8%;
  min-width: 80px;
}

.table th:nth-child(4), .table td:nth-child(4) { /* Tögg */
  width: 15%;
  min-width: 150px;
}

.table th:nth-child(5), .table td:nth-child(5) { /* Tvítyngi */
  width: 8%;
  min-width: 90px;
}

.table th:nth-child(6), .table td:nth-child(6) { /* Heilsufar */
  width: 8%;
  min-width: 90px;
}

.table th:nth-child(7), .table td:nth-child(7) { /* Mál í vinnslu */
  width: 20%;
  min-width: 200px;
}

.table th:nth-child(8), .table td:nth-child(8) { /* Annað */
  width: 18%;
  min-width: 180px;
}

.table th:last-child, .table td:last-child { /* Aðgerðir */
  width: 7%;
  min-width: 100px;
  text-align: center;
}

.table-hover tbody tr:hover {
  background-color: rgba(67, 97, 238, 0.04);
}

.table-responsive {
  border-radius: 0.5rem;
  overflow-x: auto;
  min-height: 200px;
}

/* Better text handling in table cells */
.table td {
  line-height: 1.4;
  font-size: 0.9rem;
}

.table td small {
  display: block;
  margin-top: 0.25rem;
  color: var(--gray-500);
}

/* Tag display in table */
.table td .badge-tag {
  font-size: 0.75rem;
  margin: 0.125rem 0.25rem 0.125rem 0;
  padding: 0.25rem 0.5rem;
}

/* Tooltip for truncated text */
.text-truncate-hover {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Form controls */
.form-control,
.form-select {
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-color: var(--gray-300);
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* Compact filter controls */
.card-body .form-control,
.card-body .form-select {
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
}

.card-body .form-label {
  font-size: 0.8125rem;
  margin-bottom: 0.375rem;
  font-weight: 500;
}

/* Fix button alignment in filter form */
.filter-button-container {
  display: flex;
  align-items: end;
  height: 100%;
}

.filter-button-container .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Make filter card more compact */
.card.mb-4 .card-body {
  padding: 1rem;
}

.card.mb-4 .row.g-3 {
  margin-bottom: 0;
}

.card.mb-4 .row.g-3 > * {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-800);
}

.form-text {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Button styling */
.btn {
  border-radius: var(--btn-border-radius);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all var(--transition-speed) ease;
}

.btn-sm {
  border-radius: 0.4rem;
  padding: 0.25rem 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--gray-500);
  border-color: var(--gray-500);
}

.btn-info {
  background-color: var(--info-color);
  border-color: var(--info-color);
}

.btn-success {
  background-color: var(--success-color);
  border-color: var(--success-color);
}

.btn-warning {
  background-color: var(--warning-color);
  border-color: var(--warning-color);
}

.btn-danger {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Alert styling */
.alert {
  border: none;
  border-radius: var(--card-border-radius);
  padding: 1rem 1.25rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  margin-bottom: 1.5rem;
}

.alert-dismissible .btn-close {
  padding: 1.25rem;
}

.alert-primary {
  background-color: rgba(67, 97, 238, 0.1);
  color: var(--primary-dark);
}

.alert-info {
  background-color: rgba(58, 134, 255, 0.1);
  color: #2970d9;
}

.alert-success {
  background-color: rgba(6, 214, 160, 0.1);
  color: #05b384;
}

.alert-warning {
  background-color: rgba(255, 209, 102, 0.1);
  color: #e6bc5a;
}

.alert-danger {
  background-color: rgba(239, 71, 111, 0.1);
  color: #d6395d;
}

/* Badge styling */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
  border-radius: 0.35rem;
}

.badge.bg-primary {
  background-color: var(--primary-color) !important;
}

.badge.bg-secondary {
  background-color: var(--secondary-color) !important;
}

.badge.bg-success {
  background-color: var(--success-color) !important;
}

.badge.bg-info {
  background-color: var(--info-color) !important;
}

.badge.bg-warning {
  background-color: var(--warning-color) !important;
  color: var(--dark-color) !important;
}

.badge.bg-danger {
  background-color: var(--danger-color) !important;
}

/* List group styling */
.list-group-item {
  border-color: var(--gray-200);
  padding: 0.75rem 1.25rem;
}

.list-group-item:first-child {
  border-top-left-radius: var(--card-border-radius);
  border-top-right-radius: var(--card-border-radius);
}

.list-group-item:last-child {
  border-bottom-left-radius: var(--card-border-radius);
  border-bottom-right-radius: var(--card-border-radius);
}

/* Student card styling */
.student-card {
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  border-radius: var(--card-border-radius);
  overflow: hidden;
}

.student-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

/* Footer styling */
footer {
  color: var(--gray-500);
  font-size: 0.875rem;
  border-top: 1px solid var(--gray-200);
  margin-top: 2rem !important;
}

/* Select2 styling */
.select2-container--default .select2-selection--multiple {
  border-color: var(--gray-300) !important;
  border-radius: 0.5rem !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25) !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--primary-color) !important;
  color: white !important;
  border: none !important;
  border-radius: 0.35rem !important;
  padding: 0.2rem 0.4rem !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: white !important;
  margin-right: 0.25rem !important;
}

/* Custom tag styling */
.badge-tag {
  font-size: 85%;
  font-weight: 500;
  padding: 0.35em 0.65em;
  margin-right: 0.3em;
  margin-bottom: 0.3em;
  border-radius: 0.35rem;
  background-color: var(--primary-color);
  color: white;
  display: inline-block;
}

/* Custom utility classes */
.cursor-pointer {
  cursor: pointer;
}

/* Responsive layout improvements */
@media (max-width: 767.98px) {
  .card-body {
    padding: 1rem;
  }
  
  .table td, .table th {
    padding: 0.625rem 0.75rem;
  }
  
  .btn {
    padding: 0.375rem 0.75rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
}