/* ========================================================================
   UIW Canvas Custom Styles - Refactored
   Version: 2.0
   Last Updated: December 2025
   
   This CSS file contains custom styling for UIW's Canvas LMS instance.
   Refactored to consolidate styles previously inline in JavaScript.
   ======================================================================== */

/* ========================================================================
   CSS CUSTOM PROPERTIES (Variables)
   ======================================================================== */

:root {
  --uiw-red: #aa1010;
  --uiw-red-dark: #880808;
  --uiw-red-darker: #991010;
  --uiw-red-hover: #c22020;
  --uiw-font-family: "LatoWeb", "Lato Extended", "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --uiw-text-primary: #2d3b45;
  --uiw-text-secondary: #495057;
  --uiw-text-muted: #6c757d;
  --uiw-border-color: #c7cdd1;
  --uiw-bg-light: #f8f9fa;
  --uiw-bg-muted: #f5f5f5;
}

/* ========================================================================
   ACCESSIBILITY AND USER EXPERIENCE IMPROVEMENTS
   ======================================================================== */

/* Subtle visual feedback for Canvas buttons */
.btn:hover {
  filter: brightness(98%);
  transform: translateY(-0.7px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Button Row component for aligned button layouts */
.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.button-row .btn {
  min-width: 200px;
  padding: 0.75rem 1.25rem;
  font-size: 1.125rem;
  font-weight: 500;
  text-align: center;
}

@media (max-width: 600px) {
  .button-row {
    flex-direction: column;
    align-items: center;
  }
}

/* UIW-branded button styling */
.button-row a {
  background-color: var(--uiw-red);
  color: #ffffff;
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  transition: background-color 0.2s ease;
  min-width: 200px;
}

.button-row a:hover {
  background-color: var(--uiw-red-hover);
}

/* Image hover effects for linked images */
#content a img:hover {
  filter: brightness(92%) !important;
  transition: filter 0.2s ease-in-out !important;
  cursor: pointer !important;
}

/* Improved contrast for todo details */
.todo-details__context {
  color: #333 !important;
}

/* Screen reader only content */
.screenreader-only {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ========================================================================
   COURSE CONTENT FORMATTING COMPONENTS
   ======================================================================== */

/* UIW-branded blockquotes and highlight boxes */
.uiw-highlight-box,
blockquote {
  border-left: 4px solid var(--uiw-red);
  background-color: #fafafa;
  padding: 0.75em 1.25em;
  margin: 1em 0 1.5em;
  color: #333;
  font-style: italic;
  border-radius: 4px;
}

/* Collapsible content sections */
details.collapsible-section {
  margin: 1em 0;
  border: 1px solid #ccc;
  border-radius: 0.5em;
  background: #f9f9f9;
  overflow: hidden;
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

details.collapsible-section[open] {
  box-shadow: 0 0 0 2px var(--uiw-red);
  background: #fff;
}

summary.collapsible-heading {
  font-size: 1.2em;
  font-weight: 600;
  padding: 0.75em 1em;
  cursor: pointer;
  background-color: #fff;
  color: var(--uiw-red);
  border-bottom: 1px solid #ccc;
  position: relative;
  list-style: none;
  outline: none;
}

summary.collapsible-heading::after {
  content: "+";
  position: absolute;
  right: 1em;
  font-size: 1.2em;
  transition: transform 0.3s ease;
}

details.collapsible-section[open] summary.collapsible-heading::after {
  content: "−";
  transform: rotate(0deg);
}

.collapsible-content {
  padding: 1em;
  font-size: 1em;
  color: #333;
}

/* ========================================================================
   UIW-BRANDED HEADER COMPONENTS
   ======================================================================== */

/* Modern gradient header for H2 elements */
.modern-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: linear-gradient(90deg, #991010 0%, #aa1010 50%, #c22020 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  color: #ffffff;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

.modern-header h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

/* H3 Header styling */
.modern-header-h3 {
  background: linear-gradient(90deg, #991010 0%, #aa1010 50%, #c22020 100%);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.modern-header-h3 h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* H4 Header styling */
.modern-header-h4 {
  background: linear-gradient(90deg, #991010 0%, #aa1010 50%, #c22020 100%);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.modern-header-h4 h4 {
  margin: 0;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* ========================================================================
   CUSTOM MODALS AND OVERLAYS
   ======================================================================== */

/* Base modal styling */
.custom-modal {
  position: fixed;
  z-index: 10001 !important;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal-content {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  text-align: left;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  max-width: 700px;
  width: 95%;
  position: relative;
  font-family: var(--uiw-font-family);
}

.custom-modal-close {
  position: absolute;
  right: 10px;
  top: 5px;
  font-size: 20px;
  cursor: pointer;
  border: none;
  background: none;
}

.custom-modal-close:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

/* Modal action buttons */
#modal-ok-button,
#ferpa-modal-ok {
  padding: 10px 20px;
  background-color: var(--uiw-red);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 5px;
  font-size: 1rem;
}

#modal-ok-button:hover,
#ferpa-modal-ok:hover {
  background-color: var(--uiw-red-dark);
}

/* Modal accessibility improvements */
.custom-modal a:hover,
.custom-modal a:focus {
  text-decoration: none;
  outline: 2px solid var(--uiw-red);
  outline-offset: 2px;
}

.custom-modal button:focus {
  outline: 2px solid var(--uiw-red);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .custom-modal-content {
    width: 98%;
    padding: 16px;
    margin: 10px;
  }
  
  .modern-header h2 { font-size: 1.5rem; }
  .modern-header-h3 h3 { font-size: 1.25rem; }
  .modern-header-h4 h4 { font-size: 1.1rem; }
}

/* ========================================================================
   CANVAS ID FIELD IN COURSE SETTINGS
   ======================================================================== */

.canvas-id-row {
  display: flex;
  align-items: flex-start;
}

.canvas-id-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-id-input {
  margin: 0;
  font-weight: normal;
  font-family: var(--uiw-font-family);
  display: inline-block;
  height: 22px;
  padding: 8px;
  margin-bottom: 11px;
  font-size: 0.875rem;
  line-height: 22px;
  color: var(--ic-brand-font-color-dark, var(--uiw-text-primary));
  border-radius: 3px;
  background-color: var(--uiw-bg-muted);
  border: 1px solid #8d959f;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  transition: border linear 0.2s, box-shadow linear 0.2s;
  width: 265px;
  max-width: 100%;
  cursor: default;
}

.canvas-id-copy-btn {
  background-color: var(--ic-brand-primary, var(--uiw-red));
  border: 1px solid var(--ic-brand-primary, var(--uiw-red));
  border-radius: 3px;
  color: white;
  padding: 8px 12px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--uiw-font-family);
  transition: background-color 0.2s;
  height: 38px;
  margin-bottom: 11px;
}

.canvas-id-copy-btn:hover {
  background-color: var(--ic-brand-primary-darkened-10, var(--uiw-red-dark));
}

.canvas-id-copy-btn.copied {
  background-color: #28a745;
  border-color: #28a745;
}

/* ========================================================================
   CONTENT MIGRATION NOTIFICATIONS
   ======================================================================== */

.migration-home-page-notice {
  color: rgb(0, 0, 0);
  background: rgb(255, 255, 255);
  box-sizing: border-box;
  display: flex;
  min-width: 12rem;
  border-width: 0.125rem;
  border-style: solid;
  border-radius: 0.25rem;
  border-color: var(--uiw-red) !important;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 0.1875rem 0.375rem, rgba(0, 0, 0, 0.15) 0px 0.1875rem 0.375rem;
  margin: 0.5rem 0px;
  max-width: 100%;
  overflow: visible;
  transition: outline-color 0.2s, outline-offset 0.25s;
  outline-offset: -0.8rem;
  outline: rgba(170, 16, 16, 0) solid 0.125rem;
}

.migration-notice-icon {
  background-color: var(--uiw-red) !important;
  background: var(--uiw-red) !important;
  color: white;
}

.migration-notice-icon i {
  color: white !important;
  font-size: 1em;
}

/* ========================================================================
   QUIZ ENHANCEMENT STYLES
   ======================================================================== */

.qti-conversion-menu-item {
  font-family: var(--uiw-font-family);
  font-weight: bold;
  font-size: 0.875rem;
  -webkit-font-smoothing: antialiased;
  border-radius: 0;
  text-decoration: none;
  display: block;
  line-height: 1.5;
  background-color: transparent;
  color: var(--ic-brand-font-color-dark, var(--uiw-text-primary));
  min-width: 180px;
  padding: 6px 12px;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.qti-conversion-menu-item:hover {
  background-color: var(--uiw-red) !important;
  color: #ffffff !important;
}

.qti-conversion-menu-item:hover i {
  color: #ffffff !important;
}

/* ========================================================================
   COMPLEX IMAGE FIGURES (Long Descriptions)
   ======================================================================== */

.figures-custom-container {
  background: var(--uiw-bg-muted);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1rem 0;
}

#image-caption-field {
  display: flex;
  align-items: center;
  padding-top: 0.5rem;
}

/* Tooltip styling */
.uiw-figure-tooltip {
  display: none;
  position: fixed;
  z-index: 10000;
  background-color: #273540;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-family: var(--uiw-font-family);
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
  white-space: normal;
}

.uiw-figure-tooltip div {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.uiw-figure-tooltip div.arrow-down {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-top: 6px solid #273540;
}

.uiw-figure-tooltip div.arrow-up {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom: 6px solid #273540;
}

/* Figure details arrow rotation */
details.figure-details:not([open]) .arrow-icon {
  transform: rotate(-90deg);
}

details.figure-details[open] .arrow-icon {
  transform: rotate(0deg);
}

/* ========================================================================
   GRADE CHECK TOOL STYLES
   ======================================================================== */

/* Gradebook button */
.gc-gradebook-btn,
#custom-gradebook-button {
  background-color: var(--uiw-red);
  color: white;
  border: none;
  padding: 8px 12px;
  margin-left: 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  line-height: 22px;
  font-family: var(--uiw-font-family);
  transition: background-color 0.2s ease-in-out;
  display: inline-flex;
  align-items: center;
}

.gc-gradebook-btn:hover,
#custom-gradebook-button:hover {
  background-color: var(--uiw-red-dark);
}

/* Grade check modal overlay */
.gc-overlay,
#gc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

/* Grade check modal */
.gc-modal,
#gc-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  z-index: 10000;
  font-family: var(--uiw-font-family);
  overflow: hidden;
}

/* Modal header */
.gc-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: var(--uiw-bg-light);
  display: flex;
  align-items: center;
}

.gc-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--uiw-text-primary);
  display: flex;
  align-items: center;
}

.gc-modal-header svg {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  fill: var(--uiw-red);
}

/* Modal content */
.gc-modal-content {
  padding: 20px;
  max-height: 55vh;
  overflow-y: auto;
  color: var(--uiw-text-primary);
  line-height: 1.5;
}

/* Modal footer */
.gc-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e0e0e0;
  background: var(--uiw-bg-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Grade check buttons */
.gc-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--uiw-font-family);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gc-btn-primary {
  background-color: var(--uiw-red);
  color: white;
}

.gc-btn-primary:hover {
  background-color: var(--uiw-red-dark);
}

.gc-btn-secondary {
  background-color: var(--uiw-text-muted);
  color: white;
}

.gc-btn-secondary:hover {
  background-color: #5a6268;
}

.gc-btn-success {
  background-color: #28a745;
  color: white;
}

.gc-btn-success:hover {
  background-color: #218838;
}

.gc-btn-outline {
  background-color: transparent;
  color: var(--uiw-text-muted);
  border: 1px solid var(--uiw-text-muted);
}

.gc-btn-outline:hover {
  background-color: var(--uiw-bg-light);
}

/* Loading spinner */
.gc-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--uiw-red);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: gc-spin 1s linear infinite;
}

