/* =============================================================================
   Mentora Tutor System – UI + Print Styles
   Structure:
   0) Design tokens (CSS variables)
   1) Base + cards + shared utilities
   2) Invoices (header, tables, totals, badges)
   3) Print rules
   4) Teaching Portal (vertical layout + form controls)
   5) Primary buttons (Save/Apply styling)
   6) Directory: Add buttons row (Student left, Tutor right)
   7) Small utilities (required star, disabled state)
   ========================================================================== */


/* ========== 0) Design tokens (CSS variables) ================================= */
:root{
  --mt-body:  "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mt-head:  Georgia, "Times New Roman", Times, serif;
  --mt-muted: #666;
  --mt-text:  #222;
  --mt-line:  #e6e6e6;
  --mt-bg:    #fff;
  --mt-accent:#0073aa; /* primary blue */
}


/* ========== 1) Base + cards + shared utilities =============================== */
body{
  font-family: var(--mt-body);
  color: var(--mt-text);
}

.mentora-card{
  border: 1px solid var(--mt-line);
  background: var(--mt-bg);
  padding: 14px;
  margin: 12px 0;
  border-radius: 8px;
}


/* ========== 2) Invoices (header, tables, totals, badges) ===================== */

/* Header fonts */
.mentora-invoice h4,
.mentora-invoice-header{
  font-family: var(--mt-head);
  letter-spacing: .2px;
}

.mentora-invoice h4{
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 8px;
}

.mentora-invoice-header{
  font-size: 16px;
  line-height: 1.55;
  margin: 6px 0 8px;
  color: var(--mt-muted);
}

/* Brand row + rules */
.mentora-print-brand{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px 0;
  text-align: left;
}
.mentora-print-brand img{
  max-height: 70px;
  width: auto;
  object-fit: contain;
}

.mentora-header-rule,
.mentora-invoice-sep{
  border: 0;
  height: 1px;
  background: var(--mt-line);
}
.mentora-header-rule{ margin: 8px 0 12px; }
.mentora-invoice-sep{  margin: 14px 0; }

/* Tables */
.mentora-table{
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 8px;
  font-size: 14px;
}
.mentora-table th,
.mentora-table td{
  border: 1px solid var(--mt-line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.mentora-table th{
  background: linear-gradient(180deg,#f5f7fb 0%,#edf1f7 100%);
  font-weight: 700;
  -webkit-print-color-adjust: exact;
          print-color-adjust: exact;
}
/* Slightly tighter spacing for first invoice table */
.mentora-invoice .mentora-table{ margin-top: 6px; }

/* Totals row */
.mentora-invoice-total{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: baseline;
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #f9f9f9;
  border-top: 2px solid var(--mt-line);
}
.mentora-invoice-total .mentora-total-amount{
  font-size: 18px;
  font-weight: 800;
}

/* Badges + notices */
.mentora-badge{
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #ccc;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.3;
}
.mentora-paid{   background:#e7f7ed; color:#137a2a; border-color:#137a2a; }
.mentora-unpaid{ background:#fdecea; color:#b42318; border-color:#b42318; }
.mentora-notice{
  padding: 10px;
  background: #f0f6ff;
  border: 1px solid #cfe1ff;
  margin: .5em 0;
}


/* ========== 3) Print rules ==================================================== */
@media print {
  /* Hide language/headers/footers/etc. */
  #trp-floater-ls,.trp-language-switcher,.trp-language-switcher-container,
  .weglot-container,.wg-drop,.wpml-ls,.wpml-ls-statics-footer,
  .gtranslate_wrapper,.language-switcher,
  .site-header,.site-footer,#wpadminbar,.entry-title,.page-title{
    display: none !important;
  }
  /* Page margins and link cleanup */
  @page { margin: 12mm; }
  a[href]:after{ content: "" !important; }
}


/* ========== 4) Teaching Portal (vertical layout + form controls) ============= */

/* Force vertical stack, neutralize any outside grid/flex, set tidy width */
#mentora-teach-form,
.mentora-teach-form{
  display: block !important;
  max-width: 720px;
}

/* Labels and label “title” spans */
#mentora-teach-form label,
.mentora-teach-form label{
  display: block !important;
  margin: 0 0 12px 0;
}
#mentora-teach-form label > span,
.mentora-teach-form label > span{
  display: block;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

/* Input controls */
#mentora-teach-form input[type="text"],
#mentora-teach-form input[type="number"],
#mentora-teach-form input[type="date"],
#mentora-teach-form select,
#mentora-teach-form textarea,
.mentora-teach-form input[type="text"],
.mentora-teach-form input[type="number"],
.mentora-teach-form input[type="date"],
.mentora-teach-form select,
.mentora-teach-form textarea{
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
}

/* Kill inline layout attributes if injected */
#mentora-teach-form[style],
.mentora-teach-form[style]{
  display: block !important;
  grid-template-columns: unset !important;
  gap: 0 !important;
}


/* ========== 5) Primary buttons (Save/Apply styling) ========================== */

/* Generic filter row */
.mentora-controls{
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
}
.mentora-controls label{ margin-bottom: 6px; font-weight: 600; }
.mentora-input,
.mentora-form input[type="text"],
.mentora-form input[type="date"],
.mentora-form input[type="number"],
.mentora-form select{
  width: 100%;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid #ccd0d4;
  border-radius: 3px;
  background: #fff;
  box-sizing: border-box;
}
.mentora-actions{ margin-top: 12px; }

/* Primary button look (blue) */
.mentora-controls .button.button-primary,
.mentora-actions  .button.button-primary{
  background: var(--mt-accent);
  border-color: #006799;
  color: #fff;
  padding: 7px 16px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
.mentora-controls .button.button-primary:hover,
.mentora-actions  .button.button-primary:hover{
  background: #006799;
  border-color: #006799;
}

/* Make the inline Apply buttons match primary blue (sessions filter, etc.) */
.mentora-sessions-filter .button.button-primary{
  background: var(--mt-accent);
  border-color: #006799;
  color: #fff;
  padding: 4px 12px;
  font-weight: 600;
  border-radius: 6px;
}
.mentora-sessions-filter .button.button-primary:hover{
  background: #006799;
  border-color: #006799;
}

/* Standalone primary button helper (e.g., Apply with fixed width) */
.mentora-apply-btn{
  background: var(--mt-accent);
  border-color: #006799;
  color: #fff;
  padding: 7px 16px;
  font-weight: 600;
  border-radius: 6px;
  min-width: 160px;
}
.mentora-apply-btn:hover{
  background: #006799;
  border-color: #006799;
}


/* ========== 6) Directory: “Add” buttons row ================================= */
/* Goal: “Add New Student 5” left, “Add New Tutor 5” right */
.mentora-add-buttons{
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;  /* ensure left start */
  margin: 16px 0 20px;
  width: 100%;
}

/* Push the Tutor button to the far right */
#mt-open-tutor-drawer{
  margin-left: auto;
}

/* Keep blue style consistent for these buttons */
.mentora-add-buttons .button,
.mentora-add-buttons .button.button-primary,
.mentora-add-buttons .mentora-apply-btn{
  background: var(--mt-accent);
  border-color: #006799;
  color: #fff;
  padding: 7px 16px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  min-width: 160px; /* consistent width */
}
.mentora-add-buttons .button:hover,
.mentora-add-buttons .button.button-primary:hover,
.mentora-add-buttons .mentora-apply-btn:hover{
  background: #006799;
  border-color: #006799;
}

/* Mobile: stack vertically */
@media (max-width: 600px){
  .mentora-add-buttons{
    flex-wrap: wrap;
  }
  #mt-open-tutor-drawer{
    margin-left: 0; /* no push on narrow screens */
  }
}


/* ========== 7) Small utilities (required star, disabled state) =============== */

/* Disabled "Save Session" visual */
#mt-save-session[disabled],
#tp_save[disabled]{
  opacity: .5;
  cursor: not-allowed;
  filter: grayscale(100%);
}

/* Red “*” after required labels */
#mentora-teach-form label.mt-req{
  display: inline-block;     /* keep it on same line as text */
  white-space: nowrap;
}
#mentora-teach-form label.mt-req::after{
  content: " *";
  color: #c62828;
  font-weight: 700;
}


/* ========== 8) Admin List Table Styles ======================================= */

/* Delete button styling for admin tables */
.button-link-delete {
    color: #b32d2e;
    cursor: pointer;
}
.button-link-delete:hover {
    color: #fff;
    background: #b32d2e;
}

/* Status badge styling for admin tables - Updated to match Parents */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}
.status-active {
    background: #d1f7d5;
    color: #1b7f36;
}
.status-inactive {
    background: #fbe3e4;
    color: #a00;
}

