/* ====== GLOBAL STYLES ====== */
:root {
  --brand-black: #1a1a1a;
  --brand-dark: #2c2c2c;
  --brand-gold: #DAA520;
  --brand-gold-light: #F0B800;
  --brand-gold-soft: #FFD966;
  --brand-gold-pale: #FFF3CD;
  --brand-gray: #6c757d;
  --success-color: #28a745;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --border-color: #e9ecef;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 6px 25px rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

body {
  background-color: #f8fafc !important;
  font-family: 'Montserrat', sans-serif;
  color: #2c3e50;
  line-height: 1.6;
  padding-bottom: 2rem;
}

a {
  text-decoration: none;
  transition: var(--transition);
}

.container {
  margin-top: 30px;
}

/* ====== NAVIGATION BREADCRUMBS ====== */
.nav-breadcrumbs {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--brand-gold);
}

.nav-breadcrumbs a {
    text-decoration: none;
    font-weight: 600;
    color: var(--brand-gray);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
}

.nav-breadcrumbs a:hover {
    background-color: var(--brand-gold-pale);
    color: var(--brand-gold);
    transform: translateY(-1px);
}

.nav-breadcrumbs .separator {
    color: var(--brand-gold);
    margin: 0 8px;
    font-weight: 300;
}

.nav-breadcrumbs .current-page {
    color: var(--brand-gold);
    font-weight: 700;
    padding: 4px 12px;
    background-color: var(--brand-gold-pale);
    border-radius: 4px;
}

/* ====== BUTTON GROUP ====== */
.btn-group-custom {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.action-btn {
  background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-dark) 100%);
  color: white;
  border: 2px solid var(--brand-black);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  background: var(--brand-black);
  color: white;
}

.action-btn.download {
  background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-light) 100%);
  color: var(--brand-black);
  border: 2px solid var(--brand-gold);
  box-shadow: 0 3px 10px rgba(218, 165, 32, 0.2);
}

.action-btn.download:hover {
  background: var(--brand-gold-light);
  border-color: var(--brand-gold-light);
  box-shadow: 0 5px 15px rgba(218, 165, 32, 0.3);
}

/* ====== TOPIC HEADER SECTION ====== */
.topic-header {
  background: linear-gradient(135deg, var(--brand-black) 0%, #000000 100%);
  color: white;
  padding: 2.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  border-bottom: 4px solid var(--brand-gold);
}

.topic-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(218, 165, 32, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
    transform: rotate(15deg);
}

.topic-header h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
  color: white;
}

.topic-header .lead {
  font-size: 1.5rem;
  opacity: 0.9;
  font-weight: 600;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
  color: var(--brand-gold-soft);
}

.topic-header .description {
  font-size: 1.1rem;
  opacity: 0.8;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.topic-badge {
  background-color: rgba(218, 165, 32, 0.2);
  color: var(--brand-gold);
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  position: relative;
  z-index: 1;
  border: 1px solid var(--brand-gold);
  display: inline-block;
  margin-top: 1rem;
}

/* ====== TAB NAVIGATION ====== */
.tab-navigation {
  background: white;
  border-radius: var(--border-radius);
  padding: 0.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 1rem;
  border: 1px solid var(--border-color);
}

.tab-button {
  flex: 1;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-gray);
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

.tab-button:hover {
  background-color: var(--brand-gold-pale);
  color: var(--brand-gold);
}

.tab-button.active {
  background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-dark) 100%);
  color: white;
  border-bottom: 3px solid var(--brand-gold);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* ====== TAB CONTENT ====== */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-content.active {
  display: block;
}

/* ====== PERIOD GROUP STYLING ====== */
.period-group {
  margin-bottom: 2.5rem;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.period-header {
  background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-dark) 100%);
  color: white;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 3px solid var(--brand-gold);
}

.period-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.period-link {
  color: white;
  text-decoration: none;
  transition: var(--transition);
}

.period-link:hover {
  color: var(--brand-gold-soft);
  transform: translateX(5px);
}

.period-badge {
  background: rgba(218, 165, 32, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-gold);
  border: 1px solid rgba(218, 165, 32, 0.3);
}

/* ====== QUESTION CARD STYLING - LIVELY ====== */
.question-card {
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.question-card:last-child {
  border-bottom: none;
}

.question-card:hover {
  background-color: rgba(218, 165, 32, 0.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.question-card .card-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 2px solid var(--border-color);
  padding: 1.5rem 1.5rem;
  position: relative;
}

.question-card .card-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 80px;
  height: 2px;
  background: var(--brand-gold);
}

.question-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand-gold);
  margin-right: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.question-number::before {
  content: 'Q';
  background: var(--brand-gold);
  color: var(--brand-black);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(218, 165, 32, 0.3);
}

