@font-face {
    font-family: 'JameelNooriKasheeda';
    src: url('../../fonts/JameelNooriKasheeda.woff2') format('woff2');
}

@font-face {
    font-family: 'Noto';
    src: url('../../fonts/Noto.ttf') format('woff2');
}

@font-face {
    font-family: 'MehrNastaliqWeb';
    src: url('../../fonts/MehrNastaliqWeb.woff2') format('woff2');
}

h1 {
    font-family: 'JameelNooriKasheeda', sans-serif;
    font-size: 3.0vw;
    color: #000000;
    text-align: center;
    margin: 1vw 0;
    position: relative;
}

h2 {
    font-family: 'JameelNooriKasheeda', sans-serif;
    font-size: 1.8rem;
    color: #000000;
    text-align: center;
    margin: 1.5vw 0;
}

.header-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 4vw;
    margin-bottom: 1.5vw;
}

.logo-left {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8.5vw;
    right: 10vw;
    margin-bottom: 2vw;
}

body {
    font-family: 'MehrNastaliqWeb', sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 60px 0 2vw 0;
    color: #000000;
    direction: rtl;
    width: 100%;
    min-width: 320px;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
}

.input-section {
    display: block;
    background-color: #FFFFFF;
    padding: 2vw 5vw;
    margin: 0 auto;
    width: 80%;
    max-width: 1200px;
    box-shadow: 0 0.2vw 0.4vw rgba(0, 0, 0, 0.1);
    border-radius: 0.4rem;
    z-index: 300;
    position: relative;
    box-sizing: border-box;
    text-align: center;
    justify-content: center;
}

.input-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 2vw;
    gap: 2vw;
    box-sizing: border-box;
    direction: rtl;
    text-align: right;
}

.input-group {
    flex: 1;
    min-width: 0;
    margin: 0 vw;
}

.input-group:last-child {
    margin-right: 0;
}

.input-group label {
    display: block;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-weight: 700;
    color: #000000;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.input-group label small {
    display: inline-block !important;
    font-size: 0.9rem;
    color: #666666;
    margin: 0 5px;
    font-weight: normal;
    visibility: visible !important;
}

input,
select {
    width: 100%;
    padding: 0.7rem 0.5rem;
    border: 0.1rem solid #D1D5DB;
    border-radius: 0.4rem;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-size: 1rem;
    -webkit-user-select: text;
    user-select: text;
    box-sizing: border-box;
    margin: 0;
}

.input-group input,
.input-group select {
    direction: ltr;
    unicode-bidi: plaintext;
}

.button-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 2vw;
    margin-top: 2vw;
}

button {
    padding: 0.5rem 2vw;
    color: #FFFFFF;
    border: none;
    border-radius: 0.4rem;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    flex: 1;
    font-size: 1.2rem;
}

#calculate-btn {
    background-color: #3599db;
}

#trace-btn {
    background-color: #2fcc70;
}

button:hover {
    transform: scale(1.05);
}

#calculate-btn:hover {
    background-color: #27a65b;
}

#trace-btn:hover {
    background-color: #2d81b8;
}

.output-section {
    margin-top: 2vw;
    width: 100%;
    max-width: 100vw;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    overflow-x: hidden;
}

.qibla-section {
    background-color: #edf1f2;
    padding: 1vw 0;
    margin: 0.05rem 0;
    width: 100%;
    box-shadow: 0 0.2vw 0.4vw rgba(0, 0, 0, 0.1);
    border-radius: 0.4rem;
    text-align: center;
    font-size: 1.8rem;
    color: #000000;
}

.city-name-section {
    background-color: #edf1f2;
    padding: 1vw 0;
    margin: 0.05rem 0;
    width: 100%;
    box-shadow: 0 0.2vw 0.4vw rgba(0, 0, 0, 0.1);
    border-radius: 0.4rem;
    text-align: center;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-size: 1.5rem;
    color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    direction: rtl;
}

.city-search-group {
    position: relative;
    z-index: 1000;
}

.city-search-suggestions {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    left: 0;
    background-color: #ffffff;
    border: 0.1rem solid #d1d5db;
    border-radius: 0.4rem;
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.12);
    max-height: 16rem;
    overflow-y: auto;
    z-index: 1001;
}

.city-search-suggestion {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    background: transparent;
    color: #000000;
    text-align: right;
    cursor: pointer;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-size: 1rem;
}

.city-search-suggestion:hover,
.city-search-suggestion:focus {
    background-color: #edf1f2;
    outline: none;
}

