/* Import Navigation Bar Styles */
@import url('nav.css');

/* --- Global Styles & Variables --- */
:root {
    --primary-font: 'Lora', serif;
    --secondary-font: 'Roboto', sans-serif;
    --text-color: #3d3d3d;
    --primary-color: #003366;
    --accent-color: #b33939;
    --light-gray: #f8f9fa;
    --border-color: #e9ecef;
    --shadow: 0 10px 30px rgba(0,0,0,0.07);
}

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

html { 
    scroll-behavior: smooth; 
}

body { 
    font-family: var(--primary-font); 
    line-height: 1.8; 
    color: var(--text-color); 
    background-color: var(--light-gray); 
}

/* --- SHARED COMPONENTS --- */
.container { 
    max-width: 1100px; 
    margin: 4rem auto; 
    padding: 0 2rem; 
}

.btn { 
    display: inline-block; 
    padding: 0.75rem 1.5rem; 
    border-radius: 50px; 
    text-decoration: none; 
    font-family: var(--secondary-font); 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.8rem; 
    letter-spacing: 1px; 
    transition: all 0.3s ease; 
    cursor: pointer;
}

.btn { 
    background-color: var(--primary-color); 
    color: #fff; 
    border: 2px solid var(--primary-color); 
}

.btn:hover { 
    background-color: transparent; 
    color: var(--primary-color); 
}

.btn-secondary { 
    background-color: transparent; 
    color: #fff; 
    border-color: #fff; 
}

.btn-secondary:hover { 
    background-color: #fff; 
    color: var(--primary-color); 
}

.loader { 
    width: 48px; 
    height: 48px; 
    border: 3px solid #ccc; 
    border-radius: 50%; 
    display: block; 
    position: relative; 
    animation: rotation 1s linear infinite; 
    margin: 40px auto; 
}

.loader::after { 
    content: ''; 
    box-sizing: border-box; 
    position: absolute; 
    left: 50%; 
    top: 50%; 
    transform: translate(-50%, -50%); 
    width: 56px; 
    height: 56px; 
    border-radius: 50%; 
    border: 3px solid; 
    border-color: var(--primary-color) transparent; 
}

@keyframes rotation { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

.hidden {
    display: none !important;
}

/* --- HOMEPAGE STYLES --- */
.main-hero { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    text-align: center; 
    color: #fff; 
    height: 100vh; 
    padding: 2rem; 
    background: linear-gradient(rgba(0, 21, 41, 0.7), rgba(0, 21, 41, 0.7)), url('https://rabbisacks.netlify.app/rebbi.jpg') center center/cover no-repeat fixed; 
}

.hero-title { 
    font-size: 4rem; 
    margin-bottom: 0.5rem; 
}

.hero-subtitle { 
    font-size: 1.5rem; 
    font-family: var(--secondary-font); 
    font-weight: 400; 
    margin-bottom: 2rem; 
}

.hero-buttons { 
    display: flex; 
    gap: 1rem; 
    justify-content: center; 
}

.about-section { 
    text-align: center; 
    max-width: 800px; 
    margin: 0 auto 4rem auto; 
}

.about-section p {
    margin-bottom: 1.5rem;
}

.about-section h2, .content-section h2 { 
    text-align: center; 
    font-family: var(--secondary-font); 
    color: var(--primary-color); 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    font-size: 1.8rem; 
    margin-bottom: 2rem; 
}

.content-section {
    margin-bottom: 4rem;
}

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

.sefarim-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.shiur-card { 
    background: #fff; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.06); 
    transition: all 0.3s ease; 
    cursor: pointer; 
}

.shiur-card.hidden { display: none; }
.shiur-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }

.shiur-thumbnail { 
    width: 100%; 
    aspect-ratio: 16/9; 
    object-fit: cover; 
    display: block; 
}

.shiur-info { padding: 1rem; }
.shiur-title { 
    font-size: 1rem; 
    font-weight: 700; 
    font-family: var(--secondary-font); 
    color: var(--primary-color); 
}

.view-more-container { text-align: center; margin-top: 2rem; }