/* ====== QUESTION TEXT - GOLD LEFT BORDER ====== */
.question-text {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--dark-color);
  padding: 1.5rem;
  background-color: #f8fafc;
  border-radius: 6px;
  margin-bottom: 1rem;
  border-left: 4px solid var(--brand-gold);
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* ====== ANSWER SECTION - SUBTLE OUTER BORDER, VIBRANT GREEN INNER BORDER ====== */
.answer-content {
  margin-top: 1rem;
  padding: 1rem !important;
  background: white !important;
  border-radius: var(--border-radius) !important;
  border: 1px solid var(--border-color) !important; /* Light gray subtle border */
  box-shadow: var(--shadow-sm) !important;
  animation: slideDown 0.3s ease;
  position: relative !important;
  overflow: hidden !important;
}

/* Remove any Bootstrap border classes that might be applied */
.answer-content.border-start,
.answer-content.border-4,
.answer-content.border-success {
  border-left: none !important;
  border-width: 0 !important;
  border-color: transparent !important;
}

/* Vibrant green inner border (left side) */
.answer-content::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 6px !important; /* Slightly thicker for emphasis */
  height: 100% !important;
  background: var(--success-color) !important; /* Vibrant green */
  border-radius: var(--border-radius) 0 0 var(--border-radius) !important;
  z-index: 1 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1) !important; /* Subtle highlight */
}

/* Subtle green shine effect */
.answer-content::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.03) 0%, transparent 70%) !important;
  pointer-events: none !important;
  border-radius: inherit !important;
  z-index: 0 !important;
}

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

/* Answer headings with green accent */
.answer-content h6 {
  color: var(--brand-black) !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
  font-size: 1.2rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  position: relative !important;
  z-index: 2 !important;
}

.answer-content h6 i {
  color: var(--success-color) !important; /* Green icons */
}

.answer-content .answer-text {
  background-color: white !important;
  padding: 1rem !important;
  border-radius: 4px !important;
  border: 1px solid var(--border-color) !important;
  margin-bottom: 1rem !important;
  line-height: 1.7 !important;
  position: relative !important;
  z-index: 2 !important;
}

.answer-content .workings-text {
  border-left: 3px solid var(--brand-gold-soft) !important;
  padding-left: 1rem !important;
  margin-top: 1rem !important;
  background: #fafafa !important;
  padding: 1rem !important;
  border-radius: 0 4px 4px 0 !important;
  line-height: 1.7 !important;
  position: relative !important;
  z-index: 2 !important;
}

/* Offline badge styling */
.answer-content .text-muted {
  color: var(--brand-gray) !important;
  font-size: 0.75rem !important;
  position: relative !important;
  z-index: 2 !important;
}

/* ====== BUTTONS BAR - COLORFUL BUTTONS ====== */
.buttons-bar {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 1rem !important;
  margin-top: 1rem !important;
  padding: 1.25rem !important;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
  border-radius: var(--border-radius) !important;
  border: 1px solid var(--border-color) !important;
}

.buttons-left, 
.buttons-right {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  align-items: center !important;
}

.buttons-bar .btn {
  padding: 10px 20px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  border-radius: 30px !important;
  transition: var(--transition) !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: 2px solid transparent !important;
  min-width: 130px !important;
  justify-content: center !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.buttons-bar .btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Show Answer button - GOLD (primary action) */
.buttons-left .show-answer-btn {
  background: var(--brand-gold) !important;
  color: var(--brand-black) !important;
  border: 2px solid var(--brand-gold) !important;
  font-weight: 700 !important;
}

.buttons-left .show-answer-btn:hover {
  background: var(--brand-gold-light) !important;
  border-color: var(--brand-gold-light) !important;
}

/* When answer is showing - DARK GRAY (state change) */
.buttons-left .show-answer-btn.btn-dark {
  background: var(--brand-dark) !important;
  color: white !important;
  border: 2px solid var(--brand-dark) !important;
}

.buttons-left .show-answer-btn.btn-dark:hover {
  background: var(--brand-black) !important;
  border-color: var(--brand-black) !important;
}

/* PDF Download button - SUCCESS GREEN */
.buttons-left a.btn-outline-success {
  background: var(--success-color) !important;
  color: white !important;
  border: 2px solid var(--success-color) !important;
}

.buttons-left a.btn-outline-success:hover {
  background: #218838 !important;
  border-color: #218838 !important;
}

/* Video button - INFO BLUE */
.buttons-right .btn {
  background: var(--info-color) !important;
  color: white !important;
  border: 2px solid var(--info-color) !important;
}

.buttons-right .btn:hover {
  background: #138496 !important;
  border-color: #138496 !important;
}

/* ====== DOWNLOAD BANNER ====== */
.download-banner {
  background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
  border: 2px solid var(--brand-gold);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.download-banner-content {
  flex: 1;
  min-width: 300px;
}

.download-banner h4 {
  color: var(--brand-gold);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.download-banner p {
  color: var(--brand-gold-soft);
  opacity: 0.9;
  margin: 0;
}

.download-banner .btn {
  background: var(--brand-gold);
  border: 2px solid var(--brand-gold);
  color: var(--brand-black);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 30px;
  transition: var(--transition);
  box-shadow: 0 3px 8px rgba(218, 165, 32, 0.2);
  white-space: nowrap;
}

.download-banner .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(218, 165, 32, 0.3);
  background: var(--brand-gold-light);
  border-color: var(--brand-gold-light);
}

/* Sync button specific */
#sync-topic-btn {
  background: var(--brand-gold);
  border: 2px solid var(--brand-gold);
  color: var(--brand-black);
}

#sync-topic-btn.btn-success {
  background: var(--success-color) !important;
  border-color: var(--success-color) !important;
  color: white !important;
}