.city-search-suggestion small {
    display: block;
    margin-top: 0.15rem;
    color: #555555;
    font-size: 0.9rem;
}

#qibla span {
    font-family: 'MehrNastaliqWeb', sans-serif;
    direction: rtl;
    padding: 0.5vw 0;
    display: inline-block;
}

.table-container {
    position: relative;
    background-color: #FFFFFF;
    padding: 2vw;
    margin-bottom: 2vw;
    box-shadow: 0 0.2vw 0.4vw rgba(0, 0, 0, 0.1);
    border-radius: 0.4rem;
    width: 90%;
    max-width: calc(100vw - 20px);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    overflow-x: auto;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    opacity: 0.09;
    z-index: 3;
}

table {
    width: 100%;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0.3rem;
    position: relative;
    z-index: 2;
    background-color: transparent;
    box-sizing: border-box;
}

th,
td {
    border: none;
    padding: 0.3rem;
    text-align: center;
    white-space: nowrap;
    font-family: 'MehrNastaliqWeb', sans-serif;

    font-size: 1.6vw;
}

th {
    background-color: #3599db;
    color: #FFFFFF;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-size: 1.8vw;
}

td {
    font-weight: bold;
    direction: ltr;
}

tr:nth-child(even) td {
    background-color: #f2f2f2;
}

tr:nth-child(odd) td {
    background-color: #fafafa;
}

tr:first-child td:first-child {
    background-color: #FFFFFF;
}

.error {
    color: red;
}

#save-pdf-btn {
    display: block;
    /* ہمیشہ ظاہر */
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'MehrNastaliqWeb', sans-serif;
    font-size: 0.8rem;
    transition: background-color 0.3s, transform 0.2s;
    z-index: 10;
    position: relative;
    width: 100%;
    max-width: 200px;
    text-align: center;
}

#save-pdf-btn.visible {
    display: block;
    /* دکھائیں جب .visible کلاس شامل ہو */
}

#save-pdf-btn:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.pdf-button-container {
    display: flex;
    /* یا block، لیکن flex سینٹرنگ کے لیے بہتر ہے */
    justify-content: center;
    /* بٹن کو کنٹینر کے اندر سینٹر کریں */
    align-items: center;
    /* عمودی سینٹرنگ */
    margin: 10px auto;
    /* آٹو مارجن سے سینٹر میں آ جائے گا */
    width: 100%;
    /* پوری چوڑائی استعمال کریں تاکہ سینٹرنگ کام کرے */
    max-width: 300px;
    /* بٹن کی زیادہ سے زیادہ چوڑائی */
    position: relative;
    z-index: 10;
    box-sizing: border-box;
    /* right:38%; یہ لائن ہٹا دیں */
}

.detailed-times-button-container {
    text-align: center;
    margin: 10px 0;
    display: none;
    /* This line hides the button by default */
}

.detailed-times-btn {
    color: blue;
    /* Dark blue text color */
    border: 0px none #0A0A23;
    border-radius: 20px;
    /* Rounded corners */
    padding: 7.528px 19.185px;
    font-size: 1.5vw;
    font-family: MehrNastaliqWeb, sans-serif;
    /* Consistent font with the website */
    font-weight: 400;
    text-align: center;
    cursor: pointer;
    display: inline-block;
    margin: 0px;
    text-decoration: none;
    /* Remove underline from link */
    transition: all 0.3s ease;
    /* Smooth transition for hover effects */
}

.detailed-times-btn:hover {
    transform: scale(1.05);
    /* Slight scale effect on hover */
    text-decoration: none;
}

