/* ========== RESET & BASE ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
}

body {
    font-family: 'Poppins', sans-serif;
}

/* ========== ADDITIONAL STYLES ========== */
.calendar-container { 
    max-width:1200px; 
    margin:0 auto; 
    padding:20px; 
    overflow-x: hidden !important;
}

.date-card { 
    background:#fff; 
    border-radius:12px; 
    box-shadow:0 8px 20px rgba(0,0,0,0.06); 
    padding:25px 20px; 
    margin-bottom:30px; 
    transition:0.3s; 
    overflow-x: hidden !important;
}

.date-card:hover { 
    box-shadow:0 12px 30px rgba(0,0,0,0.08); 
}

.date-card h2 { 
    font-family:'Playfair Display',serif; 
    color:#1a2e35; 
    margin-bottom:15px; 
    font-size:28px; 
    border-bottom:2px solid #0c4535; 
    padding-bottom:10px; 
    display:inline-block; 
    word-break: break-word;
}

/* ===== HEADER ===== */
header { 
    text-align:center; 
    margin-bottom:20px; 
}

header h1 { 
    font-family:'Playfair Display',serif; 
    color:#1a2e35; 
    font-size:40px; 
    font-weight:700; 
    word-break: break-word;
}

header p { 
    color:#555; 
    font-size:18px; 
    word-break: break-word;
}

/* ===== TODAY GRID ===== */
.today-grid { 
    display:flex; 
    flex-wrap:wrap; 
    gap:20px; 
    justify-content:space-between; 
}

.today-item { 
    flex:1 1 200px; 
    background:#f8f7f4; 
    padding:15px 20px; 
    border-radius:8px; 
    border-left:4px solid #0c4535; 
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.today-item .label { 
    font-size:14px; 
    text-transform:uppercase; 
    color:#666; 
    letter-spacing:0.5px; 
    word-break: break-word;
}

.today-item .value { 
    font-size:22px; 
    font-weight:600; 
    color:#1a2e35; 
    margin-top:5px; 
    word-break: break-word;
}

.today-item .sub { 
    font-size:16px; 
    color:#555; 
    margin-top:3px; 
    word-break: break-word;
}

/* ===== CALENDAR GRID ===== */
.calendar-grid { 
    display:grid; 
    grid-template-columns:repeat(7,1fr); 
    gap:6px; 
    margin-top:15px; 
    width: 100% !important;
}

.cal-header { 
    font-weight:600; 
    text-align:center; 
    padding:6px 0; 
    background:#1a2e35; 
    color:#fff; 
    border-radius:4px; 
    font-size:14px; 
}

.cal-cell { 
    background:#f9f8f5; 
    border-radius:4px; 
    padding:8px 4px; 
    text-align:center; 
    min-height:50px; 
    display:flex; 
    flex-direction:column; 
    justify-content:center; 
    border:1px solid transparent; 
}

.cal-cell .hijri-main { 
    font-size:22px; 
    font-weight:700; 
    color:#1a2e35; 
    line-height:1.2; 
}

.cal-cell .greg-sub { 
    font-size:12px; 
    color:#777; 
    margin-top:2px; 
}

.cal-cell.today { 
    background:#0c453520; 
    border-color:#0c4535; 
    box-shadow:0 0 0 2px #0c4535; 
}

.cal-cell.today .hijri-main { 
    color:#0c4535; 
}

.cal-cell.empty { 
    background:transparent; 
}

/* ===== MONTH NAV ===== */
.month-nav { 
    display:flex; 
    justify-content:space-between; 
    align-items:center; 
    margin:15px 0 10px; 
    flex-wrap: wrap;
    gap: 10px;
}

.month-nav a { 
    background:#1a2e35; 
    color:#fff; 
    padding:8px 20px; 
    border-radius:30px; 
    text-decoration:none; 
    font-weight:500; 
    transition:0.3s; 
    white-space: nowrap;
}

.month-nav a:hover { 
    background:#0c4535; 
    color:#fff; 
}

.month-nav .month-label { 
    font-size:22px; 
    font-weight:600; 
    color:#1a2e35; 
    font-family:'Playfair Display',serif; 
    text-align:center; 
}

.month-nav .month-label .islamic-month { 
    font-size:16px; 
    font-weight:400; 
    color:#0c4535; 
    display:block; 
}

/* ===== YEAR GRID ===== */
.year-grid { 
    display:grid; 
    grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); 
    gap:25px; 
    margin-top:20px; 
}

