/**
 * Trinity Dashboard Theme
 * Extends ABR Design System with Trinity-specific styling
 *
 * Dependencies: abr-core.css (loads first)
 * Version: 1.0.0
 * Last Updated: 2025-12-02
 */

/* ========================================
   TRINITY-SPECIFIC CSS VARIABLES
   Extend ABR system with Trinity brand colors
   ======================================== */
:root {
  /* Trinity brand colors */
  --trinity-blue: #003a70;
  --trinity-light: #e8f1fa;
  --trinity-gray: #f5f7fa;
  --trinity-dark: #4a4a4a;

  /* Typography (Trinity uses Georgia for headings) */
  --trinity-serif: 'Georgia', serif;
  --trinity-sans: var(--abr-font-body, 'Helvetica Neue', Arial, sans-serif);
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */
.container {
  display: flex;
  height: calc(100vh - 70px);
  overflow: hidden;
}

/* ========================================
   HEADER
   ======================================== */
header {
  background: var(--trinity-blue);
  color: var(--abr-white, #fff);
  padding: var(--abr-space-6, 22px) var(--abr-space-8, 32px);
  font-size: 1.4rem;
  font-family: var(--trinity-serif);
}

/* ========================================
   SIDEBAR (Filters)
   ======================================== */
.sidebar {
  width: 300px;
  background: var(--trinity-gray);
  border-right: 1px solid #d9d9d9;
  padding: var(--abr-space-6, 24px);
  overflow-y: auto;
}

.sidebar h2 {
  font-family: var(--trinity-serif);
  color: var(--trinity-blue);
  font-size: 1.2rem;
  margin-top: 0;
}

/* Filter Control Buttons */
.filter-controls {
  display: flex;
  gap: 8px;
  margin-bottom: var(--abr-space-5, 20px);
  flex-wrap: wrap;
}

.filter-controls button {
  flex: 1;
  min-width: 80px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--trinity-blue);
  border-radius: var(--abr-radius-md, 6px);
  background: var(--abr-white, #fff);
  color: var(--trinity-blue);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-controls button:hover {
  background: var(--trinity-blue);
  color: var(--abr-white, #fff);
}

/* Filter Groups */
.filter-group {
  margin-bottom: var(--abr-space-7, 28px);
}

.filter-group strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--abr-space-2, 8px);
  color: #002a55;
  font-family: var(--trinity-serif);
  cursor: pointer;
  user-select: none;
}

.filter-group strong::after {
  content: '▼';
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.filter-group.collapsed strong::after {
  transform: rotate(-90deg);
}

.filter-group-options {
  overflow: hidden;
  transition: max-height 0.3s ease;
  max-height: 500px;
}

.filter-group.collapsed .filter-group-options {
  max-height: 0;
}

.filter-group label {
  display: block;
  margin: 6px 0;
  cursor: pointer;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */
.main {
  flex: 1;
  padding: var(--abr-space-6, 24px) var(--abr-space-8, 32px);
  overflow-y: auto;
}

/* Search Bar */
.search-bar {
  width: 100%;
  margin-bottom: var(--abr-space-4, 16px);
  display: flex;
  gap: var(--abr-space-3, 12px);
  justify-content: flex-start;
}

.search-bar input {
  flex: 1;
  padding: var(--abr-space-3, 12px) var(--abr-space-4, 16px);
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: var(--abr-radius-md, 6px);
}

/* Role Select Dropdown - 25% width */
.role-box {
  flex: 0 0 25%;
  padding: var(--abr-space-3, 12px);
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: var(--abr-radius-md, 6px);
  min-width: 0;
}

/* Search input - takes remaining 75% */
.search-bar input {
  flex: 1;
}

/* ========================================
   RECOMMENDATIONS PANEL
   ======================================== */
#recommendedPanel {
  background: #f1f6fc;
  border: 1px solid #d4e2f5;
  padding: var(--abr-space-4, 16px);
  border-radius: var(--abr-radius-md, 6px);
  margin-bottom: var(--abr-space-6, 24px);
}

#recommendedPanel h3 {
  margin-top: 0;
  font-family: var(--trinity-serif);
  font-size: 1.1rem;
  color: var(--trinity-blue);
}

#recommendedList {
  margin: 0;
  padding-left: 1.5rem;
}

.rec-item {
  font-size: 0.9rem;
  margin: 8px 0;
  padding-left: 4px;
}

.rec-item a {
  color: var(--trinity-blue);
  text-decoration: none;
}

.rec-item a:hover {
  text-decoration: underline;
}

/* ========================================
   STATUS BAR
   ======================================== */
#statusBar {
  margin: 0 0 var(--abr-space-6, 22px) 0;
  font-size: 0.95rem;
  color: var(--trinity-blue);
  font-weight: 600;
  text-align: center;
}

