/* Styles for Moroccan Educational Physics Website - Harvard Style */

/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base styles */
body {
    font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #24292e;
    background-color: #f6f6f6;
}

.container {
    width: 92%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #1e1e1e;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #a51c30;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: #d44a40;
    text-decoration: underline;
}

/* Header */
header {
    background-color: #a51c30;
    color: #fff;
    padding: 2.5rem 0;
    border-bottom: 6px solid #8a1829;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.7rem;
    margin-bottom: 0.7rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.3rem;
    font-weight: 300;
    margin-bottom: 0;
    opacity: 0.9;
}

/* Navigation */
nav {
    background-color: #f8f8f8;
    border-bottom: 1px solid #e3e3e3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    position: relative;
    z-index: 100;
}

nav .container {
    display: flex;
    justify-content: center;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0;
    position: relative;
}

nav ul li a {
    display: block;
    color: #444;
    text-decoration: none;
    padding: 1.2rem 1.8rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

nav ul li a:hover {
    color: #a51c30;
    background-color: #f1f1f1;
    text-decoration: none;
}

nav ul li a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    left: 0;
    background-color: #a51c30;
    transition: width 0.3s ease;
}

nav ul li a:hover:after {
    width: 100%;
}

/* Main content */
main {
    padding: 2.5rem 0;
    min-height: 70vh;
}

.intro {
    text-align: center;
    margin-bottom: 3.5rem;
    padding: 2.5rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.intro:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #a51c30, #d44a40);
}

.intro h2 {
    color: #a51c30;
    margin-bottom: 1.25rem;
    border-bottom: none;
    font-size: 2.1rem;
    position: relative;
    display: inline-block;
}

.intro p {
    font-size: 1.15rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* Chapters */
section {
    margin-bottom: 3.5rem;
}

section:last-child {
    margin-bottom: 5rem;
}

section h2 {
    color: #a51c30;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.9rem;
    position: relative;
}

section h2:after {
    content: '';
    display: block;
    width: 100px;
    height: 3px;
    background: linear-gradient(to right, #a51c30, #d44a40);
    margin: 15px auto 0;
    border-radius: 2px;
}

.chapters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.chapter-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.75rem;
    height: 100%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border-top: 3px solid #a51c30;
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.chapter-card h3 {
    color: #a51c30;
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.85rem;
    position: relative;
}

.resources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: auto;
}

/* Buttons and Interactive Elements */
.resource-item {
    background-color: #f9f9f9;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #eee;
    flex-grow: 1;
    text-align: center;
    min-width: calc(33.333% - 0.5rem);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.resource-item:hover {
    background-color: #f1f1f1;
    border-color: #ddd;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

.resource-item a {
    color: #444;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    padding-right: 10px;
}

.resource-item a:after {
    content: '\2192'; /* Right arrow */
    position: absolute;
    right: 0;
    opacity: 0;
    transition: all 0.3s ease;
}

.resource-item:hover a {
    color: #a51c30;
}

.resource-item:hover a:after {
    opacity: 1;
    right: -10px;
}

.resource-item a:hover {
    color: #a51c30;
}

/* Footer */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 2.5rem 0;
    position: relative;
    clear: both;
    margin-top: 5rem;
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.1);
}

/* Auto footer styles */
footer.auto-footer {
    background: #f7f7f7; 
    padding: 1.5rem 0; 
    font-size: 0.95rem; 
    color: #333; 
    border-top: 1px solid #e1e1e1;
    margin-top: 5rem;
    position: relative;
    width: 100%;
    clear: both;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

footer.auto-footer:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, #a51c30, #d44a40, #a51c30);
    opacity: 0.5;
}

footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: #a51c30;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0.8;
    transform: translateY(100px);
}

.back-to-top.visible {
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #8a1829;
    opacity: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-3px);
}

/* Footer spacer */
.footer-spacer {
    height: 80px;
    clear: both;
    display: block;
    width: 100%;
}

/* Responsive design */
@media (max-width: 992px) {
    .chapters {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav ul li {
        width: 100%;
        text-align: center;
    }
    
    nav ul li a {
        padding: 0.75rem;
    }
    
    .chapters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        width: 95%;
    }
    
    .intro {
        padding: 1.5rem;
    }
    
    .chapter-card {
        padding: 1rem;
    }
    
    .resource-item {
        min-width: calc(50% - 0.375rem);
    }
}

/* Devoir button */
a.btn-devoir, button.btn-devoir {
  display: inline-block; 
  padding: 12px 20px; 
  border-radius: 8px; 
  border: 2px solid #a51c30; 
  background: rgba(165, 28, 48, 0.05); 
  color: #a51c30; 
  font-weight: 600; 
  text-decoration: none; 
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(165, 28, 48, 0.1);
  margin: 10px 0;
  position: relative;
  overflow: hidden;
}

a.btn-devoir:hover, button.btn-devoir:hover { 
  transform: translateY(-2px); 
  background: rgba(165, 28, 48, 0.1); 
  box-shadow: 0 4px 8px rgba(165, 28, 48, 0.15);
}

a.btn-devoir:before, button.btn-devoir:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: rgba(165, 28, 48, 0.1);
  transition: width 0.3s ease;
  z-index: -1;
}

a.btn-devoir:hover:before, button.btn-devoir:hover:before {
  width: 100%;
}

/* Semestre toggles */
.semestre-switcher { 
  display: flex; 
  justify-content: center; 
  gap: 15px; 
  margin: 30px 0; 
}

.semestre-btn { 
  padding: 14px 25px; 
  border-radius: 30px; 
  border: 2px solid #a51c30; 
  background: white; 
  color: #a51c30; 
  font-weight: 700; 
  cursor: pointer; 
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  outline: none;
  position: relative;
  overflow: hidden;
}

.semestre-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.semestre-btn:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  background: rgba(165, 28, 48, 0.1);
  transition: height 0.3s ease;
  z-index: -1;
}

.semestre-btn:hover:after {
  height: 100%;
}

.semestre-btn.active { 
  background: #a51c30; 
  color: white; 
  box-shadow: 0 3px 10px rgba(165, 28, 48, 0.3);
}

.semestre-section { 
  display: none; 
  margin-bottom: 40px; 
  animation: fadeIn 0.5s ease;
}

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

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