/* ====== STICKY SIDEBAR ====== */
.sidebar-column {
    position: sticky;
    top: 80px;
    align-self: flex-start;
    height: auto;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 15px;
}

.sidebar-column::-webkit-scrollbar {
    width: 6px;
}

.sidebar-column::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sidebar-column.auto-height {
    max-height: none !important;
    overflow-y: visible !important;
}

.sidebar-column::-webkit-scrollbar-thumb {
    background: var(--brand-gold);
    border-radius: 3px;
}

.sidebar-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    background: white;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid var(--brand-gold-pale);
}

.sidebar-card .card-header {
    background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-dark) 100%);
    color: white;
    padding: 1.25rem;
    font-weight: 700;
    font-size: 1.2rem;
    border-bottom: 3px solid var(--brand-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-card .list-group-item {
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.25rem;
    transition: var(--transition);
}

.sidebar-card .list-group-item:last-child {
    border-bottom: none;
}

.sidebar-card .list-group-item:hover {
    background-color: var(--brand-gold-pale);
    padding-left: 1.5rem;
}

.sidebar-card .list-group-item a {
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-card .list-group-item a::before {
    content: '📚';
    font-size: 0.9rem;
}

.sidebar-card .list-group-item a:hover {
    color: var(--brand-gold);
    text-decoration: none;
}

.sidebar-card .list-group-item.active {
    background-color: var(--brand-gold-pale);
    border-left: 3px solid var(--brand-gold);
}

.sidebar-card .list-group-item.active a {
    color: var(--brand-gold);
    font-weight: 600;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--brand-gray);
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
  color: var(--brand-gold);
}

.empty-state h4 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 992px) {
  .buttons-bar .btn {
    min-width: 120px !important;
    padding: 8px 16px !important;
  }
}

@media (max-width: 768px) {
    .topic-header {
        padding: 1.75rem;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .topic-header h1 {
        font-size: 2rem;
    }
    
    .topic-header .lead {
        font-size: 1.2rem;
    }
    
    .tab-navigation {
        flex-direction: column;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .btn-group-custom {
        flex-direction: column;
        align-items: stretch;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        gap: 0.5rem;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
        border-radius: 0;
    }
    
    .question-card .card-header {
        padding: 1.25rem;
    }
    
    .question-number {
        font-size: 1.2rem;
    }
    
    .question-number::before {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .question-text {
        padding: 1.25rem;
        font-size: 1rem;
    }
    
    .answer-content {
        padding: 1.25rem !important;
    }
    
    .buttons-bar {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
        padding: 1rem !important;
    }
    
    .buttons-left, 
    .buttons-right {
        flex: 1 1 auto !important;
        justify-content: flex-start !important;
    }
    
    .buttons-bar .btn {
        min-width: 110px !important;
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .sidebar-column {
        position: static;
        max-height: none;
        margin-top: 2rem;
        padding-right: 0;
    }
    
    .sidebar-card {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .download-banner {
        flex-direction: column;
        text-align: center;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .download-banner-content {
        min-width: auto;
    }
    
    .period-header {
        flex-direction: column;
        align-items: flex-start;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .period-group {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .nav-breadcrumbs {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .buttons-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .buttons-left, 
    .buttons-right {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .buttons-bar .btn {
        width: 100% !important;
        max-width: none !important;
        padding: 10px !important;
    }
    
    .topic-header h1 {
        font-size: 1.8rem;
    }
    
    .question-text {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .answer-content {
        padding: 1rem !important;
    }
}

/* Row alignment */
.row {
    align-items: flex-start;
}