/* ========================================
   CARD GRID
   ======================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--abr-space-6, 24px);
}

/* ========================================
   RESOURCE CARDS
   ======================================== */
.card {
  background: var(--abr-white, #fff);
  border-radius: var(--abr-radius-lg, 8px);
  padding: var(--abr-space-5, 20px);
  box-shadow: var(--abr-shadow-md, 0 5px 12px rgba(0, 0, 0, 0.06));
  transition: var(--abr-transition-base, 0.25s);
  cursor: pointer;
  border-left: 6px solid var(--trinity-blue);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--abr-shadow-xl, 0 10px 20px rgba(0, 0, 0, 0.12));
}

.card h3 {
  font-family: var(--trinity-serif);
  font-size: 1.15rem;
  color: var(--trinity-blue);
  margin-top: 0;
}

.card .meta {
  font-size: 0.9rem;
  color: #666;
  margin: 6px 0;
}

/* ========================================
   TAGS / BADGES
   ======================================== */
.tag-bar {
  display: none;
  margin-top: var(--abr-space-4, 14px);
  padding-top: var(--abr-space-3, 10px);
  border-top: 1px solid #e6e6e6;
  flex-wrap: wrap;
  gap: var(--abr-space-2, 8px);
}

.tag {
  background: var(--trinity-light);
  color: var(--trinity-blue);
  border: 1px solid #c7d7ea;
  padding: var(--abr-space-1, 4px) var(--abr-space-3, 10px);
  border-radius: var(--abr-radius-full, 14px);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  user-select: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #d9d9d9;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 640px) {
  .search-bar {
    flex-direction: column;
  }

  .role-box {
    width: 100%;
    min-width: unset;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: var(--abr-space-4, 16px);
  }
}

/* ========================================
   STYLE PATCHES (merged from theme)
   ======================================== */
.filter-group label input {
  margin-right: 2px;
}

.card .meta {
  color: #333;
  font-weight: 500;
}

.card h3 a {
  color: var(--trinity-blue);
  text-decoration: none;
  font-weight: 600;
}

.search-bar {
  margin-bottom: 22px;
  gap: 16px;
  align-items: center;
}

header {
  padding: 16px 28px;
  font-size: 1.25rem;
  line-height: 1.2;
  display: flex;
  align-items: center;
}

/* ========================================
   LEARNING TRAY (Flashcards & Quiz)
   Slide-out sidebar for role-based learning
   ======================================== */
