/* Chapter Content Styling */
.chapter-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
}

.chapter-container {
    position: relative;
}

/* Chapter Headers */
.chapter-header {
    background: 
        radial-gradient(ellipse at center, rgba(0, 212, 255, 0.15) 0%, transparent 70%),
        linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(26, 26, 46, 0.6) 100%);
    color: white;
    padding: 60px 40px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 50px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.chapter-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        conic-gradient(from 0deg at 50% 50%, 
            rgba(0, 212, 255, 0.1) 0deg, 
            transparent 120deg, 
            rgba(0, 212, 255, 0.05) 240deg, 
            transparent 360deg);
    animation: rotate 20s linear infinite;
}

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

.chapter-header h1 {
    font-size: 3.2em;
    background: linear-gradient(45deg, #00d4ff, #007acc, #0099ff, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
    text-shadow: 0 0 40px rgba(0, 212, 255, 0.5);
    font-weight: 700;
    letter-spacing: -1px;
}

.chapter-header .subtitle {
    font-size: 1.4em;
    opacity: 0.9;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
    color: #a0c4ff;
    font-weight: 300;
}

.chapter-header .date {
    font-size: 1.1em;
    opacity: 0.8;
    position: relative;
    z-index: 2;
    color: #80b3ff;
    font-style: italic;
}

/* Table of Contents */
.toc {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin-bottom: 50px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    position: relative;
    backdrop-filter: blur(10px);
}

.toc::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #00d4ff, #007acc, #0099ff);
    border-radius: 20px 20px 0 0;
}

.toc h2 {
    color: #00d4ff;
    font-size: 2em;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
    font-weight: 600;
}

.toc ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.toc li {
    padding: 15px 20px;
    border-radius: 12px;
    background: 
        linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(0, 122, 204, 0.05) 100%);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 212, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.toc li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(180deg, #00d4ff, #007acc);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.toc li:hover::before {
    transform: scaleY(1);
}

.toc li:hover {
    background: rgba(0, 212, 255, 0.15);
    transform: translateX(10px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.2);
}

.toc a {
    text-decoration: none;
    color: #00d4ff;
    font-weight: 600;
    font-size: 1.1em;
    display: block;
    transition: color 0.3s ease;
}

.toc li:hover a {
    color: #ffffff;
}

/* Section Styling */
.section {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    padding: 50px;
    margin: 50px 0;
    border-radius: 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    position: relative;
    backdrop-filter: blur(5px);
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg, #00d4ff, #007acc, #0099ff);
    border-radius: 20px 0 0 20px;
}

.section h2 {
    color: #00d4ff;
    font-size: 2.4em;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 15px;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #007acc);
    border-radius: 2px;
}

.section h3 {
    color: #0099ff;
    font-size: 1.8em;
    margin: 35px 0 20px 0;
    font-weight: 500;
    text-shadow: 0 1px 5px rgba(0, 153, 255, 0.3);
}

.section h4 {
    color: #66aaff;
    font-size: 1.4em;
    margin: 25px 0 15px 0;
    font-weight: 500;
}

.section p {
    margin-bottom: 20px;
    text-align: justify;
    color: #e0e0e0;
    line-height: 1.8;
    font-size: 1.1em;
}

