/* Define FM-Arjunn font */
@font-face {
    font-family: 'FM-Arjunn';
    src: url('fonts/FM-Arjunn.woff2') format('woff2'),
         url('fonts/FM-Arjunn.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Define FM-Derana font */
@font-face {
    font-family: 'FM-Derana';
    src: url('fonts/FM-Derana.woff2') format('woff2'),
         url('fonts/FM-Derana.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans Sinhala', Arial, sans-serif;
}

body {
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.banner {
    background: #007bff;
    text-align: center;
    padding: 0;
    aspect-ratio: 851 / 315;
    max-width: 480px;
    width: 100%;
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #007bff;
}

header {
    background: #012d70;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

header h1 {
    font-family: 'FM-Arjunn', 'Noto Sans Sinhala', sans-serif;
    font-size: 1.3em;
}

.clock {
    font-size: 1.1em;
    font-weight: bold;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.clock.countdown {
    font-size: 1.3em;
    /*font-family: 'FM-Derana', 'Noto Sans Sinhala', sans-serif;*/  
    background: #e74c3c;
    padding: 8px 14px;
    border-radius: 8px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.refresh-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.6em;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s ease;
}

.refresh-btn:hover {
    color: #007bff;
}

main {
    flex: 1;
    padding: 20px;
}

.times-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.time-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.time-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
}

.time-item.past {
    background: #f8f9fa;
    opacity: 0.8;
    order: 1;
}

.time-item h3 {
    font-family: 'FM-Arjunn', 'Noto Sans Sinhala', sans-serif;
    color: #012d70;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.time-item.past h3 {
    color: #6c757d;
}

.time-item p {
    color: #555;
    font-size: 0.95em;
    font-family: 'Noto Sans Sinhala', Arial, sans-serif;
}

.time-item img {
    width: 100%;
    max-width: 220px;
    height: auto;
    border-radius: 8px;
    margin-top: 12px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close:hover {
    color: #007bff;
}

.modal-content h2 {
    font-family: 'FM-Arjunn', 'Noto Sans Sinhala', sans-serif;
    color: #012d70;
    margin-bottom: 12px;
    font-size: 1.4em;
}

.modal-content p {
    margin-bottom: 12px;
    font-size: 1em;
    font-family: 'Noto Sans Sinhala', Arial, sans-serif;
    white-space: pre-wrap;
}

.modal-content p.description {
    font-family: 'FM-Derana', 'Noto Sans Sinhala', sans-serif;
    white-space: pre-wrap;
}

.modal-compass {
    text-align: center;
    margin-top: 20px;
}

.modal-compass h3 {
    font-family: 'FM-Arjunn', 'Noto Sans Sinhala', sans-serif; /* Apply FM-Arjunn */
    color: #012d70;
    margin-bottom: 12px;
    font-size: 1.1em;
}

#compassCanvas {
    margin: 0 auto;
    display: block;
}

#compassStatus {
    font-size: 0.9em;
    color: #666;
    margin-top: 8px;
}

.error {
    color: #fff;
    background: #e74c3c;
    padding: 12px;
    margin: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1em;
}

.hidden {
    display: none;
}

.ad-contact-section {
    padding: 20px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.ad-img {
    width: 100%;
    max-width: 480px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 15px;
    display: block;
    background: #f8f9fa;
}

.contact-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 1em;
    transition: background 0.3s ease;
}

.contact-btn:hover {
    background: #012d70;
}

footer {
    background: #012d70;
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 0.9em;
}

/* Admin styles */
#timeForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

#timeForm input,
#timeForm textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

#timeForm button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
}

#timeForm button:hover {
    background: #012d70;
}

#adminList .time-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#adminList button {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.3s ease;
}

#adminList button:hover {
    background: #012d70;
}

#adminList button:nth-child(2) {
    background: #e74c3c;
}

#adminList button:nth-child(2):hover {
    background: #c0392b;
}