@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&display=swap');

#panjika-app-container {
    font-family: 'Baloo 2', sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    background: #fdfdfd;
    border: 1px solid #ddd;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Header & Nav (Same as before) */
.k-header-bar { background-color: #8b0000; color: white; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 4px solid #b71c1c; flex-wrap: wrap; }
.k-logo { display: flex; align-items: center; gap: 10px; }
.om-symbol { font-size: 2.2rem; background: white; color: #8b0000; width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; border-radius: 4px; font-weight: bold; }
.logo-text h1 { margin: 0; font-size: 1.6rem; line-height: 1; color: #fff; font-weight: 800; }
.logo-text small { color: #ffc107; font-size: 0.75rem; letter-spacing: 0.5px; font-weight: bold; }

.k-month-nav { background: #5a0000; padding: 5px 15px; border-radius: 50px; display: flex; align-items: center; gap: 15px; border: 1px solid #ffc107; }
.nav-arrow { background: none; border: none; color: #ffc107; font-size: 1.5rem; cursor: pointer; font-weight: bold; }
#month-display { color: white; font-weight: 700; font-size: 1.1rem; min-width: 130px; text-align: center; }
.k-sambat-info { text-align: right; font-size: 0.9rem; color: #ffc107; font-weight: 600; }

/* Highlight Bar */
.k-highlight-bar { background: white; padding: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #ddd; margin: 10px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex-wrap: wrap; gap: 15px; }
.highlight-date-box { background: #8b0000; color: #ffc107; padding: 10px 15px; border-radius: 8px; text-align: center; min-width: 110px; }
.h-day { display: block; font-size: 2.2rem; font-weight: 800; line-height: 1; }
.h-month { display: block; font-size: 1rem; margin-bottom: 5px; }
.today-badge { background: #ffc107; color: #8b0000; font-size: 0.7rem; padding: 2px 5px; border-radius: 4px; font-weight: bold; display: inline-block; }

.highlight-info { display: flex; gap: 15px; text-align: center; flex-grow: 1; justify-content: center; }
.h-item { padding: 8px 12px; border-radius: 8px; min-width: 90px; border: 1px solid rgba(0,0,0,0.1); }
.h-bg-red { background-color: #ffebee; }
.h-bg-yellow { background-color: #fffde7; }
.h-bg-orange { background-color: #fff3e0; }
.h-bg-blue { background-color: #e3f2fd; }
.h-item small { color: #555; display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.h-item strong { color: #000; font-size: 1rem; display: block; margin-top: 3px; }
#view-more-today { background: #eebb00; color: #000; border: none; padding: 10px 20px; font-weight: bold; border-radius: 4px; cursor: pointer; }

/* Calendar Grid */
.k-calendar-frame { border: 3px solid #8b0000; margin: 10px; border-radius: 8px 8px 0 0; overflow: hidden; }
.k-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: #600000; color: white; text-align: center; font-weight: bold; padding: 8px 0; font-size: 1rem; }
.k-weekdays .sunday { color: #ffc107; }
.k-grid { display: grid; grid-template-columns: repeat(7, 1fr); background: #ccc; gap: 1px; }

/* Day Cell - Desktop */
.k-day-cell { background: white; min-height: 130px; padding: 5px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; transition: 0.2s; overflow: hidden; }
.k-day-cell:hover { background: #fffde7; }
.k-day-cell.empty { background: #f4f4f4; cursor: default; }
.k-day-cell.is-today { border: 2px solid #8b0000; background: #fff0f0; }

.cell-top { display: flex; justify-content: space-between; align-items: start; }
.num-date { font-size: 2.2rem; font-weight: 800; color: #333; line-height: 1; letter-spacing: -1px; }
.cell-sunday .num-date { color: #d32f2f; }
.cell-tithi { font-size: 0.8rem; color: #555; text-align: right; line-height: 1.1; font-weight: 600; }

.cell-mid { font-size: 0.7rem; color: #666; margin-top: 4px; }
.cell-rashi { color: #000; font-weight: 600; display: block; }
.cell-sun-times { display: flex; justify-content: space-between; font-size: 0.65rem; color: #d84315; margin-top: 2px; }

/* Pill & Spacer */
.festival-pill { background: #d32f2f; color: white; font-size: 0.65rem; padding: 2px; border-radius: 3px; text-align: center; margin-top: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.festival-spacer { min-height: 15px; margin-top: auto; } /* Maintains alignment when empty */

/* Holiday List (Same as before) */
.k-holiday-section { margin: 20px 10px; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #fff; }
.k-holiday-header { background: #8b0000; color: #fff; padding: 10px 15px; text-align: center; border-bottom: 3px solid #eebb00; }
.k-holiday-header h3 { margin: 0; font-size: 1.3rem; color: white; }
.k-holiday-list { padding: 10px; }
.k-holiday-item { display: flex; align-items: center; padding: 10px; border-bottom: 1px dotted #ccc; justify-content: space-between; }
.k-h-left { display: flex; align-items: center; }
.k-h-type-badge { font-size: 0.75rem; padding: 3px 8px; border-radius: 20px; font-weight: bold; color: white; margin-left: 10px; }
.type-parva { background: #d32f2f; } .type-jayanti { background: #ef6c00; } .type-divasa { background: #1976d2; } .type-palana { background: #388e3c; }
.k-holiday-footer { background: #f0f0f0; color: #666; font-size: 0.75rem; padding: 8px; text-align: center; font-style: italic; }

/* Holiday Date Badges (Updated) */
.k-h-date-badge { background: #8b0000; color: white; padding: 2px 12px; border-radius: 6px; margin-right: 15px; min-width: 100px; text-align: center; display: inline-flex; align-items: baseline; justify-content: center; gap: 8px; }
.badge-big { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.badge-small { font-size: 0.9rem; font-weight: 500; opacity: 0.9; }

/* Modal (Same as before) */
.k-modal.hidden { display: none; }
.k-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; display: flex; justify-content: center; align-items: center; }
.k-modal-overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.k-modal-content { background: #fff; width: 95%; max-width: 650px; border-radius: 8px; overflow: hidden; position: relative; box-shadow: 0 15px 40px rgba(0,0,0,0.5); border: 4px solid #8b0000; max-height: 90vh; overflow-y: auto; }
.k-modal-header { background: #b71c1c; color: white; padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; }
.k-modal-header h3 { margin: 0; font-size: 1.3rem; color: white; font-family: Arial, sans-serif; font-weight: normal; font-style: normal; }
.close-modal { font-size: 2rem; cursor: pointer; color: white; line-height: 0.5; }
.k-modal-body { padding: 15px; font-family: 'Baloo 2', sans-serif; }
.k-modal-grid-layout { display: flex; border: 1px solid #eee; margin-bottom: 15px; }
.k-col-left, .k-col-right { flex: 1; padding: 10px; }
.k-col-left { border-right: 1px solid #eee; }
.k-info-block { margin-bottom: 12px; }
.k-info-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.k-divider { height: 1px; background: #eee; margin: 10px 0; }
.lbl-red { color: #d32f2f; font-weight: bold; font-size: 0.9rem; display: block; margin-bottom: 2px; }
.lbl-red-header { color: #d32f2f; font-weight: 800; font-size: 1rem; border-bottom: 1px solid #eee; padding-bottom: 5px; margin: 10px 0 5px 0; }
.val-black { color: #000; font-weight: 700; font-size: 1rem; line-height: 1.3; }
.val-blue { color: #0277bd; font-weight: 700; }
.val-green-box { background: #e8f5e9; color: #2e7d32; padding: 5px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; margin-top: 2px; }
.festival-tags-container { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.modal-tag { background: #d32f2f; color: white; padding: 3px 8px; font-size: 0.8rem; border-radius: 3px; font-weight: bold; }
.modal-tag.tag-orange { background: #ef6c00; }
.k-desc-text { font-size: 0.9rem; color: #444; margin: 0; line-height: 1.4; }
.remarks-section { background: #fff8e1; padding: 10px; border-radius: 4px; border: 1px dashed #ffc107; margin-top: 10px; }
.wa-share-block { display: block; background-color: #25D366; color: white; text-align: center; padding: 12px; border-radius: 5px; text-decoration: none; font-weight: bold; margin-top: 15px; transition: background 0.3s; }
.wa-share-block:hover { background-color: #128C7E; color: white; }
.wa-icon { font-size: 1.2rem; margin-right: 8px; }
.k-modal-footer { background: #8b0000; color: #fff; text-align: center; padding: 8px; font-size: 0.8rem; margin-top: 0; }

/* --- MOBILE RESPONSIVENESS (UPDATED) --- */
@media (max-width: 768px) {
    .k-header-bar { justify-content: center; text-align: center; gap: 10px; }
    .k-month-nav { order: 2; width: 100%; justify-content: space-between; }
    .k-sambat-info { display: none; }
    .k-highlight-bar { justify-content: center; }
    .highlight-info { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
    .h-item { min-width: auto; }

    /* Calendar Grid Mobile */
    .k-grid { grid-template-columns: repeat(7, 1fr) !important; }
    .k-weekdays { font-size: 0.7rem; }
    
    .k-day-cell { 
        min-height: 90px; /* Slightly taller to fit content */
        padding: 2px; 
        /* Strict Alignment */
        display: flex;
        flex-direction: column;
        justify-content: space-between; 
    }
    
    .num-date { font-size: 1.2rem; margin-bottom: 1px; }
    
    /* Full Tithi String - Text Wrapping */
    .cell-tithi { 
        display: block !important; 
        font-size: 0.5rem; 
        line-height: 1.1;
        white-space: normal; /* Allow Wrapping */
        word-wrap: break-word; /* Prevent overflow */
        text-align: right;
        min-height: 25px; /* Reserve height for text */
    }
    
    .cell-mid { 
        display: block !important; 
        font-size: 0.55rem; 
        margin-top: 1px;
    }
    
    .cell-sun-times { 
        display: flex !important; 
        flex-direction: column; 
        font-size: 0.45rem; 
        line-height: 1;
        margin-bottom: 2px;
    }
    
    /* Spacer Logic */
    .festival-pill { font-size: 0.45rem; height: auto; line-height: 1.2; padding: 1px; white-space: normal; min-height: 12px; }
    .festival-spacer { min-height: 12px; } /* Ensures alignment if pill is missing */

    .k-modal-grid-layout { flex-direction: column; }
    .k-col-left { border-right: none; border-bottom: 1px solid #eee; }
}