:root {
    --bg-mainColor: #111015;
    --bg-mainBgColor: #FF9801;
    --bg-SecondColor: #1B1B1D;
    --bg-paragraph: #5A595E;
    --bg-thirdColor: #BBD7EC;
    --bg-footerColor: #AECADF;
    --aqi-1: #37AFE1;
    --aqi-2: #ffee58;
    --aqi-3: #ffca28;
    --aqi-4: #ff7043;
    --aqi-5: #ef5350;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    background-color: var(--bg-mainColor);
    color: #fff;
    padding: 0 15px;
    font-family: "Montserrat", sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "Roboto", sans-serif;
    font-size: 26px;
    font-weight: 400;
}

span,
a,
p {
    font-family: "Montserrat", sans-serif;
    color: var(--bg-paragraph);
    font-size: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

span,
a {
    display: inline-block;
}

a {
    text-decoration: none;
}

.header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 15px 0;
    background-color: var(--bg-mainColor);
    z-index: 1000;
}

.header h2 {
    font-weight: bold;
    font-size: 24px;
    color: var(--bg-mainBgColor);
    padding: 5px;
    background-color: var(--bg-mainColor);
    border-radius: 5px;
}

.header #city_input {
    background-color: var(--bg-SecondColor);
    border: none;
    padding: 12px;
    font-size: 16px;
    border-radius: 25px;
    color: #fff;
}

.header #city_input:focus {
    outline: 1px solid var(--bg-mainBgColor);
}

.header #searchBtn {
    cursor: pointer;
    border: none;
    font-size: 16px;
    padding: 12px;
    border-radius: 25px;
    color: #000;
    /* background-color: var(--bg-mainBgColor); */
    transition: all 0.3s ease;
}


.header #locationBtn {
    cursor: pointer;
    border: none;
    font-size: 16px;
    padding: 12px;
    border-radius: 25px;
    color: #000;
    background-color: var(--bg-mainBgColor);
    transition: all 0.3s ease;
}

.header #searchBtn:hover,
.header #locationBtn:hover {
    background-color: #f09b1c;
    transform: scale(1.05);
}

.header #searchBtn:disabled,
.header #locationBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.card {
    background-color: var(--bg-SecondColor);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.card:nth-child(4) {
    animation-delay: 0.4s;
}

.card:nth-child(5) {
    animation-delay: 0.5s;
}

