:root
{
    --primary: #2d5a27;
    --accent: #c5a059;
    --bg: #f8f9fa;
    --white: #ffffff;
}

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

body,
html
{
    height: 100vh;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.app-shell
{
    display: flex;
    height: 100vh;
}
.icon-circle-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(1, 1, 1); /* Soft scholarly grey */
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.icon-circle-btn:hover {
    background: var(--primary); /* Turns green on hover */
    color: white;
    transform: translateY(-1px);
}

.icon-circle-btn svg {
    width: 20px;
    height: 20px;
}

/* Specific styling for the close button inside the sidebar */
.close-mobile {
    margin-right: auto; /* Pushes it away from title in RTL */
}
/* SIDEBAR */
.sidebar
{
    width: 300px;
    background: white;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    transition: 0.3s;
    z-index: 2000;
}

.sidebar-header
{
    padding: 20px;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
}

.lessons-scroll
{
    flex: 1;
    overflow-y: auto;
}

/* MAIN VIEW STACK */
.main-view
{
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* 5% ROW: TITLE */
.title-row {
    display: flex;
    flex-direction: row; /* Standard flex flow */
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    height: 60px;
    direction: rtl; /* Ensure we are working in RTL logic */
}

.title-row h1 {
    flex: 1; /* Pushes the icons to the far opposite side */
    text-align: right; /* Align text to the start of the line */
    font-size: clamp(1rem, 4.5vw, 1.3rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    font-weight: 700;
}

/* Group the icons on the left */
.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.menu-btn
{
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    width: 40px;
}

.spacer
{
    width: 40px;
}

/* 5% ROW: META */
.meta-row
{
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
    border-bottom: 1px solid #eee;
}

/* 30% ROW: PLAYER */
.player-section
{
    
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-bottom: 1px solid #ddd;
}

.player-container
{
    width: 100%;
    max-width: 600px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #eee;
    border-radius: 10px;
    cursor: pointer;
    /* Ensure the container itself follows RTL flow */
    direction: rtl; 
    position: relative; 
}

.progress {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    width: 0%;
    /* Anchor to the right for RTL */
    position: absolute;
    right: 0; 
    top: 0;
}

.time-row
{
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #888;
    margin-top: 5px;
}

.controls-row
{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 15px 0;
}

.play-btn
{
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn,
.skip-btn
{
    /*background: none;
    border: none;
    font-size: 1rem;
    color: var(--primary);
    cursor: pointer;*/
    background: #f4f4f4; /* Light grey base */
    border: 1px solid #e0e0e0;
    border-radius: 50%; /* Perfect circles */
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    transition: all 0.2s ease;
    padding: 0;
}

.skip-btn:hover, .nav-btn:hover {
    background: #ffffff;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.skip-btn:active, .nav-btn:active {
    transform: translateY(0);
    background: #eeeeee;
}

.skip-btn svg {
    width: 22px;
    height: 22px;
}

.settings-row
{
    /*display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.8rem;
    color: #666;*/

    display: flex;
    align-items: center;    /* This aligns them perfectly on the horizontal line */
    justify-content: flex-start;
    gap: 15px;              /* Spacing between the select and the checkbox */
    /*margin-top: 10px;*/
}
.auto-play {
    display: flex;
    align-items: center;    /* Aligns the text with the checkbox itself */
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

/* Optional: Make the checkbox a bit more elegant to match the theme */
#autoPlayNext {
    accent-color: var(--primary); /* Colors the checkbox green */
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 60% ROW: CONTENT */
.content-section
{
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tab-nav
{
    display: flex;
    background: white;
    border-bottom: 1px solid #ddd;
}

.tab-btn
{
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-weight: bold;
    color: #888;
    cursor: pointer;
}

.tab-btn.active
{
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
}

.scrollable-content
{
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background: white;
}

.tab-pane
{
    display: none;
    line-height: 1.8;
}

.tab-pane.active
{
    display: block;
}

#descriptionList li
{
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
    list-style: none;
}

/* MOBILE */
@media (max-width: 900px)
{
    .sidebar
    {
        position: fixed;
        right: 0;
        top: 0;
        height: 100%;
        transform: translateX(100%);
    }

    .sidebar.open
    {
        transform: translateX(0);
    }

    

    .content-section
    {
        height: 55%;
    }
}

.lesson-item
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.lesson-info
{
    flex: 1;
    /* Takes up all available space */
    min-width: 0;
}

.lesson-info h4
{
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Keeps titles on one line */
}

.download-btn
{
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
    /* Prevents button from shrinking */
    transition: background 0.2s;
}

.download-btn:hover
{
    background: var(--accent);
    color: white;
}

/* 1. Custom Scrollbar for the 60% Content Area */
.scrollable-content::-webkit-scrollbar
{
    width: 6px;
}

.scrollable-content::-webkit-scrollbar-track
{
    background: transparent;
}

.scrollable-content::-webkit-scrollbar-thumb
{
    background: #d1d1d1;
    border-radius: 10px;
}

/* 2. Text Selection */
::selection
{
    background: var(--accent);
    color: white;
}

/* 3. The Elegant Button Style (No Emojis) */
.play-btn svg,
.nav-btn svg,
.skip-btn svg
{
    width: 0.5rem;
    height: 0.5rem;
    display: block;
}

.play-btn
{
    transition: transform 0.2s ease, background 0.3s ease;
}

.play-btn:hover
{
    transform: scale(1.05);
    background: #3e7a36;
    /* Slightly lighter green */
}

/* 4. Elegant Sidebar Items */
.lesson-item
{
    border-right: 3px solid transparent;
    transition: all 0.3s ease;
}

.lesson-item.active
{
    background: linear-gradient(to left, #f0f4f0, transparent);
    border-right-color: var(--primary);
}

.lesson-item h4
{
    font-weight: 500;
    color: #444;
}

/* 5. Refined Meta Row (The 5% Lesson Count) */
.meta-row
{
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: #fafafa;
}

#speedSelect {
    appearance: none;
    -webkit-appearance: none; /* For Safari */
    background-color: #fff;
    
    /* This adds a custom Green Chevron arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d5a27' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    
    /* Position for RTL: 8px from the left, centered vertically */
    background-position: left 10px center; 
    background-size: 12px;
    
    border: 1px solid #e0e0e0;
    /* Extra padding on the left (32px) so text doesn't overlap the arrow */
    padding: 6px 12px 6px 32px; 
    
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    color: var(--primary);
    outline: none;
    transition: all 0.2s ease;
}

#speedSelect:hover {
    border-color: var(--accent);
    background-color: #fafafa;
}

.play-btn
{
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;

    /* Forces absolute center */
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    /* Critical: browser defaults often add 1-2px padding */
    margin: 0;
    line-height: 0;
    /* Prevents font-descent spacing */
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.play-btn svg
{
    width: 32px;
    height: 32px;
    display: block;
    /* Remove any transform or margin that might be lingering */
    margin: 0;
    padding: 0;
}

button:focus
{
    outline: none;
}

button:active
{
    transform: translateY(1px);
}


/*################ ABOUT MODAL ############################*/

.close-modal {
    width: 32px;  /* Fixed width */
    height: 32px; /* Fixed height */
    min-width: 32px; /* Prevents squishing */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    color: #666;
}

.close-modal svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5px; /* Thicker lines look less "narrow" */
}
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100dvh; /* Change this */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    /* Fix for iOS bounce/scroll issues */
    overflow: hidden; 
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalSlide 0.3s ease-out;
}

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

.modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    text-align: right;
    direction: rtl;
}

.modal-body h4 { color: var(--primary); margin-bottom: 10px; }
.modal-body p { font-size: 0.9rem; line-height: 1.6; color: #555; }

.badge-row { display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.badge {
    background: #f0f4f0;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: bold;
}

.features-list { list-style: none; padding: 0; }
.features-list li { font-size: 0.85rem; margin-bottom: 8px; position: relative; padding-right: 15px; }
.features-list li::before { content: "•"; color: var(--accent); position: absolute; right: 0; }

.email-btn {
    display: block;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 15px;
    font-size: 0.9rem;
}

.pill-btn {
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 20px; /* Makes it a pill */
    padding: 6px 16px;
    font-size: 0.85rem;
    font-family: 'Tajawal', sans-serif;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap; /* Prevents text wrapping */
}

.pill-btn:hover {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}


/*#################### INDEX SEARCH #########################*/

.search-container {
    padding: 10px 15px;
    position: relative;
    border-bottom: 1px solid #eee;
}

#lessonSearch {
    width: 100%;
    padding: 8px 35px 8px 10px; /* Space for the icon on the right */
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

#lessonSearch:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #999;
    pointer-events: none;
}

/*#################### GLOBAL SEARCH #########################*/

.search-result-card {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
    margin-bottom: 5px;
}

.search-result-card:hover {
    background: #f0f4f0;
}

.search-result-card strong {
    color: var(--primary);
    display: block;
    margin-bottom: 4px;
}

.search-result-card small {
    color: #888;
    display: block;
}

.search-filters {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #666;
}

.search-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.search-result-card p {
    font-size: 0.85rem;
    color: #555;
    margin-top: 5px;
    line-height: 1.4;
    background: #f9f9f9;
    padding: 5px;
    border-radius: 4px;
}