/* ============================================
   COMPLETE RESPONSIVE REDESIGN - MOBILE FIRST
   Professional, Modern, Fully Responsive UI
   ============================================ */

:root {
  /* Color Palette - Professional & Modern */
  --primary: #3b82f6;
  --primary-dark: #1e40af;
  --primary-light: #eff6ff;
  --accent: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Neutrals */
  --bg: #ffffff;
  --surface: #f9fafb;
  --surface-dark: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;

  /* Spacing & Radius */
  --radius: 10px;
  --radius-sm: 6px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* ============================================
   CONTAINER - RESPONSIVE PADDING
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

@media (min-width: 480px) {
  .container {
    padding: 0 14px;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 16px;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 20px;
  }
}

/* ============================================
   HEADER - COMPACT & RESPONSIVE
   ============================================ */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 8px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.site-header .container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

.site-subtitle {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
}

@media (min-width: 480px) {
  .site-header {
    padding: 9px 0;
  }

  .site-header .container {
    gap: 7px;
  }

  .site-title {
    font-size: 18px;
  }

  .site-subtitle {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .site-header {
    padding: 10px 0;
  }

  .site-title {
    font-size: 22px;
  }

  .site-subtitle {
    font-size: 13px;
  }
}

@media (min-width: 1024px) {
  .site-header {
    padding: 12px 0;
  }

  .site-title {
    font-size: 26px;
  }

  .site-subtitle {
    font-size: 14px;
  }
}

/* ============================================
   NAVIGATION - RESPONSIVE & MOBILE-FRIENDLY
   ============================================ */
.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 11px;
  transition: all 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.nav-link:active {
  transform: translateY(0);
}

@media (min-width: 480px) {
  .nav-link {
    padding: 8px 12px;
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .nav-link {
    padding: 9px 14px;
    font-size: 13px;
  }
}

@media (min-width: 1024px) {
  .nav-link {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* ============================================
   MAIN CONTENT - RESPONSIVE LAYOUT
   ============================================ */
.main-content {
  padding: 12px 0;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  width: 100%;
}

@media (min-width: 480px) {
  .main-content {
    padding: 14px 0;
    gap: 16px;
  }
}

@media (min-width: 768px) {
  .main-content {
    padding: 16px 0;
    gap: 18px;
  }
}

@media (min-width: 1024px) {
  .main-content {
    padding: 18px 0;
    gap: 20px;
    grid-template-columns: 1fr 1.2fr;
  }

  .card-register {
    grid-column: 1;
  }

  .card-records {
    grid-column: 2;
    grid-row: 1;
  }
}

/* ============================================
   CARDS - RESPONSIVE & PROFESSIONAL
   ============================================ */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  width: 100%;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

@media (min-width: 480px) {
  .card {
    padding: 16px;
  }
}

@media (min-width: 768px) {
  .card {
    padding: 18px;
  }
}

@media (min-width: 1024px) {
  .card {
    padding: 20px;
  }
}

.card-header {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--surface-dark);
}

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 3px 0;
  color: var(--text);
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

@media (min-width: 480px) {
  .card-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .card-header h2 {
    font-size: 18px;
  }

  .card-subtitle {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .card-header h2 {
    font-size: 20px;
  }

  .card-subtitle {
    font-size: 13px;
  }
}

@media (min-width: 1024px) {
  .card-header h2 {
    font-size: 22px;
  }

  .card-subtitle {
    font-size: 14px;
  }
}

/* ============================================
   FORM - RESPONSIVE GRID
   ============================================ */
.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .form-grid {
    gap: 13px;
  }
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (min-width: 1024px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (min-width: 1400px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

/* ============================================
   FORM FIELDS - RESPONSIVE
   ============================================ */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

label {
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 3px;
}

.required {
  color: var(--danger);
  font-weight: 700;
}

@media (min-width: 480px) {
  label {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  label {
    font-size: 13px;
  }
}

@media (min-width: 1024px) {
  label {
    font-size: 14px;
  }
}

/* ============================================
   INPUT WRAPPER - RESPONSIVE
   ============================================ */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: all 0.3s ease;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--surface);
}

input::placeholder {
  color: #d1d5db;
}

.input-icon {
  position: absolute;
  left: 8px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.7;
}

.help {
  font-size: 10px;
  color: var(--text-muted);
  min-height: 14px;
  display: block;
}

@media (min-width: 480px) {
  input[type="text"],
  input[type="email"] {
    padding: 9px 11px 9px 34px;
    font-size: 14px;
  }

  .input-icon {
    font-size: 14px;
    left: 9px;
  }

  .help {
    font-size: 11px;
    min-height: 16px;
  }
}

@media (min-width: 768px) {
  input[type="text"],
  input[type="email"] {
    padding: 10px 12px 10px 36px;
    font-size: 14px;
  }

  .input-icon {
    font-size: 15px;
    left: 10px;
  }
}

@media (min-width: 1024px) {
  input[type="text"],
  input[type="email"] {
    padding: 11px 13px 11px 38px;
    font-size: 15px;
  }

  .input-icon {
    font-size: 16px;
    left: 11px;
  }
}

/* ============================================
   BUTTONS - RESPONSIVE & MOBILE-FRIENDLY
   ============================================ */
.actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  user-select: none;
  flex: 1;
  min-width: 80px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

@media (min-width: 480px) {
  .btn {
    flex: 0 1 auto;
    padding: 10px 14px;
    font-size: 12px;
  }

  .actions {
    gap: 10px;
    margin-top: 16px;
  }
}

@media (min-width: 768px) {
  .btn {
    padding: 11px 16px;
    font-size: 13px;
  }

  .actions {
    gap: 12px;
    margin-top: 18px;
  }
}

@media (min-width: 1024px) {
  .btn {
    padding: 12px 18px;
    font-size: 14px;
  }

  .actions {
    gap: 14px;
    margin-top: 20px;
  }
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface-dark);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

/* Edit Button */
.btn-edit {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  font-size: 10px;
  padding: 5px 8px;
  flex: 1;
  min-width: 45px;
}

.btn-edit:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

/* Delete Button */
.btn-delete {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fecaca;
  font-size: 10px;
  padding: 5px 8px;
  flex: 1;
  min-width: 45px;
}

.btn-delete:hover:not(:disabled) {
  background: var(--danger);
  color: white;
}

@media (min-width: 480px) {
  .btn-edit,
  .btn-delete {
    font-size: 11px;
    padding: 6px 10px;
    min-width: 50px;
  }
}

@media (min-width: 768px) {
  .btn-edit,
  .btn-delete {
    font-size: 12px;
    padding: 7px 12px;
    min-width: 60px;
  }
}

@media (min-width: 1024px) {
  .btn-edit,
  .btn-delete {
    font-size: 13px;
    padding: 8px 14px;
    min-width: 65px;
  }
}

/* ============================================
   RECORDS SECTION - RESPONSIVE
   ============================================ */
.records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.records-header h2 {
  flex: 1;
  min-width: 100px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 5px 8px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 10px;
}

@media (min-width: 480px) {
  .count-badge {
    font-size: 11px;
    padding: 6px 10px;
  }
}

@media (min-width: 768px) {
  .count-badge {
    font-size: 12px;
    padding: 7px 12px;
  }
}

@media (min-width: 1024px) {
  .count-badge {
    font-size: 13px;
    padding: 8px 14px;
  }
}

/* ============================================
   TABLE - FULLY RESPONSIVE
   ============================================ */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
  margin: 10px 0;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.data-table th,
.data-table td {
  padding: 9px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.data-table thead th {
  background: var(--surface-dark);
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: all 0.3s ease;
}

.data-table tbody tr:hover {
  background: var(--surface);
}

/* Reduced min-widths to prevent horizontal scrolling on mobile */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
  min-width: 80px;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  min-width: 60px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
  min-width: 90px;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
  min-width: 75px;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
  min-width: 110px;
}

@media (min-width: 480px) {
  .data-table th,
  .data-table td {
    padding: 10px;
    font-size: 12px;
  }

  .data-table thead th {
    font-size: 11px;
  }

  .table-wrapper {
    margin: 12px 0;
    max-height: 65vh;
  }

  /* Increased min-widths for better readability on tablets */
  .data-table th:nth-child(1),
  .data-table td:nth-child(1) {
    min-width: 90px;
  }

  .data-table th:nth-child(2),
  .data-table td:nth-child(2) {
    min-width: 70px;
  }

  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    min-width: 100px;
  }

  .data-table th:nth-child(4),
  .data-table td:nth-child(4) {
    min-width: 85px;
  }

  .data-table th:nth-child(5),
  .data-table td:nth-child(5) {
    min-width: 120px;
  }
}

@media (min-width: 768px) {
  .data-table th,
  .data-table td {
    padding: 11px;
    font-size: 13px;
  }

  .data-table thead th {
    font-size: 12px;
  }

  .table-wrapper {
    margin: 14px 0;
    max-height: 70vh;
  }

  /* Larger min-widths for desktop */
  .data-table th:nth-child(1),
  .data-table td:nth-child(1) {
    min-width: 110px;
  }

  .data-table th:nth-child(2),
  .data-table td:nth-child(2) {
    min-width: 80px;
  }

  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    min-width: 120px;
  }

  .data-table th:nth-child(4),
  .data-table td:nth-child(4) {
    min-width: 100px;
  }

  .data-table th:nth-child(5),
  .data-table td:nth-child(5) {
    min-width: 140px;
  }
}

@media (min-width: 1024px) {
  .data-table th,
  .data-table td {
    padding: 12px;
    font-size: 14px;
  }

  .data-table thead th {
    font-size: 13px;
  }

  .table-wrapper {
    max-height: 75vh;
  }
}

/* ============================================
   ROW ACTIONS - RESPONSIVE
   ============================================ */
.row-actions {
  display: inline-flex;
  gap: 3px;
  flex-wrap: wrap;
}

@media (min-width: 480px) {
  .row-actions {
    gap: 4px;
  }
}

@media (min-width: 768px) {
  .row-actions {
    gap: 5px;
  }
}

/* ============================================
   EMPTY STATE - RESPONSIVE
   ============================================ */
.empty-state {
  margin-top: 12px;
  padding: 20px 12px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.empty-icon {
  font-size: 32px;
  opacity: 0.6;
}

@media (min-width: 480px) {
  .empty-state {
    padding: 24px 14px;
    font-size: 13px;
  }

  .empty-icon {
    font-size: 36px;
  }
}

@media (min-width: 768px) {
  .empty-state {
    padding: 28px 16px;
    font-size: 14px;
  }

  .empty-icon {
    font-size: 40px;
  }
}

@media (min-width: 1024px) {
  .empty-state {
    padding: 32px 20px;
  }

  .empty-icon {
    font-size: 44px;
  }
}

/* ============================================
   FOOTER - RESPONSIVE
   ============================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 12px 0;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
  background: var(--surface);
  width: 100%;
}

@media (min-width: 480px) {
  .site-footer {
    padding: 14px 0;
    margin-top: 18px;
    font-size: 11px;
  }
}

@media (min-width: 768px) {
  .site-footer {
    padding: 16px 0;
    margin-top: 20px;
    font-size: 12px;
  }
}

@media (min-width: 1024px) {
  .site-footer {
    padding: 18px 0;
    margin-top: 22px;
    font-size: 13px;
  }
}

/* ============================================
   ACCESSIBILITY & PREFERENCES
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --surface: #1f2937;
    --surface-dark: #374151;
    --border: #4b5563;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
  }
}

@media print {
  .site-header,
  .site-footer,
  .nav,
  .actions {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}

/* ============================================
   NOTIFICATION POPUP - RESPONSIVE
   ============================================ */
.notification-popup {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  width: 100%;
  max-width: 500px;
  background: var(--success);
  color: white;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 2000;
  animation: slideDown 0.3s ease-out;
  font-size: 12px;
  font-weight: 500;
}

.notification-popup.show {
  display: flex;
}

.notification-popup.success {
  background: var(--success);
}

.notification-popup.error {
  background: var(--danger);
}

.notification-popup.warning {
  background: var(--warning);
}

.notification-popup.info {
  background: var(--primary);
}

.notification-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  line-height: 1.4;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  to {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
  }
}

@media (min-width: 480px) {
  .notification-popup {
    top: 90px;
    padding: 13px 16px;
    font-size: 13px;
  }

  .notification-icon {
    font-size: 18px;
  }
}

@media (min-width: 768px) {
  .notification-popup {
    top: 100px;
    padding: 14px 18px;
    font-size: 14px;
  }

  .notification-icon {
    font-size: 20px;
  }
}

@media (min-width: 1024px) {
  .notification-popup {
    top: 110px;
    padding: 15px 20px;
    font-size: 15px;
  }

  .notification-icon {
    font-size: 22px;
  }
}