.card:nth-child(6) {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card p {
    margin: 0 0 7px;
}

.card h2 {
    margin: 5px 0;
    font-weight: 500;
}

.current-weather .details p:nth-child(1) {
    font-size: 14px;
    font-weight: bold;
    color: #FFFFFF;
    border: 1px solid #181C14;
    background-color: #000;
    width: 50px;
    border-radius: 15px;
    display: flex;
    justify-content: center;
}

.current-weather .details h2 {
    font-size: 55px;
    font-weight: bold;
    color: #000;
}

.current-weather .details p:nth-child(3) {
    font-size: 14px;
    font-weight: bold;
    color: #000;
}

.weather-data {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.weather-data .weather-left {
    grid-column: span 1;
}

.weather-data .weather-left .card:nth-of-type(1) {
    background-color: var(--bg-mainBgColor);
    color: #000;
}

.weather-data .weather-left .current-weather {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-data .weather-left .card-footer {
    margin-top: 7px;
    margin-bottom: 12px;
}

.weather-data .weather-left .card-footer p {
    font-size: 14px;
    color: #000;
    font-weight: bold;
}

.weather-data .weather-left .forecast-item {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    place-items: center;
    margin: 10px 0 15px;
}

.weather-data .weather-left .forecast-item .icon-wrapper {
    display: flex;
    align-items: center;
}

.weather-data .weather-left .forecast-item .icon-wrapper span {
    color: #fff;
    margin-left: 4px;
}

.weather-data .weather-right {
    grid-column: span 3;
}

.weather-data .weather-right h2 {
    margin-bottom: 10px;
    font-weight: 500;
}

.weather-data .weather-right .highlights {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 15px;
}

.weather-data .weather-right .highlights .card:nth-of-type(1),
.weather-data .weather-right .highlights .card:nth-of-type(2) {
    grid-column: span 2;
}

.weather-data .weather-right .highlights .card-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.weather-data .weather-right .highlights .card-head .air-index {
    color: #000;
    border-radius: 15px;
    padding: 5px 10px;
    background-color: var(--bg-mainBgColor);
}

.weather-data .weather-right .highlights .air-indices {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    place-items: center;
}

.weather-data .weather-right .highlights .air-indices .fa-wind {
    font-size: 60px;
}

.weather-data .weather-right .highlights .sunrise-sunset {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.weather-data .weather-right .highlights .sunrise-sunset .item {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.weather-data .weather-right .highlights .sunrise-sunset .item h2 {
    margin-top: 15px;
}

.weather-data .weather-right .highlights .card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-data .weather-right .highlights .card-item i {
    font-size: 32px;
}

.weather-data .weather-right .hourly-forecast {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    column-gap: 10px;
}

.weather-data .weather-right .hourly-forecast .card {
    text-align: center;
}

.weather-data .weather-right .hourly-forecast .card p:nth-of-type(2) {
    color: #fff;
}

.prayer-container {
    gap: 5px;
    margin: 20px 0;


    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prayer-container h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bg-mainBgColor);
}

.prayer-container h2 img {
    width: 24px;
}

.dayOfPray {
    margin-bottom: 10px;
    text-align: right;
    direction: rtl;
}

.dayOfPray strong {
    display: inline-block;
    color: #000;
    font-size: 16px;
    background: linear-gradient(135deg, var(--bg-mainBgColor), #f09b1c);
    box-shadow: 0 4px 15px rgba(255, 152, 1, 0.3);
    border: 2px solid transparent;
    background-clip: padding-box;

    font-size: medium;
    border-radius: 15px;
    padding: 5px 10px;

}

.dayOfPray strong:before {
    content: "🕌";
    margin-left: 8px;
    font-size: 18px;
}

.next-prayer-section {
    margin-bottom: 20px;
}

.next-prayer-card {
    background-color: var(--bg-mainBgColor);
    padding: 5px 30px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.next-prayer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 152, 1, 0.2);
}

.next-prayer-card .prayer-name {
    font-size: 18px;
    font-weight: bold;
    color: #000;
}

.next-prayer-card .prayer-icon img {
    width: 45px;
}

.next-prayer-card .prayer-time {
    font-size: 16px;
    background-color: var(--bg-SecondColor);
    padding: 8px 12px;
    border-radius: 20px;
    color: #fff;
}

.next-prayer-card .prayer-time #nextPrayerTime {
    font-weight: bold;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

.prayer-countdown {
    background-color: var(--bg-SecondColor);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
    direction: rtl;
}

.prayer-countdown .countdown-timer {
    font-size: 24px;
    font-weight: bold;
    color: var(--bg-mainBgColor);
    margin: 10px 0px;
}

.prayer-countdown .next-prayer-name,
.prayer-countdown .next-prayer-time {
    font-size: 16px;
    color: #fff;
}

.timing-prayer {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 40px;
}

.prayer-card {
    background-color: var(--bg-SecondColor);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 140px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    direction: rtl;
}

.prayer-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 152, 1, 0.1), transparent);
    transition: transform 0.6s ease;
    transform: rotate(45deg) translate(-100%, -100%);
}

.prayer-card:hover::before {
    transform: rotate(45deg) translate(100%, 100%);
}

.prayer-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(255, 152, 1, 0.3);
    border-color: var(--bg-mainBgColor);
}

.prayer-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--bg-mainBgColor);
    margin-bottom: 10px;
    white-space: nowrap;
}

.prayer-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.prayer-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: brightness(1.2);
}

.prayer-time {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background-color: var(--bg-mainColor);
    padding: 8px 12px;
    border-radius: 20px;
    margin-top: 8px;
    white-space: nowrap;
    border: 1px solid var(--bg-mainBgColor);
}

.qibla-section {
    background-color: var(--bg-SecondColor);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 15px;
    direction: rtl;
}

.qibla-section h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--bg-mainBgColor);
}

.qibla-compass {
    width: 170px;
    height: 170px;
    border: 2px solid var(--bg-mainBgColor);
    border-radius: 50%;
    position: relative;
    margin: 15px auto;
    background: radial-gradient(circle, var(--bg-SecondColor), var(--bg-mainColor));
}

.compass-directions {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: normal;
    color: var(--bg-mainBgColor);
}



