/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(rgba(255,255,255,0.9), rgba(255,255,255,0.9));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

:root {
    --islamic-primary: #1a472a;
    --islamic-secondary: #2d7d46;
    --islamic-gold: #c9a43d;
    --islamic-dark: #0d1b12;
    --header-height: 0px;
}

/* Container fixes */
.container {
    width: 100%;
    max-width: 1200px;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

/* Header Styles */
.header {
    position: relative;
    z-index: 1050;
    width: 100%;
    overflow: hidden;
}

.header-top {
    background: var(--islamic-dark);
    color: white;
    border-bottom: 3px solid var(--islamic-gold);
    width: 100%;
    overflow: hidden;
}

.islamic-border {
    height: 5px;
    background: repeating-linear-gradient(90deg, var(--islamic-gold), var(--islamic-primary) 20px);
    width: 100%;
}

.arabic-text {
    font-size: 1.8rem;
    font-family: 'Amiri', 'Traditional Arabic', serif;
    color: var(--islamic-gold);
    letter-spacing: 2px;
    margin: 0 15px;
    display: inline-block;
}

.header-main {
    background: linear-gradient(135deg, var(--islamic-primary), var(--islamic-secondary));
    color: white;
    border-bottom: 4px solid var(--islamic-gold);
    width: 100%;
    overflow: hidden;
}

.logo-img {
    height: 80px;
    width: auto;
    max-width: 100%;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 0;
    word-break: break-word;
}

.site-subtitle {
    font-size: 1rem;
    color: var(--islamic-gold);
    font-weight: 300;
    letter-spacing: 3px;
}

.contact-info {
    color: white;
    font-size: 0.9rem;
}

.contact-info i {
    color: var(--islamic-gold);
    margin-right: 8px;
}

/* Islamic Navigation - STICKY */
.islamic-nav {
    background: linear-gradient(90deg, #0d1b12, #1a472a);
    border-bottom: 2px solid var(--islamic-gold);
    padding: 0;
    position: sticky !important;
    top: 0 !important;
    z-index: 1040 !important;
    width: 100% !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: visible;
}

.islamic-nav .navbar {
    padding: 0;
    width: 100%;
}

.islamic-nav .navbar-nav .nav-link {
    color: white !important;
    padding: 15px 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.islamic-nav .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--islamic-gold);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.islamic-nav .navbar-nav .nav-link:hover::after,
.islamic-nav .navbar-nav .nav-link.active::after {
    width: 80%;
}

.islamic-nav .navbar-nav .nav-link:hover {
    background: rgba(255,255,255,0.1);
}

/* Fix for navbar toggler */
.navbar-toggler {
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 12px;
    margin: 5px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(201, 164, 61, 0.3);
}

/* Main Content - FLEXIBLE */
.main-content {
    flex: 1 0 auto;
    min-height: 500px;
    padding: 40px 0;
    width: 100%;
    overflow-x: hidden;
}

.islamic-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    padding: 30px;
    margin-bottom: 30px;
    border-left: 4px solid var(--islamic-gold);
    transition: transform 0.3s ease;
    overflow: hidden;
    width: 100%;
}

.islamic-card:hover {
    transform: translateY(-5px);
}

/* Footer - STICKY TO BOTTOM */
.footer {
    flex-shrink: 0;
    background: var(--islamic-dark);
    color: white;
    padding: 50px 0 20px;
    border-top: 4px solid var(--islamic-gold);
    margin-top: auto;
    width: 100%;
    overflow: hidden;
}

.footer-title {
    color: var(--islamic-gold);
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
    word-break: break-word;
}

.footer-links a:hover {
    color: var(--islamic-gold);
    padding-left: 5px;
}

.footer-contact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-contact li {
    margin-bottom: 10px;
    color: #ccc;
    word-break: break-word;
}

.footer-contact i {
    color: var(--islamic-gold);
    width: 25px;
    flex-shrink: 0;
}

.social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.social-icons a:hover {
    background: var(--islamic-gold);
    transform: translateY(-3px);
    color: white;
}

.footer-islamic-border {
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--islamic-gold), var(--islamic-primary) 20px);
    margin: 20px 0;
    width: 100%;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-bottom p {
    margin-bottom: 5px;
    color: #aaa;
    word-break: break-word;
}

.developer-credit {
    font-size: 0.9rem;
    color: #888;
}

.developer-credit a {
    color: var(--islamic-gold);
    text-decoration: none;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, rgba(26,71,42,0.9), rgba(13,27,18,0.95));
    padding: 60px 0;
    color: white;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.hero-section::before {
    content: '﷽';
    position: absolute;
    right: -50px;
    top: -50px;
    font-size: 300px;
    opacity: 0.05;
    font-family: 'Amiri', serif;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    word-break: break-word;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    word-break: break-word;
}

/* ===== MOBILE FIXES ===== */

