/**
 * DFK Parent Dashboard - Frontend Styles
 */

/* Variables */
.dfk-dashboard-wrapper {
  --dfk-primary: #2563eb;
  --dfk-primary-hover: #1d4ed8;
  --dfk-success: #16a34a;
  --dfk-success-light: #dcfce7;
  --dfk-error: #dc2626;
  --dfk-error-light: #fee2e2;
  --dfk-info: #0891b2;
  --dfk-info-light: #cffafe;
  --dfk-gray-50: #f9fafb;
  --dfk-gray-100: #f3f4f6;
  --dfk-gray-200: #e5e7eb;
  --dfk-gray-300: #d1d5db;
  --dfk-gray-500: #6b7280;
  --dfk-gray-700: #374151;
  --dfk-gray-900: #111827;
  --dfk-radius: 8px;
  --dfk-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --dfk-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--dfk-gray-900);
  line-height: 1.5;
}

/* Sections */
.dfk-section {
  background: #fff;
  border: 1px solid var(--dfk-gray-200);
  border-radius: var(--dfk-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--dfk-shadow);
}

.dfk-section h3 {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dfk-gray-900);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--dfk-gray-100);
}

.dfk-empty-message {
  color: var(--dfk-gray-500);
  font-style: italic;
  margin: 0;
}

/* Subscriptions Grid */
.dfk-subscriptions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dfk-subscription-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid var(--dfk-primary);
  border-radius: var(--dfk-radius);
  transition: transform 0.2s, box-shadow 0.2s;
}

.dfk-subscription-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.dfk-subscription-info {
  margin-bottom: 16px;
}

.dfk-subscription-title {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dfk-gray-900);
}

.dfk-subscription-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dfk-status-available {
  background: var(--dfk-success-light);
  color: #166534;
}

.dfk-status-assigned {
  background: var(--dfk-info-light);
  color: #0e7490;
}

.btn-assign-subscription {
  background: var(--dfk-primary) !important;
  color: #fff !important;
  border: none !important;
  padding: 12px 20px;
  border-radius: var(--dfk-radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
}

.btn-assign-subscription:hover {
  background: var(--dfk-primary-hover) !important;
}

.btn-assign-subscription:active {
  transform: scale(0.98);
}

/* Credits Grid (Legacy) */
.dfk-credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.dfk-credit-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--dfk-gray-50);
  border: 1px solid var(--dfk-gray-200);
  border-radius: var(--dfk-radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dfk-credit-card:hover {
  border-color: var(--dfk-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dfk-credit-info {
  flex: 1;
}

.dfk-course-title {
  margin: 0 0 4px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dfk-gray-900);
}

.dfk-license-count {
  font-size: 0.875rem;
  color: var(--dfk-gray-500);
}

/* Student List Table */
.dfk-student-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.dfk-student-list thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--dfk-gray-50);
  border-bottom: 2px solid var(--dfk-gray-200);
  font-weight: 600;
  color: var(--dfk-gray-700);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dfk-student-list tbody tr {
  border-bottom: 1px solid var(--dfk-gray-200);
}

.dfk-student-list tbody tr:hover {
  background: var(--dfk-gray-50);
}

.dfk-student-list td {
  padding: 16px;
  vertical-align: top;
}

.dfk-col-name strong {
  display: block;
  font-size: 1rem;
  color: var(--dfk-gray-900);
  margin-bottom: 4px;
}

.dfk-username {
  display: block;
  font-size: 0.8125rem;
  color: var(--dfk-gray-500);
}

.dfk-no-courses {
  color: var(--dfk-gray-500);
  font-style: italic;
  font-size: 0.875rem;
}

.dfk-course-progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dfk-course-progress-list li {
  margin-bottom: 12px;
}

.dfk-course-progress-list li:last-child {
  margin-bottom: 0;
}

.dfk-course-name {
  display: block;
  font-size: 0.875rem;
  color: var(--dfk-gray-700);
  margin-bottom: 6px;
}

.dfk-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dfk-progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--dfk-gray-200);
  border: none;
  overflow: hidden;
}

