/* === main.css — Global Layout, Fonts, Navigation === */

@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: #1a1a2e;
    background-color: #fafafa;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Page Layout --- */
.page-wrapper {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- Header / Navigation --- */
.site-header {
    background: linear-gradient(135deg, #1a5632 0%, #2d8a4e 100%);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
}

.site-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-title .urdu-title {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.6rem;
    direction: rtl;
}

/* --- Main Navigation --- */
.main-nav {
    background: rgba(0, 0, 0, 0.15);
}

.main-nav ul {
    list-style: none;
    display: flex;
    padding: 0 1rem;
    gap: 0;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* --- Dropdown Menu --- */
.main-nav li:hover .dropdown {
    display: block;
}

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 6px 6px;
    z-index: 200;
}

.dropdown a {
    color: #1a1a2e;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown a:hover {
    background: #e8f5e9;
    color: #1a5632;
}

.dropdown .lesson-title-urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1rem;
    direction: rtl;
    display: inline-block;
    margin-right: 0.5rem;
}

/* --- Transliteration Toggle --- */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: #4caf50;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-switch.active::after {
    transform: translateX(18px);
}

/* --- Footer --- */
.site-footer {
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    margin-top: auto;
}

.site-footer a {
    color: #4caf50;
    text-decoration: none;
}

/* --- Common Elements --- */
h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a5632;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a5632;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8f5e9;
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2d8a4e;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

/* --- Cards & Sections --- */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #1a5632;
    color: #fff;
}

.btn-primary:hover {
    background: #2d8a4e;
}

.btn-secondary {
    background: #e8f5e9;
    color: #1a5632;
}

.btn-secondary:hover {
    background: #c8e6c9;
}

/* --- Lesson Navigation (Prev/Next) --- */
.lesson-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e8f5e9;
}

.lesson-nav .btn {
    min-width: 140px;
}

/* --- Breadcrumb --- */
.breadcrumb {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: #2d8a4e;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 0.4rem;
    color: #999;
}

/* --- Mobile Nav Toggle --- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* --- Loading State --- */
.loading {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e8e8e8;
    border-top-color: #2d8a4e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

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