@keyframes gc-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Result states */
.gc-success,
.gc-error,
.gc-loading,
.gc-confirmation {
  text-align: center;
  padding: 20px;
}

.gc-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gc-icon svg {
  width: 32px;
  height: 32px;
  fill: white;
}

.gc-icon-primary {
  background: var(--uiw-red);
}

.gc-icon-success {
  background: #28a745;
}

.gc-icon-error {
  background: #dc3545;
}

/* Warning banner */
.gc-warning-banner {
  padding: 16px 20px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 6px;
  margin-bottom: 16px;
  text-align: center;
}

.gc-warning-banner h3 {
  color: #000;
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
}

.gc-warning-banner p {
  color: #000;
  font-size: 14px;
  margin: 0;
}

/* Results list */
.gc-results-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
}

.gc-assignment-group {
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
}

.gc-assignment-group:last-child {
  border-bottom: none;
}

.gc-even {
  background: #ffffff;
}

.gc-odd {
  background: var(--uiw-bg-light);
}

.gc-assignment-name {
  font-weight: 700;
  color: var(--uiw-text-primary);
  font-size: 15px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e9ecef;
}

.gc-assignment-name a {
  color: #0066cc;
  text-decoration: underline;
}

.gc-assignment-name a:hover {
  color: #004499;
}

