/* ====== 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;
  --brand-success: #28a745;
  --brand-info: #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;
  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);
}

/* ====== UNIT HEADER SECTION ====== */
.unit-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);
}

.unit-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);
}

.unit-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;
}

.unit-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);
}

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

.unit-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;
}

/* ====== LIST SECTIONS ====== */
.section-title {
  font-size: 1.8rem;
  margin: 0 0 1.5rem;
  color: var(--brand-black);
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--brand-gold);
  position: relative;
  font-weight: 800;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-gold), transparent);
}

.list-container {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 2rem;
}

.list-group-item {
  border: none;
  background-color: white;
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  transition: var(--transition);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 15px;
}

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

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

.list-group-item a {
  color: var(--brand-dark);
  font-weight: 600;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.list-group-item .period-icon {
  background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-dark) 100%);
  color: var(--brand-gold);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 2px solid var(--brand-gold);
}

.list-group-item .topic-icon {
  background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-light) 100%);
  color: var(--brand-black);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 2px solid var(--brand-gold);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--brand-gray);
}

.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;
  color: var(--brand-black);
}

/* ====== STICKY SIDEBAR ====== */
.sidebar-column {
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 15px;
}

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

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

.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 .category-group {
    margin-bottom: 1.5rem;
    padding: 0 1.25rem;
}

.sidebar-card .category-header {
    background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-light) 100%);
    color: var(--brand-black);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 10px;
    border-left: 4px solid var(--brand-black);
}

.sidebar-card .category-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.sidebar-card .category-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-card .category-list li:last-child {
    border-bottom: none;
}

.unit-link {
    color: var(--brand-dark);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.unit-link::before {
    content: '📚';
    font-size: 0.9rem;
}

.unit-link:hover {
    color: var(--brand-gold);
    text-decoration: none;
    padding-left: 5px;
}

.current-unit {
    background-color: var(--brand-gold-pale);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    color: var(--brand-black) !important;
    border-left: 3px solid var(--brand-gold);
}

/* ====== SYNC BANNER ====== */
.unit-sync-banner {
    border-left: 4px solid var(--brand-gold) !important;
    transition: all 0.3s ease;
    background-color: white;
}

.sync-icon-circle {
    transition: transform 0.3s ease;
    color: var(--brand-gold);
}

#sync-unit-btn:hover .fa-sync-alt {
    animation: rotateIcon 1s linear infinite;
}

/* Success Toast Styling */
.sync-success-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-black);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    border-left: 4px solid var(--brand-gold);
    animation: slideDown 0.5s ease forwards;
}

@keyframes slideDown {
    from { top: -100px; opacity: 0; }
    to { top: 20px; opacity: 1; }
}

.sync-success-toast.fade-out {
    opacity: 0;
    top: -20px;
    transition: all 0.5s ease;
}

/* Success Button Pulse */
.btn-success {
    animation: pulse-gold 2s infinite;
    background: var(--brand-gold) !important;
    border-color: var(--brand-gold) !important;
    color: var(--brand-black) !important;
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(218, 165, 32, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(218, 165, 32, 0); }
    100% { box-shadow: 0 0 0 0 rgba(218, 165, 32, 0); }
}

@keyframes rotateIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ====== RESPONSIVE - MOBILE STYLES ====== */
@media (max-width: 768px) {
    .unit-header {
        padding: 1.75rem;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .unit-header h1 {
        font-size: 2rem;
    }
    
    .unit-header .lead {
        font-size: 1.2rem;
    }
    
    .tab-navigation {
        flex-direction: column;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
        padding: 0.5rem 0.5rem;
    }
    
    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .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;
        padding: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .list-container {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
    
    .list-group-item {
        padding: 1rem 1rem;
    }
    
    .list-group-item a {
        font-size: 1rem;
    }
    
    .list-group-item .period-icon,
    .list-group-item .topic-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .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;
    }
    
    .unit-sync-banner {
        text-align: left;
        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;
    }
    
    .empty-state {
        padding: 2rem 1rem;
    }
}