* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 30px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

h1 {
  color: #333;
  font-size: 28px;
  font-weight: 600;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-edit {
  background: #10b981;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-edit:hover {
  background: #059669;
}

.btn-delete {
  background: #ef4444;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-delete:hover {
  background: #dc2626;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #667eea;
  font-size: 18px;
  font-weight: 500;
}

.error {
  background: #fee;
  color: #c33;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  border-left: 4px solid #c33;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  border-left: 4px solid #28a745;
  animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #f8f9fa;
}

th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #dee2e6;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  font-size: 14px;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: #f8f9fa;
}

.actions {
  display: flex;
  gap: 8px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 20px 0;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 15px;
}

.page-info {
  color: #666;
  font-size: 14px;
}

.pagination-buttons {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pagination-btn {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  background: white;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  min-width: 40px;
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background: #f8f9fa;
  border-color: #667eea;
  color: #667eea;
}

.pagination-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.pagination-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-dots {
  padding: 0 5px;
  color: #999;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-small {
  max-width: 350px;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 {
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.close {
  color: #aaa;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
}

.close:hover {
  color: #333;
}

form {
  padding: 20px;
}

.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
}

input {
  width: 100%;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input.invalid {
  border-color: #ef4444;
}

.error-message {
  display: block;
  color: #ef4444;
  font-size: 12px;
  margin-top: 5px;
  min-height: 18px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    padding: 25px;
  }

  h1 {
    font-size: 26px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 15px;
    border-radius: 8px;
  }

  header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
    margin-bottom: 20px;
  }

  header h1 {
    text-align: center;
  }

  h1 {
    font-size: 22px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px;
    padding: 0 15px;
  }

  table {
    font-size: 12px;
    min-width: 700px;
  }

  th,
  td {
    padding: 10px 8px;
    white-space: nowrap;
  }

  .actions {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .btn-edit,
  .btn-delete {
    padding: 5px 10px;
    font-size: 11px;
  }

  .modal-content {
    width: 95%;
    margin: 5% auto;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-info {
    text-align: center;
  }

  .pagination-buttons {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination-btn {
    padding: 6px 10px;
    min-width: 35px;
    font-size: 13px;
  }

  form {
    padding: 15px;
  }

  .modal-header {
    padding: 12px 15px;
  }

  .modal-header h2 {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 20px;
  }

  table {
    font-size: 11px;
    min-width: 650px;
  }

  th,
  td {
    padding: 8px 6px;
  }

  .btn-edit,
  .btn-delete {
    padding: 4px 8px;
    font-size: 10px;
  }

  .pagination-btn {
    padding: 5px 8px;
    min-width: 30px;
    font-size: 12px;
  }

  input {
    padding: 8px;
    font-size: 13px;
  }

  label {
    font-size: 13px;
  }

  .form-group {
    margin-bottom: 10px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .modal-content {
    margin: 2% auto;
    max-height: 95vh;
  }

  .container {
    padding: 15px;
  }

  header {
    margin-bottom: 15px;
  }
}