.gc-students {
  margin-left: 12px;
}

.gc-student {
  font-size: 13px;
  color: var(--uiw-text-secondary);
  margin-bottom: 4px;
  padding: 4px 0;
}

/* Note section */
.gc-note {
  padding: 14px 18px;
  background: #e9ecef;
  border-radius: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--uiw-text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.gc-note svg {
  width: 18px;
  height: 18px;
  fill: var(--uiw-text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Export selection */
.gc-export-selection {
  text-align: center;
  padding: 30px 20px;
}

.gc-export-selection h3 {
  color: var(--uiw-text-primary);
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
}

.gc-export-selection p {
  margin: 0 0 25px 0;
  color: var(--uiw-text-secondary);
  font-size: 16px;
}

.gc-export-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}

/* Feature list in confirmation */
.gc-feature-list {
  background: var(--uiw-bg-light);
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 16px;
  margin: 20px auto;
  text-align: left;
  max-width: 480px;
}

.gc-feature-list ul {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--uiw-text-secondary);
  line-height: 1.6;
}

.gc-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
}

/* ========================================================================
   UTILITY CLASSES
   ======================================================================== */

.gcn_tray-list-spaced {
  margin-top: 0.5rem;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--ic-link-color, #0374B5);
  outline-offset: 2px;
}