/* Mobile Menu Improvements */
@media (max-width: 991px) {
    .islamic-nav .navbar-collapse {
        background: var(--islamic-primary);
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0;
        margin: 0 -15px;
        width: calc(100% + 30px);
    }
    
    .islamic-nav .navbar-nav .nav-link {
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        white-space: normal;
        word-break: break-word;
    }
    
    .islamic-nav .navbar-nav .nav-link::after {
        display: none;
    }
    
    .navbar-toggler {
        margin: 5px 0;
    }
}

/* Tablet & Mobile Responsive */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    .header, .header-top, .header-main, .islamic-nav {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    .container, .container-fluid {
        padding-right: 12px !important;
        padding-left: 12px !important;
    }
    
    .row {
        margin-right: -8px !important;
        margin-left: -8px !important;
    }
    
    .col-3, .col-6, .col-md-3, .col-md-6 {
        padding-right: 8px !important;
        padding-left: 8px !important;
    }
    
    .logo-img {
        height: 50px;
        width: auto;
        max-width: 100%;
    }
    
    .site-title {
        font-size: 1.1rem;
        word-break: break-word;
    }
    
    .site-subtitle {
        font-size: 0.7rem;
        letter-spacing: 1px;
        word-break: break-word;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .arabic-text {
        font-size: 0.9rem;
        margin: 0 5px;
    }
    
    .hero-section {
        padding: 40px 0;
    }
    
    .islamic-card {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-title {
        font-size: 1rem;
    }
    
    .footer-links a,
    .footer-contact li {
        font-size: 0.85rem;
    }
    
    .contact-info {
        font-size: 0.7rem;
    }
    
    .contact-info .d-none {
        display: none !important;
    }
    
    .main-content {
        padding: 20px 0;
        min-height: 300px;
    }
    
    /* Fix table overflow */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
    }
    
    .table {
        min-width: 600px;
        width: 100%;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    .container, .container-fluid {
        padding-right: 8px !important;
        padding-left: 8px !important;
    }
    
    .row {
        margin-right: -5px !important;
        margin-left: -5px !important;
    }
    
    .col-3, .col-6, .col-md-3, .col-md-6 {
        padding-right: 5px !important;
        padding-left: 5px !important;
    }
    
    .logo-img {
        height: 38px;
    }
    
    .site-title {
        font-size: 0.85rem;
    }
    
    .site-subtitle {
        font-size: 0.55rem;
        letter-spacing: 0.5px;
    }
    
    .arabic-text {
        font-size: 0.7rem;
        margin: 0 3px;
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
    
    .hero-subtitle {
        font-size: 0.8rem;
    }
    
    .hero-section {
        padding: 25px 0;
    }
    
    .hero-section::before {
        font-size: 150px;
        right: -30px;
        top: -30px;
    }
    
    .islamic-card {
        padding: 15px 10px;
        border-left-width: 3px;
    }
    
    .islamic-card h3 {
        font-size: 1.1rem;
    }
    
    .footer {
        padding: 20px 0 10px;
    }
    
    .footer-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .footer-divider {
        width: 30px;
        height: 2px;
    }
    
    .footer-links a,
    .footer-contact li {
        font-size: 0.75rem;
    }
    
    .footer-contact li {
        display: flex;
        align-items: flex-start;
        gap: 8px;
    }
    
    .footer-contact i {
        width: 18px;
        font-size: 0.8rem;
        margin-top: 2px;
    }
    
    .social-icons a {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .contact-info {
        font-size: 0.6rem;
    }
    
    .contact-info i {
        margin-right: 3px;
    }
    
    .main-content {
        padding: 15px 0;
        min-height: 200px;
    }
    
    .copyright {
        font-size: 0.65rem !important;
    }
    
    .developer-credit {
        font-size: 0.6rem !important;
    }
    
    /* Fix buttons on mobile */
    .btn {
        padding: 8px 16px !important;
        font-size: 0.8rem !important;
        width: 100%;
        text-align: center;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: 30px;
        padding: 6px 10px !important;
        font-size: 0.7rem !important;
    }
    
    /* Fix form elements */
    .form-control, .form-select {
        font-size: 14px !important;
        padding: 8px 10px !important;
    }
    
    /* Fix badges */
    .badge {
        font-size: 0.6rem !important;
        padding: 3px 8px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
    }
    
    .islamic-card {
        background: #2a2a2a;
        color: #e0e0e0;
    }
    
    .footer {
        background: #0a0a0a;
    }
}

/* Fix for images */
img {
    max-width: 100%;
    height: auto;
}

/* Fix for iframes and videos */
iframe, video, embed {
    max-width: 100%;
}

/* Fix for sticky header on all browsers */
@supports (position: sticky) {
    .islamic-nav {
        position: sticky !important;
        top: 0 !important;
    }
}

/* Safari iOS fix for sticky */
@supports (-webkit-touch-callout: none) {
    .islamic-nav {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
    }
}