@font-face {
    font-family: 'JameelNooriKasheeda';
    src: url('../../fonts/Lora-Italic.woff2') format('woff2');
}

@font-face {
    font-family: 'JameelNooriNastaleeq';
    src: url('../../fonts/HelveticaNeue-Light.woff2') format('woff2');
}

@font-face {
    font-family: 'MehrNastaliqWeb';
    src: url('../../fonts/HelveticaNeue-Light.woff2') format('woff2');
}

.menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 8vw;
    z-index: 1000;
    background-color: #0a0a24;
    overflow: hidden;
}

.nav-menu {
    display: flex;
    justify-content: left;
    align-items: center;
    height: 100%;
    padding: 0;
    position: relative;
}

.menu-logo {
    height: 6vw;
    width: auto;
    cursor: pointer;
    margin: 0.5vw;
}

.menu-logo:hover {
    transform: scale(1.1);
}

.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin: 2vw 1vw 0 1vw;
}

.nav-links li a {
    font-family: 'JameelNooriNastaleeq', sans-serif;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.nav-links li a:hover {
    color: #ffd900;
}

.menu-toggle {
    display: none;
    font-size: 2rem;
    cursor: pointer;
    color: white;
    padding: 0 1vw;
    position: relative;
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
}

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;
    left: 10vw;
    margin-bottom: 2vw;
}

body {
    font-family: 'MehrNastaliqWeb', sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 60px 0 2vw 0;
    color: #000000;
    direction: ltr;
    width: 100%;
    min-width: 320px;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
}

.input-section {
    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;
    display: block;
    z-index: 300;
    position: relative;
    box-sizing: border-box;
}

.input-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 2vw;
    gap: 2vw;
    box-sizing: border-box;
}

.input-group {
    flex: 1;
    min-width: 0;
    margin: 0 vw;
}

.input-group:last-child {
    margin-right: 0;
}

.input-group label {
    display: block;
    font-family: 'JameelNooriNastaleeq', sans-serif;
    font-weight: 700;
    color: #000000;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.input-group label small {
    display: inline-block !important;
    font-size: 0.8rem;
    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;
}

.button-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 2vw;
    margin-top: 2vw;
}

button {
    padding: 0.7rem 2vw;
    color: #FFFFFF;
    border: none;
    border-radius: 0.4rem;
    font-family: 'JameelNooriNastaleeq', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    flex: 1;
    font-size: 1.5rem;
}

#calculate-btn {
    background-color: #2fcc70;
}

#trace-btn {
    background-color: #3599db;
}

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%;
    margin-left: auto;
    margin-right: auto;
}

.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-family: 'JameelNooriNastaleeq', sans-serif;
    font-size: 1.5rem;
    color: #000000;
    box-sizing: border-box;
}

.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: 'JameelNooriNastaleeq', sans-serif;
    color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    direction: ltr;
    box-sizing: border-box;
}

.city-search-group {
    position: relative;
    z-index: 2000;
}

.city-search-suggestions {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 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: left;
    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: ltr;
    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%;
    margin-left: auto;
    margin-right: auto;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    opacity: 0.09;
    z-index: 3;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0.3rem;
    position: relative;
    z-index: 2;
    background-color: transparent;
}

th,
td {
    border: none;
    padding: 0.3rem;
    text-align: center;
    white-space: nowrap;
    font-family: 'MehrNastaliqWeb', sans-serif;
    direction: ltr;
    font-size: 1.5vw;
}

th {
    background-color: #3599db;
    color: #FFFFFF;
    font-family: 'JameelNooriNastaleeq', sans-serif;
    font-size: 1.5vw;
}

td {
    font-weight: bold;
}

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;
}

.pdf-button-container {
    display: flex;
    justify-content: center;
    /* بٹن کو کنٹینر کے اندر سینٹر کریں */
    align-items: center;
    /* عمودی سینٹرنگ */
    margin: 10px 0;
    /* کنٹینر کو اسکرین کے درمیان میں لائیں */
    width: 40%;
    /* کنٹینر کی چوڑائی 30% */
    max-width: 300px;
    /* زیادہ سے زیادہ چوڑائی محدود کریں */
    position: relative;
    z-index: 10;
    box-sizing: border-box;
    left: 50%;
    transform: translateX(-50%);
    padding: 0;
}

#save-pdf-btn {
    display: none;
    /* شروع میں چھپا ہوا */
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JameelNooriNastaleeq', sans-serif;
    font-size: 1rem;
    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 !important;
    /* ہر ڈیوائس پر دکھائیں جب .visible کلاس ہو */
}

#save-pdf-btn:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.pdf-button-container {
    text-align: center;
    margin: 10px 0;
    display: none;
    /* Initially hidden, controlled by JavaScript */
}

#save-pdf-btn {
    padding: 10px 20px;
    color: #FFFFFF;
    background-color: #e74c3c;
    border: none;
    border-radius: 4px;
    font-family: 'JameelNooriNastaleeq', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    font-size: 1rem;
    position: relative;
    display: inline-block;
    /* Ensure button is visible when container is shown */
}

