/* =========================================================
   School Assignment Manager — CSS
   Compatible with Avada Theme
   ========================================================= */

:root {
  --sam-primary:        #1a56db;
  --sam-primary-dark:   #1341b5;
  --sam-primary-light:  #e8f0fd;
  --sam-success:        #057a55;
  --sam-success-bg:     #def7ec;
  --sam-error:          #c81e1e;
  --sam-error-bg:       #fde8e8;
  --sam-warning:        #9f580a;
  --sam-warning-bg:     #feecdc;
  --sam-text:           #111827;
  --sam-text-muted:     #6b7280;
  --sam-border:         #e5e7eb;
  --sam-border-focus:   #93c5fd;
  --sam-bg:             #f9fafb;
  --sam-white:          #ffffff;
  --sam-radius:         10px;
  --sam-radius-lg:      14px;
  --sam-shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --sam-shadow-md:      0 4px 12px rgba(0,0,0,.1);
  --sam-transition:     0.18s ease;
  --sam-font:           inherit;
}

/* ─── Base Reset ─────────────────────────────────────────── */
.sam-card, .sam-dashboard, .sam-student-view,
.sam-student-submit, .sam-submissions-view,
.sam-login-card, .sam-filter-bar { box-sizing: border-box; }

/* ─── Card ───────────────────────────────────────────────── */
.sam-card {
  background: var(--sam-white);
  border: 1px solid var(--sam-border);
  border-radius: var(--sam-radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--sam-shadow);
}
.sam-card__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--sam-text);
  margin: 0 0 6px;
}
.sam-card__subtitle {
  color: var(--sam-text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}
.sam-card__icon {
  width: 56px; height: 56px;
  background: var(--sam-primary-light);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--sam-primary);
  margin-bottom: 16px;
}

/* ─── Login Card ─────────────────────────────────────────── */
.sam-login-card {
  max-width: 440px;
  margin: 40px auto;
}
.sam-login-header {
  text-align: center;
  margin-bottom: 28px;
}
.sam-login-icon {
  width: 64px; height: 64px;
  background: var(--sam-primary-light);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--sam-primary);
  margin: 0 auto 16px;
}

/* ─── Dashboard Header ───────────────────────────────────── */
.sam-dashboard__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.sam-dashboard__title {
  font-size: 22px; font-weight: 700;
  color: var(--sam-text);
  margin: 0 0 4px;
}
.sam-dashboard__subtitle {
  color: var(--sam-text-muted);
  font-size: 14px; margin: 0;
}
.sam-dashboard__actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center;
}

/* ─── Forms ──────────────────────────────────────────────── */
.sam-form { }
.sam-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .sam-form__row { grid-template-columns: 1fr; }
}
.sam-form__group { margin-bottom: 20px; }
.sam-form__message {
  padding: 10px 14px;
  border-radius: var(--sam-radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.sam-form__message.is-success {
  display: block;
  background: var(--sam-success-bg);
  color: var(--sam-success);
  border: 1px solid #a7f3d0;
}
.sam-form__message.is-error {
  display: block;
  background: var(--sam-error-bg);
  color: var(--sam-error);
  border: 1px solid #fca5a5;
}

/* ─── Form Inputs ────────────────────────────────────────── */
.sam-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--sam-text);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.sam-required { color: var(--sam-error); }
.sam-input, .sam-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--sam-border);
  border-radius: var(--sam-radius);
  font-size: 14px;
  color: var(--sam-text);
  background: var(--sam-white);
  transition: border-color var(--sam-transition), box-shadow var(--sam-transition);
  outline: none;
  appearance: none;
}
.sam-input:focus, .sam-select:focus {
  border-color: var(--sam-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.sam-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}
.sam-select:disabled {
  background-color: var(--sam-bg);
  color: var(--sam-text-muted);
  cursor: not-allowed;
}

/* ─── File Drop ──────────────────────────────────────────── */
.sam-file-drop {
  border: 2px dashed var(--sam-border);
  border-radius: var(--sam-radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--sam-transition), background var(--sam-transition);
  position: relative;
  color: var(--sam-text-muted);
}
.sam-file-drop:hover, .sam-file-drop.is-drag {
  border-color: var(--sam-primary);
  background: var(--sam-primary-light);
  color: var(--sam-primary);
}
.sam-file-drop svg { margin-bottom: 8px; display: block; margin: 0 auto 8px; }
.sam-file-drop p { margin: 0 0 4px; font-size: 14px; }
.sam-file-drop small { font-size: 12px; }
.sam-file-drop input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.sam-file-label { color: var(--sam-primary); cursor: pointer; font-weight: 600; }
.sam-file-name {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--sam-success-bg);
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--sam-success);
  display: flex; align-items: center; gap: 8px;
}

