/*
 * FortyHadith.net - Modern Responsive Stylesheet
 * Modernized from 2001-2002 original design
 * Preserves original layout while adding responsive mobile support
 */

/* ===== Google Fonts Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Open+Sans:wght@400;600;700&display=swap');

/* ===== CSS Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    background-color: #FFFFFF;
    color: #2c2c2c;
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-weight: 400;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    font-weight: 700;
    line-height: 1.4;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: #1a1a1a;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1.25em;
    line-height: 1.8;
}

strong, b {
    font-weight: 600;
}

em, i {
    font-style: italic;
}

/* ===== Links ===== */
a {
    color: #CC6600;
    text-decoration: none;
    transition: all 0.2s ease;
}

a:visited {
    color: #CC9933;
}

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

a:active {
    color: #0099CC;
}

/* Image links should not have underline on hover */
a img {
    border: none;
    display: block;
}

/* ===== Layout Container ===== */
.site-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Homepage Layout ===== */
.home-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

.home-header {
    text-align: center;
    padding: 20px;
}

.home-header img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

.home-subtitle {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    background-color: #EFEFEF;
    color: #666666;
    text-align: center;
    padding: 12px;
    font-size: 1rem;
    font-weight: 400;
}

.home-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
}

.home-content {
    padding: 0 20px;
}

.home-content p {
    text-align: justify;
    margin-bottom: 1.25em;
    font-size: 1.05rem;
    line-height: 1.9;
    max-width: 75ch;
}

.home-sidebar {
    background-color: #69B6DA;
    padding: 20px;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 15px;
}

.nav-menu small {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
}

.nav-menu img {
    width: 100%;
    max-width: 193px;
    height: auto;
}

.nav-divider {
    width: 100%;
    max-width: 193px;
    height: 2px;
    background: url('../images/bh_line.gif') repeat-x;
    margin: 0 auto 15px;
}

.sidebar-info {
    background-color: #508AB6;
    padding: 20px;
    margin-top: 20px;
    border-radius: 4px;
}

.sidebar-info p {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    color: #FFF191;
    font-size: 0.9rem;
    margin-bottom: 1em;
    line-height: 1.6;
}

.sidebar-info a {
    color: #FFCC66;
    font-weight: bold;
}

.home-footer {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    background-color: #69B6DA;
    padding: 15px;
    text-align: center;
    font-size: 0.9rem;
}

.home-footer-links {
    margin-bottom: 10px;
    font-weight: 400;
}

.home-footer-links a {
    color: #FFFFFF;
    font-weight: 600;
    text-decoration: underline;
}

.home-footer-links a:visited {
    color: #F0F0F0;
}

.home-footer-links a:hover {
    color: #FFCC66;
    text-decoration: underline;
}

.home-footer-copyright {
    font-size: 0.8rem;
    color: #416F8D;
    line-height: 1.6;
}

/* ===== Content Pages Layout ===== */
.content-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    gap: 20px;
}

.content-header-left {
    flex: 1;
}

.content-header-left img {
    max-width: 100%;
    height: auto;
}