.month-card { 
    background:#fff; 
    border-radius:10px; 
    padding:12px 10px; 
    box-shadow:0 4px 12px rgba(0,0,0,0.05); 
    border-top:3px solid #0c4535; 
}

.month-card h3 { 
    text-align:center; 
    font-size:18px; 
    color:#1a2e35; 
    margin:0 0 10px 0; 
    font-family:'Playfair Display',serif; 
}

.month-card .mini-grid { 
    display:grid; 
    grid-template-columns:repeat(7,1fr); 
    gap:2px; 
}

.month-card .mini-cell { 
    background:#f9f8f5; 
    border-radius:2px; 
    padding:2px 0; 
    text-align:center; 
}

.month-card .mini-cell .h { 
    font-size:14px; 
    font-weight:600; 
    color:#1a2e35; 
}

.month-card .mini-cell .g { 
    font-size:10px; 
    color:#999; 
}

.month-card .mini-cell.today { 
    background:#c9a84c30; 
    border:1px solid #0c4535; 
}

/* ===== TOMORROW MINI ===== */
.tomorrow-mini { 
    display:grid; 
    grid-template-columns:repeat(7,1fr); 
    gap:4px; 
    max-width:300px; 
    margin:15px auto; 
}

.tomorrow-mini .day-box { 
    background:#f9f8f5; 
    padding:6px 0; 
    text-align:center; 
    border-radius:4px; 
}

.tomorrow-mini .day-box .hijri-day { 
    font-size:14px; 
    font-weight:600; 
    color:#1a2e35; 
}

.tomorrow-mini .day-box .greg-day { 
    font-size:11px; 
    color:#888; 
}

.tomorrow-mini .day-box.today { 
    background:#c9a84c30; 
    border:2px solid #0c4535; 
}

.tomorrow-mini .day-box.tomorrow { 
    background:#1a2e35; 
    color:#fff; 
}

.tomorrow-mini .day-box.tomorrow .hijri-day { 
    color:#f8f7f4; 
}

.tomorrow-mini .day-box.tomorrow .greg-day { 
    color:#ccc; 
}

.tomorrow-mini .day-box.yesterday { 
    opacity:0.5; 
    border:1px dashed #aaa; 
}

/* ===== TOC ===== */
.toc { 
    background:#f8f7f4; 
    padding:20px 25px; 
    border-radius:8px; 
    margin-bottom:30px; 
    overflow-x: hidden !important;
}

.toc h3 { 
    margin-top:0; 
    color:#1a2e35; 
    font-family:'Playfair Display',serif; 
}

.toc ul { 
    list-style:none; 
    padding-left:0; 
    display:flex; 
    flex-wrap:wrap; 
    gap:10px 20px; 
}

.toc ul li a { 
    color:#1a2e35; 
    font-weight:500; 
    text-decoration:none; 
    border-bottom:2px solid transparent; 
    transition:0.2s; 
    word-break: break-word;
}

.toc ul li a:hover { 
    border-bottom-color:#0c4535; 
    color:#0c4535; 
}

/* ===== FAQ ===== */
.faq-item { 
    border-bottom:1px solid #e0ddd7; 
    padding:12px 0; 
}

.faq-item:last-child { 
    border-bottom:0; 
}

.faq-item .question { 
    font-weight:600; 
    color:#1a2e35; 
    font-size:18px; 
    cursor:pointer; 
    display:flex; 
    justify-content:space-between; 
    align-items:center; 
    word-break: break-word;
    gap: 10px;
}