.learning-tray {
  position: fixed;
  right: -600px;
  top: 0;
  width: 600px;
  height: 100vh;
  background: var(--abr-white, #fff);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  overflow-y: auto;
}

.learning-tray--open {
  right: 0;
}

.tray-header {
  background: var(--trinity-blue);
  color: var(--abr-white, #fff);
  padding: var(--abr-space-5, 20px) var(--abr-space-6, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tray-header h3 {
  margin: 0;
  font-family: var(--trinity-serif);
  font-size: 1.2rem;
}

.tray-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--abr-white, #fff);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.tray-close:hover {
  opacity: 1;
}

.tray-content {
  padding: var(--abr-space-6, 24px);
}

.tray-section {
  display: none;
}

.tray-section--active {
  display: block;
}

/* Overlay */
.tray-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 9998;
}

.tray-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   FLASHCARD STYLES
   Reuses .card base styling
   ======================================== */
.flashcard {
  background: var(--abr-white, #fff);
  border-radius: var(--abr-radius-lg, 8px);
  padding: var(--abr-space-6, 24px);
  box-shadow: var(--abr-shadow-md, 0 5px 12px rgba(0, 0, 0, 0.06));
  border-left: 6px solid var(--trinity-blue);
  margin-bottom: var(--abr-space-5, 20px);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.flashcard:hover {
  transform: translateY(-2px);
  box-shadow: var(--abr-shadow-xl, 0 10px 20px rgba(0, 0, 0, 0.12));
}

.flashcard-question {
  font-family: var(--trinity-serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--trinity-blue);
  margin-bottom: var(--abr-space-3, 12px);
}

.flashcard-answer {
  display: none;
  color: var(--trinity-dark, #4a4a4a);
  line-height: 1.6;
  padding-top: var(--abr-space-3, 12px);
  border-top: 1px solid #e6e6e6;
}

.flashcard--revealed .flashcard-answer {
  display: block;
}

.flashcard-hint {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  margin-top: var(--abr-space-2, 8px);
}

.flashcard--revealed .flashcard-hint {
  display: none;
}

.flashcard-source {
  display: none;
  font-size: 0.8rem;
  color: #777;
  margin-top: var(--abr-space-3, 12px);
  padding-top: var(--abr-space-2, 8px);
  border-top: 1px dashed #ddd;
  font-style: italic;
}

.flashcard--revealed .flashcard-source {
  display: block;
}

/* Flashcard Navigation - reuses .filter-controls button */
.flashcard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--abr-space-5, 20px);
  padding-top: var(--abr-space-4, 16px);
  border-top: 1px solid #e6e6e6;
}

.flashcard-nav button {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--trinity-blue);
  border-radius: var(--abr-radius-md, 6px);
  background: var(--abr-white, #fff);
  color: var(--trinity-blue);
  cursor: pointer;
  transition: all 0.2s ease;
}

.flashcard-nav button:hover:not(:disabled) {
  background: var(--trinity-blue);
  color: var(--abr-white, #fff);
}

.flashcard-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.flashcard-counter {
  font-size: 0.9rem;
  color: var(--trinity-dark, #4a4a4a);
  font-weight: 600;
}

/* ========================================
   QUIZ CONTAINER
   Wrapper for AI Engine chatbot
   ======================================== */
.quiz-container {
  min-height: 400px;
}

.quiz-intro {
  background: var(--trinity-light);
  border-radius: var(--abr-radius-md, 6px);
  padding: var(--abr-space-5, 20px);
  margin-bottom: var(--abr-space-5, 20px);
}

.quiz-intro h4 {
  font-family: var(--trinity-serif);
  color: var(--trinity-blue);
  margin-top: 0;
}

.quiz-intro p {
  color: var(--trinity-dark, #4a4a4a);
  line-height: 1.6;
  margin-bottom: 0;
}

/* ========================================
   LEARNING ACTION BUTTONS
   Added to search bar area
   ======================================== */
.learning-actions {
  display: flex;
  gap: var(--abr-space-2, 8px);
  margin-left: auto;
}

.btn-learning {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--trinity-blue);
  border-radius: var(--abr-radius-md, 6px);
  background: var(--trinity-light);
  color: var(--trinity-blue);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-learning:hover {
  background: var(--trinity-blue);
  color: var(--abr-white, #fff);
}

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

.btn-learning .icon {
  font-size: 1rem;
}

/* ========================================
   LEARNING TRAY RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .learning-tray {
    width: 100%;
    right: -100%;
  }

  .learning-actions {
    width: 100%;
    margin-left: 0;
    margin-top: var(--abr-space-3, 12px);
  }

  .btn-learning {
    flex: 1;
    justify-content: center;
  }
}
