:root {
    --primary-dark: #121212;
    --secondary-dark: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #9e9e9e;
    --accent: #9c27b0;
    --danger: #ff6489;
    --warning: #ffd700;
    --success: #64ff8a;
    --info: #6495ed;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--primary-dark);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Light mode styles */
body.light-mode {
    --primary-dark: #ffffff;
    --secondary-dark: #f0f4f8;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --accent: #0d6efd;
    --danger: #dc3545;
    --warning: #ffc107;
    --success: #28a745;
    --info: #17a2b8;
    color: var(--text-primary);
}

.container {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
}

.main-content {
    flex: 1;
    padding-left: 20px;
    max-width: calc(100% - 250px);
}

header {
    padding: 1rem;
    background-color: var(--secondary-dark);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 95%;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-svg {
    width: 40px;
    height: 50px;
    transition: transform 0.3s ease;
}

.logo-container:hover .logo-svg {
    transform: scale(1.1);
}

body.light-mode .shield-outline {
    stroke: #0d6efd;
}

.back-button {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.back-button i {
    margin-right: 5px;
}

.back-button:hover {
    transform: translateX(-3px);
}

.citation {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dotted rgba(156, 39, 176, 0.3);
}

h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--accent);
}

h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h2.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h2.collapsible::after {
    content: '\f107'; /* Font Awesome arrow down */
    font-family: 'Font Awesome 5 Free', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--accent);
    transition: transform 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(156, 39, 176, 0.15);
}

body.light-mode h2.collapsible::after {
    background-color: rgba(13, 110, 253, 0.1);
}

h2.collapsible.active::after {
    transform: rotate(180deg);
}

.principle-section .content {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.3s ease;
}

.principle-section .content.active {
    max-height: 5000px; /* Large enough to contain content */
    opacity: 1;
}

.principle-section {
    transition: margin 0.3s ease;
    margin-bottom: 1rem;
}

.principle-section h2.collapsible {
    margin-bottom: 0;
}

.principle-section h2.collapsible.active {
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.4rem;
    color: var(--accent);
}