.dfk-progress-bar::-webkit-progress-bar {
  background: var(--dfk-gray-200);
  border-radius: 4px;
}

.dfk-progress-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--dfk-success), #22c55e);
  border-radius: 4px;
}

.dfk-progress-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--dfk-success), #22c55e);
  border-radius: 4px;
}

.dfk-progress-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--dfk-gray-500);
  min-width: 36px;
}

.dfk-col-actions {
  white-space: normal;
  width: 1%;
  min-width: 220px;
}

.dfk-col-name {
  white-space: nowrap;
}

.dfk-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}

.dfk-badge-completed {
  background: #dcfce7;
  color: #166534;
}

.dfk-badge-current {
  background: var(--dfk-gray-100, #f3f4f6);
  color: var(--dfk-gray-700);
}

.dfk-col-actions .btn-next-course {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  text-align: center;
  background: var(--dfk-success, #16a34a);
  color: #fff;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: var(--dfk-radius);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s;
}

.dfk-col-actions .btn-next-course:hover {
  filter: brightness(0.92);
}

.dfk-modal-next-course-intro {
  margin: 0 0 16px;
  color: var(--dfk-gray-700);
}

.dfk-col-actions .btn-reset-pw,
.dfk-col-actions .btn-results {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  text-align: center;
}

.dfk-col-actions > :last-child {
  margin-bottom: 0;
}

.dfk-switch-form {
  display: block;
  margin: 0 0 8px;
}

.btn-switch-profile {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--dfk-primary);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--dfk-radius);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-switch-profile:hover {
  background: var(--dfk-primary-hover);
}

/* Buttons */
.btn-assign,
.btn-confirm {
  background: var(--dfk-primary);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--dfk-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-assign:hover,
.btn-confirm:hover {
  background: var(--dfk-primary-hover);
}

.btn-assign:active,
.btn-confirm:active {
  transform: scale(0.98);
}

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

.btn-reset-pw,
.btn-results,
.btn-cancel {
  background: #fff;
  color: var(--dfk-gray-700);
  border: 1px solid var(--dfk-gray-300);
  padding: 8px 14px;
  border-radius: var(--dfk-radius);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.btn-reset-pw:hover,
.btn-results:hover,
.btn-cancel:hover {
  background: var(--dfk-gray-50);
  border-color: var(--dfk-gray-400);
}

.btn-login {
  display: inline-block;
  background: var(--dfk-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--dfk-radius);
  text-decoration: none;
  font-weight: 500;
  margin-top: 12px;
}

.btn-login:hover {
  background: var(--dfk-primary-hover);
  color: #fff;
}

/* Modals */
.dfk-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dfk-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.dfk-modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--dfk-radius);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--dfk-shadow-lg);
  animation: dfk-modal-in 0.2s ease;
}

@keyframes dfk-modal-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dfk-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--dfk-gray-500);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.dfk-modal-close:hover {
  color: var(--dfk-gray-900);
}

.dfk-modal-content h3 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.dfk-modal-course-title,
.dfk-modal-child-name {
  color: var(--dfk-gray-500);
  margin: 0 0 20px 0;
  font-size: 0.9375rem;
}

/* Forms */
.dfk-radio-group {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.dfk-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9375rem;
}

.dfk-radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--dfk-primary);
}

.dfk-form-section {
  margin-bottom: 20px;
}

.dfk-form-row {
  margin-bottom: 16px;
}

.dfk-form-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dfk-gray-700);
}

.dfk-form-row input,
.dfk-form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--dfk-gray-300);
  border-radius: var(--dfk-radius);
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.dfk-form-row input:focus,
.dfk-form-row select:focus {
  outline: none;
  border-color: var(--dfk-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dfk-form-section > label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dfk-gray-700);
}

.dfk-form-section select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--dfk-gray-300);
  border-radius: var(--dfk-radius);
  font-size: 0.9375rem;
  background: #fff;
}

.dfk-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--dfk-gray-200);
}