.faq-item .question i { 
    color:#0c4535; 
    transition:0.3s; 
    flex-shrink: 0;
}

.faq-item .answer { 
    margin-top:8px; 
    color:#444; 
    line-height:1.6; 
    padding-left:10px; 
    word-break: break-word;
}

/* ===== ACCURACY NOTE ===== */
.accuracy-note { 
    font-size:13px; 
    color:#888; 
    text-align:center; 
    margin-top:10px; 
    border-top:1px solid #eee; 
    padding-top:10px; 
}

/* ===== AUTO ADVANCE NOTICE ===== */
.auto-advance-notice { 
    background:#e8f5e9; 
    border-left:4px solid #4caf50; 
    padding:10px 15px; 
    border-radius:4px; 
    margin-bottom:15px; 
    font-size:14px; 
    color:#2e7d32; 
    word-break: break-word;
}

.auto-advance-notice i { 
    margin-right:8px; 
}

/* ===== RECOMMENDED QURAN READING ===== */
.date-card .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
    margin-top: 20px !important;
}

.date-card .col-md-4 {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    padding: 0 15px;
}

/* ============================================================ */
/* ===== RESPONSIVE MEDIA QUERIES ===== */
/* ============================================================ */

/* ===== LARGE TABLETS (992px and below) ===== */
@media (max-width: 992px) {
    .calendar-container { 
        padding: 15px; 
    }
    
    .date-card { 
        padding: 20px 15px; 
    }
    
    .date-card h2 { 
        font-size: 24px; 
    }
    
    header h1 { 
        font-size: 34px; 
    }
    
    header p { 
        font-size: 16px; 
        padding: 0 20px; 
    }
    
    .today-grid { 
        gap: 15px; 
    }
    
    .today-item { 
        flex: 1 1 180px; 
    }
    
    .calendar-grid { 
        gap: 4px; 
    }
    
    .cal-header { 
        font-size: 13px; 
        padding: 5px 0; 
    }
    
    .cal-cell { 
        min-height: 45px; 
        padding: 6px 3px; 
    }
    
    .cal-cell .hijri-main { 
        font-size: 20px; 
    }
    
    .cal-cell .greg-sub { 
        font-size: 11px; 
    }
    
    .date-card .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
        margin-bottom: 15px;
    }
}