.nav-container {
    width: 250px;
    position: sticky;
    top: 80px;
    z-index: 90;
    height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

nav {
    background-color: var(--secondary-dark);
    padding: 1.2rem;
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    height: 100%;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

nav ul li {
    margin-bottom: 6px;
    width: 100%;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-primary);
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: 100%;
    border-left: 3px solid transparent;
}

nav ul li a::before {
    content: '\f105';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 8px;
    color: var(--accent);
    transition: transform 0.2s ease;
}

nav ul li a:hover {
    background-color: rgba(156, 39, 176, 0.15);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-left: 3px solid var(--accent);
}

nav ul li a:hover::before {
    transform: translateX(3px);
}

nav ul li a.active {
    background-color: rgba(156, 39, 176, 0.2);
    color: var(--accent);
    border-left: 3px solid var(--accent);
    font-weight: 600;
}

/* Light mode nav styles */
body.light-mode nav ul li a {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

body.light-mode nav ul li a:hover {
    background-color: rgba(13, 110, 253, 0.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-left: 3px solid var(--accent);
}

body.light-mode nav ul li a.active {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Make nav sidebar position better */
.nav-container nav {
    position: sticky;
    top: 20px;
}

/* Improve style of nav items */
nav ul li a {
    border-left-width: 4px;
    font-size: 0.95rem;
}

/* Highlight current section more clearly */
nav ul li a.active::before {
    transform: translateX(3px);
    color: var(--accent);
}

/* Add section title to sidebar */
.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(156, 39, 176, 0.3);
}

body.light-mode .nav-title {
    border-bottom: 1px solid rgba(13, 110, 253, 0.2);
}

/* References section styling */
.references-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: var(--secondary-dark);
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.references-section h2 {
    color: var(--accent);
    margin-bottom: 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.references-section h2::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--accent);
    transition: transform 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(156, 39, 176, 0.15);
}

.references-section h2.active::after {
    transform: rotate(180deg);
}

.references {
    padding-left: 1.5rem;
    line-height: 1.7;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.references li {
    margin-bottom: 0.75rem;
}

body.light-mode .references-section {
    background-color: var(--secondary-dark);
    border-left: 4px solid var(--accent);
}

.references-link {
    margin-top: 20px;
}

/* Adjust footer position */
footer {
    width: 100%;
    margin-left: 0;
}

/* Mobile nav styles */
/* Nav toggle button */
.nav-toggle {
    display: none;
    background-color: var(--secondary-dark);
    color: var(--accent);
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 10px;
    font-weight: 600;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.nav-toggle i {
    margin-right: 8px;
}

.nav-toggle:hover {
    background-color: rgba(156, 39, 176, 0.15);
}

body.light-mode .nav-toggle {
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(13, 110, 253, 0.2);
}

body.light-mode .nav-toggle:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }
    
    .nav-container {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        margin-bottom: 20px;
    }
    
    .main-content {
        max-width: 100%;
        padding-left: 0;
    }
    
    nav {
        height: auto;
        display: none;
    }
    
    nav.active {
        display: block;
        animation: slideDown 0.3s ease forwards;
    }
    
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Adjust section scroll margin for mobile */
    .principle-section {
        scroll-margin-top: 80px;
    }
}

.principle-section {
    background-color: var(--secondary-dark);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    scroll-margin-top: 120px; /* Ensures sufficient space when scrolling to section */
}

.card {
    background-color: rgba(17, 34, 64, 0.6);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--accent);
}

body.light-mode .card {
    background-color: rgba(255, 255, 255, 0.9);
    border-left: 4px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light-mode .principle-section {
    background-color: var(--secondary-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

body.light-mode .topic-card {
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light-mode .topic-card-header {
    background-color: rgba(13, 110, 253, 0.05);
    border-bottom: 2px solid var(--accent);
}

body.light-mode .example {
    background-color: rgba(13, 110, 253, 0.05);
    border-left: 3px solid var(--accent);
}

body.light-mode .challenge {
    background-color: rgba(220, 53, 69, 0.05);
    border-left: 3px solid var(--danger);
}

body.light-mode .tool {
    background-color: rgba(23, 162, 184, 0.05);
    border-left: 3px solid var(--info);
}

body.light-mode .action-step {
    background-color: rgba(40, 167, 69, 0.05);
    border-left: 3px solid var(--success);
}

body.light-mode .topic-button {
    border: 1px solid var(--accent);
    color: var(--accent);
}

body.light-mode .topic-button:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

body.light-mode nav ul li a:hover {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--accent);
}

body.light-mode footer {
    background-color: var(--secondary-dark);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode #to-top {
    background-color: var(--accent);
    color: white;
}

body.light-mode nav {
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light-mode header {
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .quote {
    border-left: 4px solid var(--accent);
    color: var(--text-secondary);
    background-color: rgba(13, 110, 253, 0.03);
}

.card-title {
    color: var(--accent);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.example {
    background-color: rgba(156, 39, 176, 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid var(--accent);
}

.example-title {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.challenge {
    background-color: rgba(255, 100, 137, 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid var(--danger);
}

.challenge-title {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--danger);
}

.tool {
    background-color: rgba(100, 149, 237, 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid var(--info);
}

.tool-title {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--info);
}

.action-step {
    background-color: rgba(100, 255, 138, 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid var(--success);
}

.interactive-tool-link {
    margin-top: 20px;
    text-align: center;
}

.interactive-tool-link .action-button {
    display: inline-block;
    background-color: var(--accent);
    color: var(--primary-dark);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.interactive-tool-link .action-button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    background-color: var(--secondary-dark);
    color: var(--text-secondary);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

.topic-card {
    background-color: var(--secondary-dark);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.topic-card-header {
    background-color: rgba(156, 39, 176, 0.15);
    padding: 15px;
    border-bottom: 2px solid var(--accent);
    min-height: 70px;
    display: flex;
    align-items: center;
}

.topic-card-header h3 {
    width: 100%;
    margin: 0;
}

.topic-card-body {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-text {
    flex-grow: 1;
}

.card-footer {
    margin-top: 15px;
}

.badge {
    display: inline-block;
}

.topic-card-footer {
    padding: 15px;
    border-top: 1px solid rgba(100, 255, 218, 0.2);
    display: flex;
    justify-content: flex-end;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
}

.badge-technical {
    background-color: rgba(100, 149, 237, 0.2);
    color: var(--info);
}

.badge-adaptive {
    background-color: rgba(255, 100, 137, 0.2);
    color: var(--danger);
}

.badge-both {
    background-color: rgba(255, 215, 0, 0.2);
    color: var(--warning);
}

.topic-button {
    background-color: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.topic-button:hover {
    background-color: rgba(100, 255, 218, 0.1);
}

.quote {
    font-style: italic;
    border-left: 4px solid var(--accent);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
}

.quote-attribution {
    display: block;
    text-align: right;
    margin-top: 10px;
    color: var(--text-primary);
    font-style: normal;
}

.book-recommendation {
    background-color: rgba(156, 39, 176, 0.08);
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
    border: 1px solid rgba(156, 39, 176, 0.3);
    text-align: center;
}

.book-recommendation a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.book-recommendation a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

body.light-mode .book-recommendation {
    background-color: rgba(156, 39, 176, 0.05);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-left {
        margin-bottom: 10px;
        width: 100%;
    }
    .header-actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
    .back-button {
        margin-bottom: 10px;
    }
    nav ul {
        flex-direction: column;
    }
    .topic-grid {
        grid-template-columns: 1fr;
    }
}

#to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--accent);
    color: var(--primary-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

#to-top.visible {
    opacity: 1;
}

/* Detail sections for expanded applications */
.detail-section {
    background-color: rgba(156, 39, 176, 0.08);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    border-left: 4px solid var(--accent);
    display: none;
}

.detail-section.active {
    display: block;
    animation: fadeIn 0.5s ease forwards;
}

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

.back-link {
    display: inline-block;
    margin-top: 1.5rem;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-link:hover {
    transform: translateX(-3px);
}

body.light-mode .detail-section {
    background-color: rgba(13, 110, 253, 0.05);
    border-left: 4px solid var(--accent);
}