/* Students List Table - Match Parents module exactly */
.mentora-table td {
    vertical-align: middle;
    padding: 8px 10px;
}

.column-student_name {
    width: 20%;
}

.column-email,
.column-phone,
.column-parent_name,
.column-class_name {
    width: 12%;
}

.column-status {
    width: 8%;
}

.column-created_at {
    width: 10%;
}

.column-actions {
    width: 15%;
}

.mentora-actions a.button-small {
    margin-right: 4px;
}

.mentora-status-overview {
    margin-bottom: 20px;
}

.mentora-empty-state {
    text-align: center;
    padding: 40px 20px;
}

.mentora-empty-state p {
    font-size: 16px;
    color: #646970;
}

.row-actions span {
    display: inline;
}

.na {
    color: #8c8f94;
    font-style: italic;
}

.column-cb {
    width: 40px;
}

.column-actions .button {
    margin: 0 2px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.column-actions .button-link-delete {
    color: #a00;
    border-color: #a00;
}

.column-actions .button-link-delete:hover {
    color: #fff;
    background-color: #a00;
    border-color: #a00;
}

/* ========== 9) Confirmation Modal Styles ===================================== */

/* Modal overlay with backdrop */
.mentora-confirmation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal container */
.mentora-confirmation-modal {
    background: #fff;
    border-radius: 4px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal title */
.mentora-confirmation-modal h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

/* Modal message */
.mentora-confirmation-modal p {
    margin: 0 0 20px 0;
    color: #50575e;
    font-size: 14px;
    line-height: 1.5;
}

/* Button container */
.mentora-confirmation-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Button base styles */
.mentora-confirmation-modal-buttons .button {
    padding: 6px 16px;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
    border: 1px solid;
    border-radius: 3px;
    transition: all 0.15s ease;
}

/* Cancel button (secondary) */
.mentora-confirmation-modal-buttons .button-secondary {
    background: #f0f0f1;
    border-color: #8c8f94;
    color: #2c3338;
}

.mentora-confirmation-modal-buttons .button-secondary:hover {
    background: #e0e0e1;
    border-color: #787c82;
}

/* Confirm button (primary) */
.mentora-confirmation-modal-buttons .button-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.mentora-confirmation-modal-buttons .button-primary:hover {
    background: #135e96;
    border-color: #135e96;
}

/* Focus state for accessibility */
.mentora-confirmation-modal-buttons .button:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #fff;
}