/* Mathematical Formulas */
.math-formula {
    background: 
        linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(0, 122, 204, 0.08) 100%);
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    border: 2px solid rgba(0, 212, 255, 0.3);
    font-family: 'Times New Roman', 'Computer Modern', serif;
    font-size: 1.3em;
    text-align: center;
    color: #ffffff;
    position: relative;
    backdrop-filter: blur(5px);
    box-shadow: 
        0 8px 25px rgba(0, 212, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.math-formula::before {
    content: '∫';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 2em;
    color: rgba(0, 212, 255, 0.3);
    font-weight: bold;
}

.math-formula strong {
    color: #00ffff;
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Frequency Boxes */
.frequency-box {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24, #ff9f43);
    color: white;
    padding: 20px 25px;
    border-radius: 12px;
    margin: 25px 0;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 
        0 8px 25px rgba(255, 107, 107, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.frequency-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}

/* Diagram Containers */
.diagram-container {
    background: 
        radial-gradient(ellipse at center, rgba(10, 10, 26, 0.9) 0%, rgba(5, 5, 15, 0.95) 100%);
    border-radius: 20px;
    padding: 40px;
    margin: 50px 0;
    color: white;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(0, 212, 255, 0.2);
    border: 2px solid #00d4ff;
    position: relative;
    backdrop-filter: blur(10px);
}

.diagram-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 20px,
            rgba(0, 212, 255, 0.02) 22px
        );
    border-radius: 20px;
    pointer-events: none;
}

.diagram-title {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 15px;
    color: #00ffff;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.diagram-subtitle {
    text-align: center;
    font-size: 1em;
    margin-bottom: 40px;
    color: #a0c4ff;
    font-style: italic;
    position: relative;
    z-index: 2;
}

/* Interactive Elements */
.interactive-diagram {
    width: 100%;
    height: 400px;
    background: 
        radial-gradient(circle at center, #1a1a2e 0%, #0a0a0a 70%);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 212, 255, 0.4);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.controls {
    text-align: center;
    margin: 30px 0;
    position: relative;
    z-index: 2;
}

.btn {
    background: linear-gradient(45deg, #00d4ff, #007acc);
    color: white;
    border: none;
    padding: 12px 25px;
    margin: 0 8px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn:hover {
    background: linear-gradient(45deg, #007acc, #0099ff);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.5);
}

.btn:active {
    transform: translateY(0);
}

/* Contextual Boxes */
.historical-context {
    background: 
        linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.05) 100%);
    padding: 25px;
    border-left: 5px solid #ffc107;
    border-radius: 10px;
    margin: 30px 0;
    border: 1px solid rgba(255, 193, 7, 0.3);
    backdrop-filter: blur(5px);
}

.historical-context h4 {
    color: #ffc107;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.experimental-proposal {
    background: 
        linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(40, 167, 69, 0.05) 100%);
    padding: 25px;
    border-left: 5px solid #28a745;
    border-radius: 10px;
    margin: 30px 0;
    border: 1px solid rgba(40, 167, 69, 0.3);
    backdrop-filter: blur(5px);
}

.experimental-proposal h4 {
    color: #28a745;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.applications {
    background: 
        linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, rgba(0, 122, 204, 0.06) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
    backdrop-filter: blur(5px);
}

.applications h3 {
    color: #00d4ff;
    margin-top: 0;
    margin-bottom: 20px;
    text-shadow: 0 1px 5px rgba(0, 212, 255, 0.3);
}

.applications ul {
    list-style: none;
    padding-left: 0;
}

.applications li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    position: relative;
    padding-left: 25px;
}

.applications li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #00d4ff;
    font-weight: bold;
}

.note {
    background: 
        linear-gradient(135deg, rgba(23, 162, 184, 0.15) 0%, rgba(23, 162, 184, 0.05) 100%);
    color: #17a2b8;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(23, 162, 184, 0.3);
    margin: 40px 0;
    font-style: italic;
    backdrop-filter: blur(5px);
    border-left: 5px solid #17a2b8;
}

.note h3 {
    color: #17a2b8;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.references {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    padding: 30px;
    border-radius: 15px;
    margin-top: 50px;
    font-size: 0.95em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.references h3 {
    color: #00d4ff;
    margin-bottom: 20px;
    font-size: 1.4em;
    text-shadow: 0 1px 5px rgba(0, 212, 255, 0.3);
}

.references ul {
    list-style: none;
}

.references li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #b0b0b0;
    line-height: 1.6;
}

/* Animation Keyframes */
.foam-particle {
    position: absolute;
    background: #00d4ff;
    border-radius: 50%;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.field-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, #007acc, transparent);
    height: 2px;
    animation: pulse 2s ease-in-out infinite;
}

.fractal-branch {
    position: absolute;
    border: 1px solid #0099ff;
    opacity: 0.6;
    animation: fractalGlow 4s ease-in-out infinite;
}

.network-node {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #00d4ff;
    border-radius: 50%;
    animation: nodeGlow 3s ease-in-out infinite;
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.7);
}

.network-edge {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, #007acc, transparent);
    animation: dataFlow 2s linear infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-20px) scale(1.2); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes fractalGlow {
    0%, 100% { 
        box-shadow: 0 0 5px #0099ff; 
        border-color: #0099ff;
    }
    50% { 
        box-shadow: 0 0 20px #00d4ff, 0 0 30px #007acc; 
        border-color: #00d4ff;
    }
}

@keyframes nodeGlow {
    0%, 100% { 
        box-shadow: 0 0 5px #00d4ff; 
        background: #00d4ff;
    }
    50% { 
        box-shadow: 0 0 15px #00d4ff, 0 0 25px #007acc; 
        background: #00ffff;
    }
}

@keyframes dataFlow {
    0% { opacity: 0; transform: scaleX(0); }
    50% { opacity: 1; transform: scaleX(1); }
    100% { opacity: 0; transform: scaleX(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chapter-header {
        padding: 40px 20px;
    }
    
    .chapter-header h1 {
        font-size: 2.2em;
    }
    
    .section {
        padding: 30px 20px;
    }
    
    .toc ul {
        grid-template-columns: 1fr;
    }
    
    .diagram-container {
        padding: 25px 15px;
    }
    
    .controls .btn {
        margin: 5px;
        padding: 10px 20px;
        font-size: 0.9em;
    }
}