.qibla-compass {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 20px auto;
    border: 3px solid #444;
    border-radius: 50%;
    background: #f9f9f9;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

.compass-directions {
    position: absolute;
    font-weight: bold;
    font-size: 16px;
    color: #333;
}










.compass-needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 50px;
    background: linear-gradient(to top, #e74c3c, var(--bg-mainBgColor));
    transform-origin: bottom center;
    transform: translate(-50%, -100%);
    transition: transform 0.5s ease;
}

.qibla-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 50px;
    background: #2ECC71;
    transform-origin: bottom center;
    transform: translate(-50%, -100%);
    border: 1px solid #fff;
    transition: transform 0.5s ease;
}

.compass-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--bg-mainBgColor);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.qibla-degree {
    font-size: 16px;
    font-weight: bold;
    color: var(--bg-mainBgColor);
}

.qibla-info p {
    font-size: 12px;
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    background: linear-gradient(135deg, #ff4757, #ff3838);
    padding: 20px;
    border-radius: 15px;
    color: #fff;
    border: 2px solid #ff6b7a;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.retry-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.prayer-skeleton {
    background: linear-gradient(90deg, #1B1B1D 25%, #2A2A2D 50%, #1B1B1D 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 15px;
    height: 120px;
    margin-bottom: 15px;
}

@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@media (max-width: 1140px) {
    .weather-data {
        grid-template-columns: repeat(3, 1fr);
    }

    .weather-data .weather-right {
        grid-column: span 2;
    }

    .weather-data .weather-right .highlights {
        grid-template-columns: repeat(3, 1fr);
    }

    .weather-data .weather-right .highlights .card:nth-of-type(1) {
        grid-column: span 3;
    }

    .weather-data .weather-right .hourly-forecast {
        grid-template-columns: repeat(6, 1fr);
    }

    .timing-prayer {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1040px) {
    .weather-data {
        grid-template-columns: repeat(2, 1fr);
    }

    .weather-data .weather-right {
        grid-column: span 1;
    }

    .weather-data .weather-right .highlights {
        grid-template-columns: repeat(2, 1fr);
    }

    .weather-data .weather-right .highlights .card:nth-of-type(1) {
        grid-column: span 2;
    }

    .weather-data .weather-right .hourly-forecast {
        grid-template-columns: repeat(4, 1fr);
    }

    .timing-prayer {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .weather-data .weather-right .highlights .card {
        grid-column: span 2;
    }

    .weather-data .weather-right .highlights .air-indices {
        grid-template-columns: repeat(3, 1fr);
    }

    .timing-prayer {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

@media (max-width: 850px) {
    .weather-data {
        grid-template-columns: 1fr;
    }

    .weather-data .weather-right .highlights .card:nth-of-type(3),
    .weather-data .weather-right .highlights .card:nth-of-type(4),
    .weather-data .weather-right .highlights .card:nth-of-type(5),
    .weather-data .weather-right .highlights .card:nth-of-type(6),
    .weather-data .weather-right .highlights .card:nth-of-type(7) {
        grid-column: span 1;
    }

    .weather-data .weather-right .highlights .air-indices {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 730px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }

    .header h2 {
        margin-bottom: 10px;
        position: relative;
        right: 30%;
    }

    .header #city_input {
        width: 100%;
        margin-bottom: 14px;
    }

    .header #searchBtn,
    .header #locationBtn {
        width: 100%;
        margin-bottom: 10px;
    }

    .timing-prayer {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .prayer-card {
        min-height: 100px;
        padding: 10px;
    }

    .prayer-icon img {
        width: 32px;
        height: 32px;
    }

    .prayer-name {
        font-size: 13px;
    }

    .prayer-time {
        font-size: 11px;
        padding: 5px 8px;
    }

    .next-prayer-card {
        padding: 10px;
        min-height: 50px;
    }

    .next-prayer-card .prayer-name {
        font-size: 15px;
    }

    .next-prayer-card .prayer-icon img {
        width: 30px;
        height: 30px;
    }

    .next-prayer-card .prayer-time {
        font-size: 12px;
        padding: 6px 10px;
    }

    .next-prayer-card .prayer-time #nextPrayerTime {
        font-size: 14px;
    }

    .qibla-compass {
        width: 160px;
        height: 160px;
    }

    .compass-needle,
    .qibla-arrow {
        height: 40px;
    }

    .compass-center {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 660px) {
    .weather-data .weather-right .hourly-forecast {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 580px) {
    .weather-data .weather-right .highlights .air-indices {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 520px) {

    .weather-data .weather-right .highlights .card:nth-of-type(3),
    .weather-data .weather-right .highlights .card:nth-of-type(4),
    .weather-data .weather-right .highlights .card:nth-of-type(5),
    .weather-data .weather-right .highlights .card:nth-of-type(6),
    .weather-data .weather-right .highlights .card:nth-of-type(7) {
        grid-column: span 2;
    }

    .weather-data .weather-right .highlights .air-indices {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 490px) {
    .weather-data .weather-right .highlights .sunrise-sunset {
        grid-template-columns: 1fr;
    }

    .weather-data .weather-right .hourly-forecast {
        grid-template-columns: repeat(2, 1fr);
    }

    .timing-prayer {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .prayer-card {
        min-height: 80px;
        padding: 8px;
    }

    .prayer-name {
        font-size: 12px;
    }

    .prayer-icon img {
        width: 28px;
        height: 28px;
    }

    .prayer-time {
        font-size: 10px;
        padding: 4px 6px;
    }

    .next-prayer-card {
        padding: 8px;
        min-height: 45px;
    }

    .next-prayer-card .prayer-name {
        font-size: 13px;
    }

    .next-prayer-card .prayer-icon img {
        width: 18px;
        height: 18px;
    }

    .next-prayer-card .prayer-time {
        font-size: 11px;
        padding: 5px 8px;
    }

    .next-prayer-card .prayer-time #nextPrayerTime {
        font-size: 13px;
    }

    .qibla-compass {
        width: 140px;
        height: 140px;
    }

    .compass-needle,
    .qibla-arrow {
        height: 35px;
    }

    .compass-center {
        width: 7px;
        height: 7px;
    }
}

@media (max-width: 400px) {
    .timing-prayer {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .prayer-card {
        min-height: 70px;
        padding: 6px 10px;
    }

    .prayer-name {
        font-size: 14px;
    }

    .prayer-icon img {
        width: 24px;
        height: 24px;
    }

    .prayer-time {
        font-size: 12px;
        padding: 5px 8px;
    }

    .next-prayer-card {
        padding: 6px;
        min-height: 40px;
    }

    .next-prayer-card .prayer-name {
        font-size: 13px;
    }

    .next-prayer-card .prayer-icon img {
        width: 16px;
        height: 16px;
    }

    .next-prayer-card .prayer-time {
        font-size: 13px;
        padding: 3px 6px;
    }

    .next-prayer-card .prayer-time #nextPrayerTime {
        font-size: 13px;
    }

    .qibla-compass {
        width: 140px;
        height: 140px;
    }

    .compass-needle,
    .qibla-arrow {
        height: 30px;
    }

    .compass-center {
        width: 6px;
        height: 6px;
    }

    .qibla-degree {
        font-size: 12px;
    }

    .qibla-info p {
        font-size: 9px;
    }

    .dayOfPray strong {
        font-size: 13px;
    }

    .dayOfPray strong:before {
        font-size: 12px;
    }


}

@media (max-width: 360px) {
    body {
        padding: 0 10px;
    }

    .prayer-card {
        min-height: 65px;
        padding: 5px 8px;
    }

    .prayer-name {
        font-size: 10px;
    }

    .prayer-icon img {
        width: 20px;
        height: 20px;
    }

    .prayer-time {
        font-size: 8px;
        padding: 3px 5px;
    }

    .next-prayer-card {
        padding: 5px;
        min-height: 35px;
    }

    .next-prayer-card .prayer-name {
        font-size: 10px;
    }

    .next-prayer-card .prayer-icon img {
        width: 14px;
        height: 14px;
    }

    .next-prayer-card .prayer-time {
        font-size: 8px;
        padding: 2px 5px;
    }

    .next-prayer-card .prayer-time #nextPrayerTime {
        font-size: 10px;
    }

    .qibla-compass {
        width: 140px;
        height: 140px;
    }

    .compass-needle,
    .qibla-arrow {
        height: 25px;
    }

    .compass-center {
        width: 5px;
        height: 5px;
    }

    .qibla-degree {
        font-size: 10px;
    }

    .qibla-info p {
        font-size: 8px;
    }
}

@media (max-width: 380px) {
    .weather-data .weather-right .highlights .air-indices {
        grid-template-columns: repeat(2, 1fr);
    }
}




/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-mainBgColor);
    color: #fff;
    border: none;
    display: none;
    /* مخفي في البداية */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 1100;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#back-to-top:active {
    background: var(--aqi-4);
    opacity: 1;
    transform: scale(1.1);
}

#back-to-top.show {
    display: block;
}