/* ─── Buttons ────────────────────────────────────────────── */
.sam-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--sam-radius);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--sam-transition);
  line-height: 1.4;
  white-space: nowrap;
}
.sam-btn--primary {
  background: var(--sam-primary);
  color: #fff;
}
.sam-btn--primary:hover {
  background: var(--sam-primary-dark);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,86,219,.3);
}
.sam-btn--outline {
  background: transparent;
  color: var(--sam-primary);
  border: 1.5px solid var(--sam-primary);
}
.sam-btn--outline:hover {
  background: var(--sam-primary-light);
  text-decoration: none;
}
.sam-btn--ghost {
  background: transparent;
  color: var(--sam-text-muted);
  border: 1.5px solid var(--sam-border);
}
.sam-btn--ghost:hover {
  background: var(--sam-bg);
  color: var(--sam-text);
  text-decoration: none;
}
.sam-btn--full { width: 100%; justify-content: center; }
.sam-btn:disabled {
  opacity: .5; cursor: not-allowed;
  pointer-events: none;
}

/* ─── Menu Button ────────────────────────────────────────── */
.sam-menu-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: all var(--sam-transition);
}
.sam-menu-btn--login {
  background: var(--sam-primary);
  color: #fff !important;
}
.sam-menu-btn--login:hover {
  background: var(--sam-primary-dark);
  color: #fff !important; text-decoration: none;
}
.sam-menu-btn--logout {
  background: #fff;
  color: var(--sam-error) !important;
  border: 1.5px solid var(--sam-error);
}
.sam-menu-btn--logout:hover { background: var(--sam-error-bg); text-decoration: none; }

/* ─── Filter Bar ─────────────────────────────────────────── */
.sam-filter-bar {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.sam-filter-bar--card {
  background: var(--sam-white);
  padding: 24px;
  border-radius: var(--sam-radius-lg);
  border: 1px solid var(--sam-border);
  box-shadow: var(--sam-shadow);
  margin-bottom: 24px;
}
.sam-filter-group { flex: 1; min-width: 180px; }

/* ─── Section Header ─────────────────────────────────────── */
.sam-section-header {
  text-align: center;
  margin-bottom: 32px;
}
.sam-section-header h2 { font-size: 26px; font-weight: 700; color: var(--sam-text); margin: 0 0 8px; }
.sam-section-header p  { color: var(--sam-text-muted); }

/* ─── Assignment Grid (Student View) ─────────────────────── */
.sam-assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.sam-assignment-card {
  background: var(--sam-white);
  border: 1px solid var(--sam-border);
  border-radius: var(--sam-radius-lg);
  padding: 20px;
  box-shadow: var(--sam-shadow);
  transition: box-shadow var(--sam-transition), transform var(--sam-transition);
  cursor: pointer;
}
.sam-assignment-card:hover {
  box-shadow: var(--sam-shadow-md);
  transform: translateY(-2px);
}
.sam-assignment-card__badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
}
.sam-assignment-card__badge--pdf {
  background: #fce8e8; color: #c81e1e;
}
.sam-assignment-card__badge--image {
  background: #e8f0fd; color: #1a56db;
}
.sam-assignment-card__title {
  font-size: 15px; font-weight: 600;
  color: var(--sam-text); margin: 0 0 6px;
}
.sam-assignment-card__meta {
  font-size: 12px; color: var(--sam-text-muted);
  display: flex; gap: 12px; flex-wrap: wrap;
}
.sam-assignment-card__meta span { display: flex; align-items: center; gap: 4px; }
.sam-assignment-card__view {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--sam-primary); font-size: 13px; font-weight: 600;
  margin-top: 14px;
}

