/* Main body styling */
body {
    background-color: #000000;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.container-fluid {
    min-height: 100vh;
    padding: 20px;
}

/* Clock Container */
.clock-container {
    background: transparent;
    margin-bottom: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    min-height: 200px;
    flex-wrap: wrap;
}

.time-period {
    font-size: 2rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    align-self: flex-end;
    padding-bottom: 0.5rem;
}

/* ======================== */
/* Flip Clock               */
/* ======================== */
.flip-clock {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flip-digit-group {
    display: flex;
    gap: 0.4rem;
}

.flip-separator {
    font-size: 7rem;
    font-weight: 300;
    color: #ffffff;
    line-height: 1;
    padding-bottom: 0.8rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    user-select: none;
}

.flip-digit {
    position: relative;
    width: 7rem;
    height: 11rem;
    border-radius: 10px;
    perspective: 300px;
}

/* Hinge line in the middle */
.flip-digit::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: calc(50% - 1px);
    height: 2px;
    background: #000;
    z-index: 10;
    pointer-events: none;
}

/* Shared panel base */
.flip-digit .upper,
.flip-digit .lower,
.flip-digit .flip-top,
.flip-digit .flip-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    overflow: hidden;
}

.flip-digit .upper {
    top: 0;
    background: #272727;
    border-radius: 10px 10px 0 0;
    z-index: 1;
}

.flip-digit .lower {
    bottom: 0;
    background: #1c1c1c;
    border-radius: 0 0 10px 10px;
    z-index: 1;
}

/* Digit numeral */
.flip-digit span {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    font-size: 9rem;
    line-height: 11rem;
    text-align: center;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    font-weight: 300;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
    user-select: none;
}

.flip-digit .upper span { top: 0; }
.flip-digit .lower span { bottom: 0; }

/* Animated flip panels */
.flip-digit .flip-top {
    top: 0;
    background: #272727;
    border-radius: 10px 10px 0 0;
    z-index: 2;
    transform-origin: bottom center;
    transform: rotateX(0deg);
}

.flip-digit .flip-top span { top: 0; }

.flip-digit .flip-bottom {
    bottom: 0;
    background: #1c1c1c;
    border-radius: 0 0 10px 10px;
    z-index: 2;
    transform-origin: top center;
    transform: rotateX(90deg); /* hidden at rest */
}

.flip-digit .flip-bottom span { bottom: 0; }

/* Keyframe animations */
@keyframes flipTopDown {
    from { transform: rotateX(0deg); }
    to   { transform: rotateX(-90deg); }
}

@keyframes flipBottomUp {
    from { transform: rotateX(90deg); }
    to   { transform: rotateX(0deg); }
}

.flip-digit .flip-top.flipping {
    animation: flipTopDown 0.25s ease-in forwards;
}

.flip-digit .flip-bottom.flipping {
    animation: flipBottomUp 0.25s ease-out forwards;
}

/* Countdown Timer Styling */
.countdown-container {
    background: transparent;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.countdown-label {
    font-size: 1.2rem;
    color: #ffffff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.next-prayer-name {
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.countdown-timer {
    font-size: 3rem;
    font-weight: 400;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

/* Prayer Times Container */
.prayer-times-container {
    margin-top: 30px;
}

.prayer-card {
    background: transparent;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.prayer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.prayer-card.current-prayer {
    border-color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}

.prayer-card.current-prayer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00ff00, transparent);
}

.prayer-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prayer-time {
    font-size: 1.4rem;
    font-weight: 500;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    white-space: nowrap;
}

.prayer-card.current-prayer .prayer-time {
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

/* Search format hint */
.search-format-hint {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.78rem;
}

/* Error Message */
.error-message {
    font-size: 0.82rem;
    color: #f0a500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.error-message svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #f0a500;
}

/* Responsive Design */
@media (max-width: 992px) {
    .flip-digit {
        width: 5.5rem;
        height: 8.5rem;
    }
    .flip-digit span {
        font-size: 7rem;
        line-height: 8.5rem;
    }
    .flip-separator {
        font-size: 5rem;
        padding-bottom: 0.5rem;
    }
    .flip-clock { gap: 0.7rem; }
    .flip-digit-group { gap: 0.3rem; }
}

@media (max-width: 768px) {
    .flip-digit {
        width: 4rem;
        height: 6rem;
    }
    .flip-digit span {
        font-size: 5rem;
        line-height: 6rem;
    }
    .flip-separator {
        font-size: 3.5rem;
        padding-bottom: 0.35rem;
    }
    .flip-clock { gap: 0.5rem; }
    .flip-digit-group { gap: 0.2rem; }

    .time-period {
        font-size: 1.5rem;
    }
    
    .countdown-timer {
        font-size: 2rem;
    }
    
    .next-prayer-name {
        font-size: 1.5rem;
    }
    
    .prayer-card {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    .prayer-name {
        font-size: 1rem;
    }
    
    .prayer-time {
        font-size: 1.2rem;
    }
    
    /* Mobile ad styling */
    .ad-placeholder {
        max-width: 320px;
        min-height: 50px;
    }
}

@media (max-width: 576px) {
    .flip-digit {
        width: 2.8rem;
        height: 4.2rem;
    }
    .flip-digit span {
        font-size: 3.5rem;
        line-height: 4.2rem;
    }
    .flip-separator {
        font-size: 2.5rem;
        padding-bottom: 0.25rem;
    }
    .flip-clock { gap: 0.3rem; }
    .flip-digit-group { gap: 0.15rem; }

    .time-period {
        font-size: 1.2rem;
    }
    
    .countdown-timer {
        font-size: 1.5rem;
    }
    
    .clock-container {
        gap: 0.5rem;
    }
    
    /* Smaller mobile ad */
    .ad-placeholder {
        max-width: 300px;
        min-height: 50px;
    }
}

/* Header Styling */
.display-4 {
    font-weight: 300;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

#location-info {
    font-size: 1.1rem;
    color: #cccccc;
}

#date-info {
    color: #888888;
    font-size: 0.9rem;
}

/* Spinner customization */
.spinner-border.text-success {
    color: #00ff00 !important;
}

/* Button styling */
.btn-outline-danger {
    border-color: #ffffff;
    color: #ffffff;
}

.btn-outline-danger:hover {
    background-color: #ffffff;
    color: #dc3545;
}

/* Ad Container Styling */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin: 10px 0;
    flex: 1 1 auto;
    width: 100%;
    min-width: 300px;
    min-height: 90px;
}

.top-ad {
    margin-bottom: 20px;
}

.bottom-ad {
    margin-top: 20px;
}

.ad-placeholder {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #cccccc;
    font-size: 0.9rem;
    text-align: center;
}

.ad-placeholder::before {
    content: "Advertisement";
    font-size: 0.8rem;
    color: #999999;
}

/* Fullscreen button */
#fullscreen-btn {
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    transition: all 0.3s ease;
}

#fullscreen-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

/* Fullscreen mode styling */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

.fullscreen-mode #fullscreen-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.fullscreen-mode #fullscreen-btn:hover {
    opacity: 1;
}