/* ===== TABLETS & MOBILE (768px and below) ===== */
@media (max-width: 768px) {
    .calendar-container { 
        padding: 10px; 
        max-width: 100% !important;
    }
    
    .date-card { 
        padding: 15px 12px; 
        margin-bottom: 20px; 
        border-radius: 10px; 
    }
    
    .date-card h2 { 
        font-size: 20px; 
        padding-bottom: 8px; 
        margin-bottom: 12px; 
        display: block; 
        width: 100%; 
    }
    
    /* Header */
    header { 
        margin-bottom: 15px; 
    }
    
    header h1 { 
        font-size: 26px; 
        padding: 0 5px;
    }
    
    header p { 
        font-size: 14px; 
        padding: 0 5px; 
    }
    
    /* Today Grid */
    .today-grid { 
        flex-direction: column; 
        gap: 10px; 
    }
    
    .today-item { 
        flex: 1 1 100%; 
        padding: 12px 15px; 
        border-left-width: 3px; 
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .today-item .label { 
        font-size: 12px; 
    }
    
    .today-item .value { 
        font-size: 18px; 
    }
    
    .today-item .sub { 
        font-size: 14px; 
    }
    
    /* Calendar Grid */
    .calendar-grid { 
        gap: 3px; 
        margin-top: 10px; 
        width: 100% !important;
    }
    
    .cal-header { 
        font-size: 10px; 
        padding: 4px 0; 
        border-radius: 3px; 
    }
    
    .cal-cell { 
        min-height: 38px; 
        padding: 4px 2px; 
        border-radius: 3px; 
    }
    
    .cal-cell .hijri-main { 
        font-size: 16px; 
    }
    
    .cal-cell .greg-sub { 
        font-size: 9px; 
        margin-top: 1px; 
    }
    
    .cal-cell.today { 
        box-shadow: 0 0 0 2px #0c4535; 
    }
    
    /* Month Nav */
    .month-nav { 
        flex-wrap: wrap; 
        gap: 8px; 
        justify-content: center; 
        margin: 10px 0 8px; 
    }
    
    .month-nav a { 
        padding: 6px 14px; 
        font-size: 13px; 
        border-radius: 25px; 
    }
    
    .month-nav .month-label { 
        font-size: 17px; 
        order: -1; 
        width: 100%; 
    }
    
    .month-nav .month-label .islamic-month { 
        font-size: 13px; 
    }
    
    /* Year Grid */
    .year-grid { 
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 
        gap: 12px; 
        margin-top: 12px; 
    }
    
    .month-card { 
        padding: 10px 8px; 
        border-radius: 8px; 
        border-top-width: 2px; 
    }
    
    .month-card h3 { 
        font-size: 15px; 
        margin-bottom: 6px; 
    }
    
    .month-card .mini-cell .h { 
        font-size: 11px; 
    }
    
    .month-card .mini-cell .g { 
        font-size: 8px; 
    }
    
    /* Tomorrow Mini */
    .tomorrow-mini { 
        max-width: 220px; 
        gap: 3px; 
        margin: 10px auto; 
    }
    
    .tomorrow-mini .day-box { 
        padding: 4px 0; 
        border-radius: 3px; 
    }
    
    .tomorrow-mini .day-box .hijri-day { 
        font-size: 11px; 
    }
    
    .tomorrow-mini .day-box .greg-day { 
        font-size: 9px; 
    }
    
    .tomorrow-mini .day-box.today { 
        border-width: 1px; 
    }
    
    /* TOC */
    .toc { 
        padding: 14px 16px; 
        margin-bottom: 20px; 
        border-radius: 6px; 
    }
    
    .toc h3 { 
        font-size: 18px; 
    }
    
    .toc ul { 
        gap: 6px 12px; 
    }
    
    .toc ul li a { 
        font-size: 14px; 
    }
    
    /* FAQ */
    .faq-item .question { 
        font-size: 15px; 
    }
    
    .faq-item .answer { 
        font-size: 13px; 
        padding-left: 8px; 
    }
    
    /* Tomorrow Section */
    #tomorrow > div {
        gap: 12px;
    }
    
    #tomorrow > div > div:first-child {
        padding: 12px 16px;
        border-radius: 6px;
        width: 100%;
        max-width: 100%;
    }
    
    #tomorrow > div > div:first-child > div:nth-child(2) {
        font-size: 22px;
    }
    
    #tomorrow > div > div:last-child {
        min-width: 100%;
        width: 100%;
    }
    
    /* Recommended Quran Reading */
    .date-card .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0 10px;
        margin-bottom: 10px;
    }
    
    .date-card .row {
        margin: 0 -10px;
        margin-top: 15px !important;
    }
    
    /* Table */
    .table-responsive {
        margin: 0 -10px;
        padding: 0 10px;
    }
    
    .table-responsive table {
        font-size: 13px;
        min-width: 600px;
    }
    
    .table-responsive table td,
    .table-responsive table th {
        padding: 8px 10px;
    }
}