.detailed-times-btn:focus {
    outline: 2px solid #0A0A23;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    body {
        direction: rtl;
    }

    h1 {
        font-size: 1.7rem;
        margin: 15vw 0 4vw 0;
    }

    h2 {
        font-size: 1.9rem;
    }

    .logo-left {
        width: 10vw;
        right: 3vw;
    }

    .input-section {
        display: block;
        width: 90%;
        max-width: none;
        padding: 4vw 3vw;
        margin: 0 auto;
    }

    .input-row {
        display: flex;
        flex-direction: column;
        margin-bottom: 1.5vw;
        width: 100%;
    }

    .input-group {
        margin-right: 0;
        margin-left: 0;
        margin-bottom: 1.5vw;
        transform: none;
    }

    .input-group:last-child {
        margin-bottom: 0;
    }

    .city-search-suggestions {
        max-height: 14rem;
    }

    .city-search-suggestion {
        padding: 1rem;
        font-size: 1rem;
    }

    .input-group label {
        font-size: 1.3rem;
        text-align: right;
    }

    input,
    select {
        width: 100%;
        padding: 0 0.5rem;
        font-size: 16px;
    }

    .button-container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        text-align: center;
    }

    button {
        width: 100%;
        font-size: 1.3rem;
        padding: 0.2rem;
        margin: 0.2rem;
    }

    .button-container button:first-child {
        order: 2;
        /* Pushes it below */
    }

    .button-container button:last-child {
        order: 1;
        /* Brings it above */
    }

    .qibla-section {
        font-size: 1.2rem;
        padding: 1.5rem 1rem;
    }

    #qibla span {
        padding: 2vw 0;
    }

    .table-container {
        padding: 1rem;
        width: 95%;
        max-width: calc(100vw - 10px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        width: 100%;
        min-width: 600px;
        font-size: 0.8rem;
    }

    th,
    td {
        font-size: 0.7rem;
        padding: 0.3rem 0.1rem;
        white-space: nowrap;
    }

    th {
        font-size: 0.75rem;
    }

    .watermark {
        width: 70%;
    }

    #save-pdf-btn.visible {
        display: block;
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding-top: 0;
        padding-left: 0;
    }

    h2 {
        font-size: 1.2rem;
    }

    .logo-left {
        width: 15vw;
    }




    table {
        width: 100%;
    }

    .input-section {
        width: 95%;
        padding: 3vw 2vw;
    }

    .input-row {
        width: 100%;
        gap: 0.8rem;
    }

    .input-group {
        width: 100%;
    }

    .qibla-section {
        font-size: 1.1rem;
        padding: 1rem;
    }

    th {
        font-size: 1.0rem;
    }

    td {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 0.3rem 0.1rem;
    }


}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 44px;
        min-width: 44px;
    }

    input,
    select {
        min-height: 44px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Better focus states for accessibility */
input:focus,
select:focus,
button:focus {
    outline: 2px solid #3599db;
    outline-offset: 2px;
}

/* Improved button spacing on mobile */
@media screen and (max-width: 480px) {
    .button-container button {
        margin: 0.5rem 0;
        padding: 0;
        font-size: 1.1rem;
    }

    .detailed-times-btn {
        font-size: 1rem;
    }
}

/* موبائل میں horizontal scroll کے لیے */
@media screen and (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .output-section {
        padding: 0 5px;
    }

    .table-container {
        margin: 1rem 2.5%;
        width: 95%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 650px;
    }

    /* PDF button کو موبائل میں بہتر بنانے کے لیے */
    .pdf-button-container {
        width: 100%;
        padding: 0 10px;
        margin: 15px 0;
    }

    #save-pdf-btn {
        width: 100%;
        max-width: 250px;
        padding: 0 20px;
        font-size: 1.1rem;
    }
}

/* چھوٹی سکرین کے لیے */
@media screen and (max-width: 480px) {
    .table-container {
        margin: 0.5rem 1%;
        width: 98%;
        padding: 0.5rem;
    }

    table {
        min-width: 600px;
    }

    th,
    td {
        padding: 0.2rem 0.05rem;
    }
}

/* Layout overrides: mobile input 2x2 and desktop city/qibla 2-column */
@media screen and (max-width: 768px) {
    .input-row {
        flex-direction: column;
        margin-bottom: 1.5vw;
        position: relative;
        z-index: 1;
    }

    .input-row:first-of-type {
        z-index: 5000;
    }

    #prayerForm .input-row:nth-of-type(2),
    #prayerForm .input-row:nth-of-type(3) {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.8rem;
        width: 100%;
    }

    #prayerForm .input-row:nth-of-type(2) .input-group,
    #prayerForm .input-row:nth-of-type(3) .input-group {
        margin: 0 !important;
        width: 100%;
    }
}

@media screen and (min-width: 769px) {
    .output-section {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .output-section>.city-name-section,
    .output-section>.qibla-section {
        display: flex;
        width: 50%;
        max-width: 50%;
        box-sizing: border-box;
        margin: 0;
    }

    .output-section>.city-name-section {
        padding-right: 0.5rem;
    }

    .output-section>.qibla-section {
        padding-left: 0.5rem;
    }

    .output-section> :not(.city-name-section):not(.qibla-section) {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Unified city/qibla typography + alignment across mobile and desktop */
.city-name-section,
.qibla-section {
    font-size: 1.5rem;
    text-align: center;
    direction: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

@media screen and (max-width: 480px) {

    .city-name-section,
    .qibla-section {
        font-size: 1.2rem;
    }
}