/* ─── Assignment List (Teacher View) ─────────────────────── */
.sam-assignment-list { display: flex; flex-direction: column; gap: 12px; }
.sam-assignment-item {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--sam-border);
  border-radius: var(--sam-radius);
  background: var(--sam-bg);
}
.sam-assignment-item__icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sam-assignment-item__icon--pdf { background: #fce8e8; color: #c81e1e; }
.sam-assignment-item__icon--image { background: #e8f0fd; color: var(--sam-primary); }
.sam-assignment-item__info { flex: 1; }
.sam-assignment-item__title { font-size: 14px; font-weight: 600; color: var(--sam-text); }
.sam-assignment-item__meta { font-size: 12px; color: var(--sam-text-muted); }

/* ─── Submission Table ───────────────────────────────────── */
.sam-submission-table-wrap { overflow-x: auto; }
.sam-submission-table {
  width: 100%; border-collapse: collapse;
  background: var(--sam-white);
  border-radius: var(--sam-radius-lg);
  overflow: hidden;
  box-shadow: var(--sam-shadow);
  border: 1px solid var(--sam-border);
}
.sam-submission-table thead th {
  background: #f1f5f9;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--sam-text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--sam-border);
}
.sam-submission-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--sam-text);
  border-bottom: 1px solid var(--sam-border);
  vertical-align: middle;
}
.sam-submission-table tbody tr:last-child td { border-bottom: none; }
.sam-submission-table tbody tr:hover { background: var(--sam-bg); }

/* ─── Notices ────────────────────────────────────────────── */
.sam-notice {
  padding: 14px 18px;
  border-radius: var(--sam-radius);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.sam-notice--success { background: var(--sam-success-bg); color: var(--sam-success); border: 1px solid #a7f3d0; }
.sam-notice--error   { background: var(--sam-error-bg);   color: var(--sam-error);   border: 1px solid #fca5a5; }

/* ─── Empty State ────────────────────────────────────────── */
.sam-empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--sam-text-muted);
}
.sam-empty-state svg { margin: 0 auto 16px; display: block; opacity: .35; }
.sam-empty-state p { font-size: 15px; }
.sam-empty { color: var(--sam-text-muted); font-size: 14px; }

/* ─── Loading Spinner ────────────────────────────────────── */
.sam-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--sam-border);
  border-top-color: var(--sam-primary);
  border-radius: 50%;
  animation: sam-spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes sam-spin { to { transform: rotate(360deg); } }
.sam-loading {
  text-align: center;
  padding: 32px;
  color: var(--sam-text-muted);
}

/* ─── Modal ──────────────────────────────────────────────── */
.sam-modal {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.sam-modal__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  cursor: pointer;
}
.sam-modal__content {
  position: relative; z-index: 1;
  background: var(--sam-white);
  border-radius: var(--sam-radius-lg);
  width: 100%; max-width: 800px;
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.sam-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--sam-border);
}
.sam-modal__header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.sam-modal__close {
  width: 32px; height: 32px;
  border: none; background: var(--sam-bg);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--sam-text-muted);
}
.sam-modal__close:hover { background: var(--sam-border); color: var(--sam-text); }
.sam-modal__body { padding: 24px; }
.sam-modal__body img { max-width: 100%; border-radius: 8px; }
.sam-modal__body iframe { width: 100%; height: 550px; border: none; border-radius: 8px; }

/* ─── View Link ──────────────────────────────────────────── */
.sam-view-link {
  color: var(--sam-primary); font-weight: 600;
  cursor: pointer; text-decoration: none; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.sam-view-link:hover { text-decoration: underline; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sam-card { padding: 20px; }
  .sam-dashboard__header { flex-direction: column; }
  .sam-filter-bar { flex-direction: column; }
  .sam-filter-group { min-width: 100%; }
  .sam-assignment-grid { grid-template-columns: 1fr; }
}