#save-pdf-btn:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

#save-pdf-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
}


.debug-message {
    color: red;
    text-align: center;
    margin: 10px 0;
    display: none;
}

#custom-timezone-wrapper {
    margin-top: 10px;
}

.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: 16px;
    font-family: JameelNooriNastaleeq, 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 {
        overflow-x: hidden;
    }

    .header-container {
        margin-top: 0vh;
    }

    .menu-container {
        height: 7vw;
        z-index: 1003;
        position: relative;
        overflow: visible;
    }

    .menu-toggle {
        display: block;
        position: absolute;
        right: 2vw;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1002;
        cursor: pointer;
        font-size: 2rem;
        color: white;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 7vw;
        right: 0;
        width: 80%;
        min-width: 200px;
        background-color: #0a0a24;
        padding: 2vw;
        z-index: 1001;
        border-radius: 0.4rem;
        box-sizing: border-box;
        transition: all 0.3s ease;
        opacity: 0;
        transform: translateX(100%);
    }

    .nav-links.active {
        display: flex !important;
        opacity: 1;
        transform: translateX(0);
    }

    .nav-links li {
        width: 100%;
        padding: 2vw 0;
    }

    .nav-links li a {
        display: block;
        padding: 0.5vw 1vw;
        color: white;
        text-decoration: none;
        font-size: 1.2rem;
        font-family: 'JameelNooriNastaleeq', sans-serif;
    }

    .nav-menu {
        justify-content: flex-end;
        position: relative;
        z-index: 1000;
        height: 100%;
    }

    .menu-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%) translateY(-50%);
        height: 7vw;
        z-index: 999;
    }

    body {
        direction: ltr;
    }

    h1 {
        font-size: 4.3vw;
        margin: 4vw 0;
    }

    h2 {
        font-size: 1.5rem;
    }

    .logo-left {
        width: 10vw;
        left: 3vw;
    }

    .input-section {
        display: block;
        width: 90%;
        max-width: none;
        padding: 4vw 3vw;
        margin: 0 auto;
    }

    .input-row {
        flex-direction: column;
        width: 100%;
        margin-bottom: 1.5vw;
        gap: 1rem;
        position: relative;
        z-index: 1;
    }

    .input-row:first-of-type {
        z-index: 5000;
    }

    .input-group {
        margin-right: 0;
        margin-left: 0;
        margin-bottom: 1.5vw;
    }

    .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: 1rem;
    }

    input,
    select {
        width: 100%;
        padding: 0.8rem 0.2rem;
    }

    .button-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        text-align: center;
    }

    button {
        font-size: 1rem;
        padding: 0.7rem;
        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: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        margin: 10px 0;
        box-sizing: border-box;
    }

    table {
        width: 100%;
        /* Force minimum width to prevent columns from squishing */
        border-spacing: 0.1rem;
    }

    th,
    td {
        font-size: 0.9rem;
        padding: 0.2rem;
    }

    th {
        font-size: 1rem;
    }

    .watermark {
        width: 70%;
    }

    #save-pdf-btn.visible {
        display: block;
        /* موبائل پر دکھائیں */
        font-size: 0.8rem;
        padding: 2vw 3vw;
    }
}

@media screen and (max-width: 480px) {
    .header-container {
        margin-top: 0vh;
    }

    .menu-container {
        height: 9vh;
    }

    .nav-menu ul {
        top: 9vh;
    }

    .nav-links {
        top: 9vh;
        width: 90%;
    }

    .menu-logo {
        height: 13vw;
    }

    body {
        padding-top: 0;
        padding-left: 0;
    }

    h1 {
        font-size: 4.7vw;
    }

    h2 {
        font-size: 1.2rem;
    }

    .logo-left {
        width: 15vw;
    }

    input,
    select {
        font-size: 0.85rem;

        padding: 0.6rem 0.2rem;
    }

    button {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .qibla-section {
        font-size: 1rem;
        padding: 1rem;
    }

    table {
        width: 100%;
        border-spacing: 0.1rem;
    }

    th,
    td {
        font-size: 0.5rem;
        padding: 0.2rem 0.1rem;
    }

    th {
        font-size: 0.5rem;
    }

    #save-pdf-btn.visible {
        display: block;
        /* چھوٹی سکرینوں پر دکھائیں */
        font-size: 0.8rem;
        padding: 2vw 3vw;
    }

    .input-section {
        width: 95%;
        padding: 3vw 2vw;
    }

    .input-row {
        width: 100%;
        gap: 0.8rem;
    }

    .input-group {
        width: 100%;
    }
}

/* 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: 1rem;
        font-size: 1.1rem;
    }
}

/* Layout overrides: mobile input 2x2 and desktop city/qibla 2-column */
@media screen and (max-width: 768px) {

    #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%;
    }
}

.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: 0.7rem;
    }
}