/* ===== SMALL MOBILE PHONES (480px and below) ===== */
@media (max-width: 480px) {
    .calendar-container { 
        padding: 6px; 
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .date-card { 
        padding: 12px 8px; 
        margin-bottom: 12px; 
        border-radius: 8px; 
        overflow-x: hidden !important;
    }
    
    .date-card h2 { 
        font-size: 17px; 
        padding-bottom: 6px; 
        margin-bottom: 10px; 
    }
    
    .date-card h2 i { 
        margin-right: 5px; 
        font-size: 15px; 
    }
    
    /* Header */
    header { 
        margin-bottom: 10px; 
    }
    
    header h1 { 
        font-size: 20px; 
        line-height: 1.3; 
        padding: 0 3px;
    }
    
    header p { 
        font-size: 13px; 
        padding: 0 3px; 
        line-height: 1.5; 
    }
    
    /* Today Grid */
    .today-grid { 
        gap: 8px; 
    }
    
    .today-item { 
        padding: 10px 12px; 
        border-left-width: 3px; 
        border-radius: 6px; 
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .today-item .label { 
        font-size: 10px; 
        letter-spacing: 0.3px; 
    }
    
    .today-item .value { 
        font-size: 16px; 
        margin-top: 2px; 
    }
    
    .today-item .sub { 
        font-size: 12px; 
        margin-top: 2px; 
    }
    
    /* Calendar Grid */
    .calendar-grid { 
        gap: 2px; 
        margin-top: 8px; 
        width: 100% !important;
        min-width: 0 !important;
    }
    
    .cal-header { 
        font-size: 8px; 
        padding: 3px 0; 
        border-radius: 2px; 
    }
    
    .cal-cell { 
        min-height: 30px; 
        padding: 3px 1px; 
        border-radius: 2px; 
    }
    
    .cal-cell .hijri-main { 
        font-size: 13px; 
        line-height: 1.1; 
    }
    
    .cal-cell .greg-sub { 
        font-size: 7px; 
        margin-top: 0; 
    }
    
    .cal-cell.today { 
        box-shadow: 0 0 0 1px #0c4535; 
    }
    
    /* Month Nav */
    .month-nav { 
        gap: 5px; 
        margin: 6px 0 5px; 
    }
    
    .month-nav a { 
        padding: 4px 10px; 
        font-size: 11px; 
        border-radius: 20px; 
        min-height: 30px; 
        display: flex; 
        align-items: center; 
    }
    
    .month-nav a i {
        font-size: 10px;
    }
    
    .month-nav .month-label { 
        font-size: 14px; 
    }
    
    .month-nav .month-label .islamic-month { 
        font-size: 11px; 
    }
    
    /* Year Grid */
    .year-grid { 
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
        gap: 8px; 
        margin-top: 10px; 
    }
    
    .month-card { 
        padding: 6px 4px; 
        border-radius: 6px; 
        border-top-width: 2px; 
    }
    
    .month-card h3 { 
        font-size: 12px; 
        margin-bottom: 4px; 
    }
    
    .month-card .mini-grid { 
        gap: 1px; 
    }
    
    .month-card .mini-cell { 
        padding: 1px 0; 
        border-radius: 1px; 
    }
    
    .month-card .mini-cell .h { 
        font-size: 9px; 
    }
    
    .month-card .mini-cell .g { 
        font-size: 6px; 
    }
    
    /* Tomorrow Mini */
    .tomorrow-mini { 
        max-width: 160px; 
        gap: 2px; 
        margin: 8px auto; 
    }
    
    .tomorrow-mini .day-box { 
        padding: 3px 0; 
        border-radius: 2px; 
    }
    
    .tomorrow-mini .day-box .hijri-day { 
        font-size: 9px; 
    }
    
    .tomorrow-mini .day-box .greg-day { 
        font-size: 7px; 
    }
    
    .tomorrow-mini .day-box.today { 
        border-width: 1px; 
    }
    
    /* TOC */
    .toc { 
        padding: 10px 12px; 
        margin-bottom: 12px; 
        border-radius: 6px; 
    }
    
    .toc h3 { 
        font-size: 16px; 
        margin-bottom: 8px; 
    }
    
    .toc ul { 
        flex-direction: column; 
        gap: 4px; 
    }
    
    .toc ul li a { 
        font-size: 13px; 
        padding: 4px 0; 
        display: block; 
    }
    
    /* FAQ */
    .faq-item { 
        padding: 8px 0; 
    }
    
    .faq-item .question { 
        font-size: 13px; 
        min-height: 36px; 
        align-items: center; 
        gap: 8px;
    }
    
    .faq-item .question i { 
        font-size: 13px; 
        flex-shrink: 0; 
    }
    
    .faq-item .answer { 
        font-size: 12px; 
        padding-left: 4px; 
        line-height: 1.5; 
    }
    
    /* Tomorrow Section */
    #tomorrow > div {
        gap: 10px;
        flex-direction: column;
    }
    
    #tomorrow > div > div:first-child {
        padding: 10px 12px;
        width: 100%;
        max-width: 100%;
        border-radius: 6px;
    }
    
    #tomorrow > div > div:first-child > div:first-child {
        font-size: 11px;
    }
    
    #tomorrow > div > div:first-child > div:nth-child(2) {
        font-size: 18px;
    }
    
    #tomorrow > div > div:first-child > div:last-child {
        font-size: 12px;
    }
    
    #tomorrow > div > div:last-child {
        min-width: 100%;
        width: 100%;
    }
    
    #tomorrow > div > div:last-child > div:last-child {
        font-size: 10px;
        margin-top: 5px;
    }
    
    /* Auto Advance */
    .auto-advance-notice { 
        font-size: 11px; 
        padding: 6px 8px; 
        margin-bottom: 8px; 
        border-left-width: 3px; 
    }
    
    .auto-advance-notice i { 
        margin-right: 4px; 
        font-size: 11px;
    }
    
    /* Accuracy Note */
    .accuracy-note { 
        font-size: 10px; 
        margin-top: 6px; 
        padding-top: 6px; 
    }
    
    /* Recommended Quran Reading */
    .date-card .col-md-4 {
        padding: 0 5px;
    }
    
    .date-card .row {
        margin: 0 -5px;
        margin-top: 10px !important;
    }
    
    .date-card .today-item h4 {
        font-size: 14px;
        margin-bottom: 3px;
    }
    
    .date-card .today-item h4 a {
        font-size: 14px;
    }
    
    .date-card .today-item p {
        font-size: 12px;
    }
    
    /* Table */
    .table-responsive {
        margin: 0 -5px;
        padding: 0 5px;
    }
    
    .table-responsive table {
        font-size: 11px;
        min-width: 450px;
    }
    
    .table-responsive table td,
    .table-responsive table th {
        padding: 5px 6px;
    }
    
    /* Calendar description */
    .date-card > p {
        font-size: 12px !important;
    }
}