/* --- Filter & Search Controls --- */
.filter-controls {
    max-width: 900px;
    margin: 0 auto 2.5rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-controls input[type="search"] {
    width: 100%;
    padding: 0.8rem 1.2rem;
    font-size: 1.1rem;
    font-family: var(--primary-font);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.category-filters .btn {
    background-color: #fff;
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1.2rem;
    font-size: 0.8rem;
}

.category-filters .btn:hover {
    background-color: var(--light-gray);
    border-color: #ccc;
}

.category-filters .btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.no-results-message {
    text-align: center;
    padding: 2rem;
    font-style: italic;
    color: #6c757d;
}


/* --- Sefarim Card Styles --- */
.sefer-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.sefer-title {
    font-family: var(--secondary-font);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    flex-grow: 1;
    margin-bottom: 1rem;
}

.sefer-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

.add-to-cart-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.add-to-cart-btn:hover {
    background-color: #002244;
}

.add-to-cart-btn.added {
    background-color: #28a745;
    cursor: default;
}

.sefarim-category {
    margin-bottom: 3rem;
}

.sefarim-category h3 {
    font-family: var(--secondary-font);
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    font-size: 1.6rem;
}

/* --- Community Section --- */
.community-section { background: #fff; border-radius: 8px; padding: 3rem 2rem; box-shadow: var(--shadow); text-align: center; max-width: 900px; margin-left: auto; margin-right: auto; }
.community-section p { max-width: 700px; margin-left: auto; margin-right: auto; }
.community-section h3 { font-family: var(--secondary-font); color: var(--primary-color); margin-top: 2.5rem; margin-bottom: 1.5rem; font-size: 1.4rem; }
.community-shiurim-list { list-style: none; padding: 0; margin: 0 auto; max-width: 600px; text-align: left; }
.community-shiurim-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); font-size: 1.1rem; display: flex; align-items: center; }
.community-shiurim-list li:last-child { border-bottom: none; }
.community-shiurim-list i { color: var(--accent-color); margin-right: 1rem; width: 20px; text-align: center; }

/* --- Footer --- */
.main-footer { text-align: center; padding: 2rem; margin-top: 4rem; color: #6c757d; font-size: 0.9rem; }

/* --- Video Modal --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 2000; display: flex; justify-content: center; align-items: center; padding: 1rem; opacity: 0; visibility: hidden; transition: all 0.3s ease; backdrop-filter: blur(5px); }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content { width: 100%; max-width: 1100px; }
.player-container { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px; }
#videoFrame { width: 100%; height: 100%; border: none; border-radius: 8px; }
#close-modal-btn { display: block; margin: 1rem auto 0 auto; background: #fff; color: var(--primary-color); border-color: #fff; }
#close-modal-btn:hover { background: transparent; color: #fff; }

/* --- Cart & Contact Page Styles --- */
.cart-hero { height: 50vh; min-height: 350px; }
#cart-items-container { background-color: #fff; padding: 1rem; border-radius: 8px; box-shadow: var(--shadow); }
.cart-item { display: flex; flex-wrap: wrap; align-items: center; padding: 1.5rem 1rem; border-bottom: 1px solid var(--border-color); }
.cart-item:last-child { border-bottom: none; }
.cart-item-title { flex: 1 1 300px; font-size: 1.2rem; font-family: var(--secondary-font); font-weight: bold; color: var(--primary-color); }
.cart-item-details { display: flex; align-items: center; gap: 1.5rem; flex: 1 1 250px; justify-content: flex-end; }
.cart-item-price { font-size: 1.1rem; font-weight: bold; min-width: 80px; text-align: right; }
.cart-item-quantity input { width: 60px; padding: 0.5rem; text-align: center; border: 1px solid var(--border-color); border-radius: 4px; font-size: 1rem; }
.cart-item-remove button { background: none; border: none; color: var(--danger-color); font-size: 1.2rem; cursor: pointer; padding: 0.5rem; }
.empty-cart-message { text-align: center; padding: 4rem 2rem; background: #fff; border-radius: 8px; }
#cart-summary { margin-top: 2rem; padding: 2rem; background: #fff; border-radius: 8px; box-shadow: var(--shadow); text-align: right; }
.cart-total { font-size: 1.8rem; font-family: var(--secondary-font); margin-bottom: 1.5rem; }
.cart-total span { font-weight: bold; color: var(--primary-color); }
.cart-checkout-actions p { margin-bottom: 1rem; color: #6c757d; }
.contact-form-container { max-width: 700px; margin: 0 auto; background: #fff; padding: 2.5rem; border-radius: 8px; box-shadow: var(--shadow); }
.contact-form-container .form-group { margin-bottom: 1.5rem; }
.contact-form-container label { font-family: var(--secondary-font); font-weight: bold; color: var(--primary-color); display: block; margin-bottom: 0.5rem; }
.contact-form-container input, .contact-form-container textarea { font-family: var(--primary-font); width: 100%; font-size: 1.1rem; padding: 0.8rem; border: 1px solid var(--border-color); border-radius: 4px; }
.contact-form-container .btn { width: 100%; padding: 1rem; font-size: 1rem; }

/* --- ARTICLE PAGE STYLES --- */
#progress-bar { position: fixed; top: 0; left: 0; height: 5px; background: linear-gradient(to right, var(--primary-color), var(--accent-color)); width: 0%; z-index: 1000; }
.article-hero { height: 50vh; min-height: 350px; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; background: linear-gradient(rgba(0, 21, 41, 0.7), rgba(0, 21, 41, 0.7)), url('https://rabbisacks.netlify.app/rebbi.jpg') center center/cover no-repeat fixed; }
.article-container { max-width: 850px; margin: -80px auto 0; position: relative; background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 3rem 4rem; }
.entry-title { font-size: 3.5rem; margin-bottom: 1rem; text-shadow: 2px 2px 10px rgba(0,0,0,0.5); }
.meta-info { font-family: var(--secondary-font); font-size: 0.9rem; color: rgba(255, 255, 255, 0.85); text-transform: uppercase; letter-spacing: 0.5px; }
.meta-info a { color: #fff; }
.meta-info .separator { margin: 0 0.75rem; }
.intro-paragraph { font-size: 1.3rem; font-style: italic; color: var(--primary-color); text-align: center; margin: 1.5rem 0 3rem 0; }
.article-content p { margin-bottom: 1.75em; font-size: 1.15rem; }
.drop-cap { float: left; font-size: 5em; font-weight: bold; line-height: 0.8; margin: 0.1em 0.1em 0 0; color: var(--primary-color); }
.article-footer { text-align: center; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border-color); color: #6c757d; font-size: 0.9rem; }
.scroll-to-top { position: fixed; bottom: 25px; right: 25px; background-color: var(--primary-color); color: white; width: 50px; height: 50px; border-radius: 50%; display: none; justify-content: center; align-items: center; font-size: 1.5rem; cursor: pointer; opacity: 0; transition: all 0.4s ease; transform: translateY(20px); }
.scroll-to-top.visible { display: flex; opacity: 0.85; transform: translateY(0); }
.scroll-to-top:hover { opacity: 1; transform: translateY(-5px); }
.animate-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }


/* --- MOBILE RESPONSIVE STYLES --- */
@media (max-width: 768px) {
    /* --- Mobile Layout & Spacing --- */
    .container {
        padding: 0 1rem;
        margin-top: 2rem;
        margin-bottom: 2rem;
    }

    .main-hero {
        height: 90vh; /* Shorter hero on mobile */
    }

    .hero-buttons {
        flex-direction: column; /* Stack buttons vertically */
        align-items: center;
    }

    /* --- Mobile Typography --- */
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .about-section h2, .content-section h2 {
        font-size: 1.5rem;
    }

    .sefarim-category h3 {
        font-size: 1.3rem;
    }
    
    .community-shiurim-list li {
        font-size: 1rem;
    }

    /* --- Mobile Grid --- */
    .grid-container {
        /* Let the auto-fill handle it, but reduce the min-width slightly if needed */
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    /* --- Article & Contact/Cart Pages on Mobile --- */
    .entry-title {
        font-size: 2.2rem;
    }

    .article-container, .contact-form-container {
        padding: 2rem 1rem;
    }

    .drop-cap {
        font-size: 4em;
    }
    
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .cart-item-details {
        width: 100%;
        justify-content: space-between;
    }

    #cart-summary {
        text-align: center;
    }

    .cart-checkout-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}