.hadith-number {
    font-size: 2.5rem;
    color: #6699CC;
    font-weight: bold;
    text-align: right;
    flex-shrink: 0;
    line-height: 1;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.content-main {
    padding: 30px;
    flex: 1;
    max-width: 85ch;
}

.content-main p {
    max-width: 75ch;
}

.content-sidebar {
    background-color: #6598BE;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 20px;
    padding: 20px;
}

.home-link {
    order: 2;
    flex-shrink: 0;
}

.home-link img {
    max-width: 40px;
    height: auto;
}

.sidebar-nav {
    background-color: #69B6DA;
    padding: 15px;
    border-radius: 4px;
    order: 1;
    flex: 0 1 auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    text-align: right;
    margin-bottom: 10px;
}

.sidebar-nav li:last-child {
    margin-bottom: 0;
}

.sidebar-nav img {
    max-width: 144px;
    height: auto;
    margin-left: auto;
}

.sidebar-nav a.text-link {
    color: #FFFFFF;
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    display: block;
    text-align: right;
    padding: 8px 0;
}

.sidebar-nav a.text-link:hover {
    text-decoration: underline;
}

.sidebar-pattern {
    margin-top: 20px;
}

.sidebar-pattern img {
    max-width: 89px;
    height: auto;
}

/* ===== Content Typography ===== */
.content-main h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.content-main h2 {
    font-size: 1.75rem;
    margin: 1.5rem 0 1rem;
}

.content-main h3 {
    font-size: 1.5rem;
    margin: 1.25rem 0 0.75rem;
}

.section-heading {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.arabic-text {
    text-align: center;
    margin: 20px 0;
}

.arabic-text img {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

blockquote {
    margin: 1.5em 0 1.5em 2em;
    padding: 1.25em 1.5em;
    border-left: 5px solid #6699CC;
    background-color: #f7f9fc;
    border-radius: 4px;
    font-size: 1.05rem;
}

blockquote p {
    text-align: justify;
    line-height: 1.9;
    margin-bottom: 0.75em;
}

blockquote p:last-child {
    margin-bottom: 0;
}

.hadith-attribution {
    text-align: right;
    font-size: 0.875rem;
    margin: 10px 0;
}

.content-divider {
    text-align: center;
    margin: 20px 0;
}

.content-divider img {
    max-width: 89px;
    height: auto;
    display: inline-block;
}

hr {
    border: none;
    border-top: 1px solid #999999;
    margin: 20px 0;
}

/* Lists */
ol, ul {
    margin: 1.25em 0 1.25em 2.5em;
    line-height: 1.8;
}

ol li, ul li {
    margin-bottom: 0.75em;
    padding-left: 0.5em;
}

ol li p, ul li p {
    margin-bottom: 0.5em;
}

/* Nested lists */
ol ol, ol ul, ul ol, ul ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* ===== Hadith Index Table ===== */
.hadith-index-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.hadith-index-table th {
    background-color: #f0f0f0;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid #ccc;
}

.hadith-index-table td {
    padding: 8px;
    vertical-align: top;
}

.hadith-index-table .hadith-num {
    text-align: center;
    width: 10%;
}

.hadith-index-table .hadith-topic {
    width: 60%;
}

.hadith-index-table .hadith-date {
    text-align: center;
    font-size: 0.75rem;
    width: 13%;
}

.hadith-index-table img {
    max-width: 25px;
    height: auto;
}

/* ===== Footer ===== */
.content-footer {
    border-top: 1px solid #999999;
    margin-top: auto;
}

.footer-links {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    text-align: center;
    padding: 15px;
    font-size: 0.9rem;
    background-color: #f5f5f5;
}

.footer-links a {
    margin: 0 8px;
    color: #0066CC;
    font-weight: 600;
    text-decoration: underline;
}

.footer-links a:visited {
    color: #004C99;
}

.footer-links a:hover {
    color: #CC6600;
    text-decoration: underline;
}

.footer-copyright {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    background-color: #6598BE;
    color: #FFFFFF;
    text-align: center;
    padding: 15px;
    font-size: 0.8rem;
    line-height: 1.6;
}

/* ===== Utility Classes ===== */
.text-center {
    text-align: center;
}

.text-justify {
    text-align: justify;
}

.text-right {
    text-align: right;
}

.mb-1 {
    margin-bottom: 1rem;
}

.small-text {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
}

.update-date {
    font-family: 'Open Sans', Arial, Helvetica, sans-serif;
    font-size: 0.85rem;
    color: #666666;
    margin-bottom: 1em;
    font-style: italic;
}

/* ===== Responsive Design ===== */

/* Tablet and Desktop (768px and up) */
@media (min-width: 768px) {
    .home-main {
        grid-template-columns: 65% 35%;
    }

    .content-wrapper {
        grid-template-columns: 1fr 240px;
    }

    .hadith-number {
        font-size: 3rem;
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .home-main {
        grid-template-columns: 65% 35%;
    }

    .content-wrapper {
        grid-template-columns: 1fr 280px;
    }

    .hadith-number {
        font-size: 4rem;
    }
}

/* Mobile-specific adjustments */
@media (max-width: 767px) {
    html {
        font-size: 16px;
    }

    body {
        line-height: 1.7;
    }

    .home-header {
        padding: 10px;
    }

    .home-content {
        padding: 0 10px;
    }

    .home-sidebar {
        padding: 15px;
    }

    .content-header {
        flex-direction: column;
        padding: 10px;
    }

    .hadith-number {
        text-align: center;
        margin-top: 10px;
    }

    .content-main {
        padding: 10px;
    }

    .content-sidebar {
        padding: 15px;
        flex-direction: column;
        align-items: center;
    }

    .home-link {
        order: 1;
        margin-bottom: 15px;
    }

    .sidebar-nav {
        width: 100%;
        order: 2;
    }

    .sidebar-nav li {
        text-align: center;
    }

    .sidebar-nav img {
        margin: 0 auto;
    }

    .sidebar-nav a.text-link {
        text-align: center;
    }

    blockquote {
        margin: 15px 20px;
        padding: 10px 15px;
    }

    .section-heading {
        font-size: 1.75rem;
    }

    .hadith-index-table {
        font-size: 0.75rem;
    }

    .hadith-index-table .hadith-date {
        display: none;
    }
}

/* Print styles */
@media print {
    .nav-menu,
    .content-sidebar,
    .home-sidebar,
    .footer-links {
        display: none;
    }

    body {
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: none;
    }
}