/* ===== EXTRA SMALL (380px and below) ===== */
@media (max-width: 380px) {
    .calendar-container { 
        padding: 4px; 
    }
    
    .date-card { 
        padding: 10px 6px; 
        margin-bottom: 10px; 
    }
    
    .date-card h2 { 
        font-size: 15px; 
    }
    
    header h1 { 
        font-size: 18px; 
    }
    
    header p { 
        font-size: 12px; 
    }
    
    .today-item { 
        padding: 8px 10px; 
    }
    
    .today-item .value { 
        font-size: 14px; 
    }
    
    .cal-cell .hijri-main { 
        font-size: 11px; 
    }
    
    .cal-cell .greg-sub { 
        font-size: 6px; 
    }
    
    .month-nav .month-label { 
        font-size: 12px; 
    }
    
    .month-nav a { 
        font-size: 10px; 
        padding: 3px 8px; 
    }
    
    .toc ul li a { 
        font-size: 12px; 
    }
    
    .faq-item .question { 
        font-size: 12px; 
    }
    
    .faq-item .answer { 
        font-size: 11px; 
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .calendar-container {
        padding: 0;
    }
    .date-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    .month-nav a {
        display: none;
    }
    .toc {
        display: none;
    }
    nav, .nav-center, .nav-end, .drawer, .menu-btn {
        display: none !important;
    }
    footer {
        display: none !important;
    }
}