.fullscreen-mode .container-fluid {
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    max-width: 100%;
    padding: 10px 20px 20px;
    gap: 0;
}

.fullscreen-mode .time-period {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

/* Clock section fills remaining space and centers the clock */
.fullscreen-mode #clock-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Fullscreen flip clock — bigger digits */
.fullscreen-mode .flip-digit {
    width: 13rem;
    height: 22rem;
}

.fullscreen-mode .flip-digit span {
    font-size: 18.5rem;
    line-height: 22rem;
}

.fullscreen-mode .flip-separator {
    font-size: 14rem;
    padding-bottom: 1.4rem;
}

.fullscreen-mode .flip-clock {
    gap: 1.4rem;
}

.fullscreen-mode .flip-digit-group {
    gap: 0.6rem;
}

.fullscreen-mode .time-period {
    font-size: 2.5rem;
}

/* Fullscreen next prayer — smaller */
.fullscreen-mode .countdown-container {
    margin-bottom: 10px;
    max-width: 400px;
    padding: 15px 20px;
}

.fullscreen-mode .countdown-timer {
    font-size: 2rem;
}

.fullscreen-mode .next-prayer-name {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.fullscreen-mode .countdown-label {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

/* Remove Bootstrap mt-4/mt-5 top margins in fullscreen */
.fullscreen-mode .row.mt-4,
.fullscreen-mode .row.mt-5 {
    margin-top: 0 !important;
}

.fullscreen-mode .prayer-times-container {
    max-width: 100%;
    margin-top: 0;
}

.fullscreen-mode .prayer-card {
    padding: 8px 6px;
    margin: 0 2px;
    min-width: 80px;
    flex: 1;
    max-width: 120px;
}

.fullscreen-mode .prayer-name {
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.fullscreen-mode .prayer-time {
    font-size: 1rem;
}

.fullscreen-mode .row {
    margin: 0;
}

.fullscreen-mode .col-12 {
    padding: 0;
}

/* Hide header in fullscreen */
.fullscreen-mode .row:first-child {
    display: none;
}

/* Hide ads in fullscreen */
.fullscreen-mode .ad-container {
    display: none !important;
}

/* Location search styling */
.location-search {
    margin: 20px 0;
}

.location-search .form-control {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 8px 0 0 8px;
}

.location-search .form-control:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.location-search .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.location-search .form-select {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 8px;
}

.location-search .form-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.location-search .form-select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

.location-search .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.location-search .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Hide location search in fullscreen */
.fullscreen-mode .location-search {
    display: none !important;
}

.fullscreen-mode .container-seo {
    display: none !important;
}

/* Ensure prayer times are visible in fullscreen */
.fullscreen-mode .prayer-times-container {
    display: block !important;
    width: 100%;
}

.fullscreen-mode #prayer-times-row {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* Responsive fullscreen */
@media (max-width: 768px) {
    .fullscreen-mode .digital-clock {
        font-size: 5rem;
    }
    
    .fullscreen-mode .time-period {
        font-size: 1.5rem;
    }
    
    .fullscreen-mode .countdown-timer {
        font-size: 2.5rem;
    }
    
    .fullscreen-mode .next-prayer-name {
        font-size: 1.5rem;
    }
    
    .fullscreen-mode .prayer-time {
        font-size: 1rem;
    }
    
    .fullscreen-mode .prayer-name {
        font-size: 0.8rem;
    }
    
    .fullscreen-mode .prayer-card {
        min-width: 70px;
        max-width: 100px;
        padding: 6px 4px;
    }
}

@media (max-width: 576px) {
    .fullscreen-mode .digital-clock {
        font-size: 4rem;
    }
    
    .fullscreen-mode .time-period {
        font-size: 1.2rem;
    }
    
    .fullscreen-mode .countdown-timer {
        font-size: 2rem;
    }
    
    .fullscreen-mode .next-prayer-name {
        font-size: 1.2rem;
    }
    
    .fullscreen-mode .prayer-time {
        font-size: 0.9rem;
    }
    
    .fullscreen-mode .prayer-name {
        font-size: 0.7rem;
    }
    
    .fullscreen-mode .prayer-card {
        min-width: 60px;
        max-width: 80px;
        padding: 4px 2px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666666;
}