/* Messages */
.dfk-messages {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dfk-message {
  padding: 14px 20px;
  border-radius: var(--dfk-radius);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: var(--dfk-shadow-lg);
  max-width: 360px;
}

.dfk-message-success {
  background: var(--dfk-success-light);
  color: #166534;
  border: 1px solid #86efac;
}

.dfk-message-error {
  background: var(--dfk-error-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.dfk-message-info {
  background: var(--dfk-info-light);
  color: #0e7490;
  border: 1px solid #67e8f9;
}

/* Success Modal - Credentials Display */
.dfk-credentials-display {
  width: 100%;
  padding: 10px 12px;
  background: var(--dfk-gray-50);
  border: 1px solid var(--dfk-gray-200);
  border-radius: var(--dfk-radius);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--dfk-gray-900);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.dfk-password-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-toggle-password {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--dfk-gray-500);
  transition: color 0.2s;
}

.btn-toggle-password:hover {
  color: var(--dfk-gray-700);
}

/* Info Box */
.dfk-info-box {
  background: var(--dfk-gray-50);
  border: 1px solid var(--dfk-gray-200);
  border-radius: var(--dfk-radius);
  padding: 16px 20px;
  margin-top: 20px;
}

.dfk-info-box p {
  margin: 0 0 10px 0;
  font-size: 0.9375rem;
  color: var(--dfk-gray-900);
}

.dfk-info-box p:last-child {
  margin-bottom: 0;
}

.dfk-info-box h4 {
  margin: 0 0 12px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dfk-gray-700);
}

.dfk-info-box h4 i {
  margin-right: 8px;
  color: var(--dfk-gray-500);
}

.dfk-info-box ul,
.dfk-info-box ol {
  margin: 0;
  padding-left: 20px;
  color: var(--dfk-gray-700);
  font-size: 0.875rem;
}

.dfk-info-box li {
  margin-bottom: 6px;
}

.dfk-info-box li:last-child {
  margin-bottom: 0;
}

.dfk-info-box a {
  color: var(--dfk-primary);
  text-decoration: none;
  font-weight: 500;
}

.dfk-info-box a:hover {
  text-decoration: underline;
}

/* Tip Text */
.dfk-tip-text {
  font-size: 0.8125rem;
  color: var(--dfk-gray-500);
  margin: 0 0 8px 0;
}

.dfk-tip-text i {
  margin-right: 6px;
  color: var(--dfk-gray-400);
}

/* Success Modal Header Icon */
.dfk-modal-content h3 i.fa-circle-check {
  color: var(--dfk-success);
  margin-right: 8px;
}

/* Copy Button State */
.btn-copy-credentials.copied {
  background: var(--dfk-success-light);
  border-color: var(--dfk-success);
  color: var(--dfk-success);
}

/* Login & Notice States */
.dfk-login-required,
.dfk-child-notice {
  text-align: center;
  padding: 48px 24px;
  background: var(--dfk-gray-50);
  border: 1px solid var(--dfk-gray-200);
  border-radius: var(--dfk-radius);
}

.dfk-login-required p,
.dfk-child-notice p {
  margin: 0;
  color: var(--dfk-gray-700);
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .dfk-dashboard-wrapper {
    padding: 12px;
  }

  .dfk-section {
    padding: 16px;
  }

  .dfk-subscriptions-grid,
  .dfk-credits-grid {
    grid-template-columns: 1fr;
  }

  .dfk-subscription-card .btn-assign-subscription {
    width: 100%;
  }

  .dfk-credit-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .dfk-credit-card .btn-assign {
    width: 100%;
  }

  .dfk-student-list thead {
    display: none;
  }

  .dfk-student-list tbody tr {
    display: block;
    padding: 16px 0;
  }

  .dfk-student-list td {
    display: block;
    padding: 8px 0;
  }

  .dfk-col-actions {
    padding-top: 12px;
    border-top: 1px solid var(--dfk-gray-200);
    margin-top: 8px;
  }

  .dfk-radio-group {
    flex-direction: column;
    gap: 12px;
  }

  .dfk-modal-content {
    padding: 20px;
    width: 95%;
  }

  .dfk-messages {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .dfk-message {
    max-width: none;
  }
}
