/* Calendar Container */
.calendar-container {
    width: 100%;
}

/* User BaZi header */
.user-bazi-header {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 2px 0 6px 0;
}
.user-bazi-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.1;
    white-space: nowrap;
}
.user-bazi-pillars {
    display: inline-flex;
    align-items: flex-end;
    gap: 10px;
    white-space: nowrap;
}
.user-bazi-pillar {
    display: inline-block;
    text-align: center;
    line-height: 1;
}
.user-bazi-pillar .god { font-size: 1rem; }
.user-bazi-pillar .earth { font-size: 1rem; }
.user-bazi-day .god { font-weight: 700; }

@media (max-width: 992px) {
    .user-bazi-title { font-size: 0.9rem; }
    .user-bazi-pillars { gap: 8px; }
    .user-bazi-pillar .god, .user-bazi-pillar .earth { font-size: 0.95rem; }
}
@media (max-width: 768px) {
    .user-bazi-title { font-size: 0.85rem; }
    .user-bazi-pillars { gap: 6px; }
    .user-bazi-pillar .god, .user-bazi-pillar .earth { font-size: 0.9rem; }
}
@media (max-width: 480px) {
    .user-bazi-title { font-size: 0.8rem; }
    .user-bazi-pillars { gap: 5px; }
    .user-bazi-pillar .god, .user-bazi-pillar .earth { font-size: 0.85rem; }
}

/* Five Elements Colors - Regular */
.cycle_wood {
    background-color: #d5ffd5 !important;
}

.cycle_fire {
    background-color: #ffe6ea !important;
}

.cycle_earth {
    background-color: #fff5e8 !important;
}

.cycle_metal {
    background-color: #d8d8e6 !important;
}

.cycle_water {
    background-color: #d4e6ec !important;
}

/* Five Elements Colors - Cycle Start (Darker) */
.cycle_wood_start {
    background-color: #2E8B57 !important;
    color: white !important;
}

.cycle_fire_start {
    background-color: #e37c7c !important;
    color: white !important;
}

.cycle_earth_start {
    background-color: #ce8652 !important;
    color: white !important;
}

.cycle_metal_start {
    background-color: #8e8d96 !important;
    color: white !important;
}

.cycle_water_start {
    background-color: #5c9acd !important;
    color: white !important;
}

/* Override Bootstrap table padding */
.calendar-table>:not(caption)>*>* {
    padding: 0;
}

.calendar-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.calendar-table th {
    text-align: center;
    padding: 8px;
    font-weight: 500;
    background-color: var(--primary-purple);
    color: var(--text-dark);
}

.calendar-day {
    min-height: 60px;
    position: relative;
    padding: 0 0 5px 0;
}

.today {
    background-color: var(--light-purple) !important;
    border-radius: 4px;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin: 0;
    padding: 0;
}

.date-number {
    font-size: 2.5rem;
    font-weight: bold;
    padding: 0 0 0 5px;
    margin: 0;
    line-height: 2rem;
}

.tongshu-lunar-calendar {
    font-size: 0.7rem;
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    width: 28px;
}
.tongshu-lunar-calendar .lunar-title, .tongshu-lunar-calendar .lunar-desc {
    line-height: 0.9rem;
    text-align: center;
}
.lunar-small{
    font-size: 0.55rem;
}
.tongshu-lunar-leap {
    font-size: 0.7rem;
    float: right;
    margin: 0;
    padding-right: 1px;
    color: #134179;
}

.solar-term {
    font-size: 0.7rem;
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    width: 28px;
}

.solar-term .lunar-title, .solar-term .lunar-desc {
    line-height: 0.9rem;
    text-align: center;
}

.solar-term .lunar-desc {
    font-size: 0.6rem;
}

.bazi-info {
    text-align: center;
    margin: 2px 0 2px 0;
    padding: 0;
}

/* Good-day badges below the date number */
.good-day-badges {
    display: block;
    margin-top: 2px;
}

/* Side containers for good-day badges */
.good-day-side {
    position: absolute;
    top: 28px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 2;
}
.good-left { left: 4px; }
.good-right { right: 4px; }

.good-day-badge {
    display: inline-block;
    background-color: #ee2c2c; /* red bg like 明堂 but filled */
    color: #fff; /* white text */
    border: 1px solid #ee2c2c; /* red border */
    border-radius: 4px;
    padding: 0 3px;
    margin: 1px 1px 0 0;
    font-size: 0.7rem; /* similar to 明堂 size */
    line-height: 1rem;
}

/* 六冲 (Six Clash) badge - black styling for bad relationship */
.good-day-badge.liuchong {
    background-color: #000; /* black background */
    color: #fff; /* white text */
    border: 1px solid #000; /* black border */
}

@media (max-width: 768px) {
    .good-day-side { top: 24px; }
    .good-day-badge { font-size: 0.65rem; }
}

.stem-branch {
    font-size: 1.2rem;
    color: #333;
    margin: 0;
    padding: 0 0 0 4px;
    font-weight: 500;
}

.divination-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2px;
    gap: 4px;
    min-height: 16px;
}

.jianchu {
    text-align: center;
    font-size: 0.8rem;
    color: #555;
    padding: 0;
    margin: 0;
    width: 20px;
}

.yellow-black-path {
    text-align: center;
    font-size: 0.75rem;
    border-radius: 3px;
    margin: 0;
    padding: 0 1px;
}

.yellow-black-path.good {
    color: #000;
    border: 1px solid #ee2c2c;
}

.yellow-black-path.bad {
    color: #000;
    border: 1px solid #000;
}

.text-muted {
    opacity: 0.5;
}

/* Small Mobile Devices */
@media (max-width: 768px) {
    .calendar-table th {
        font-size: 1rem;
        padding: 1px;
    }

    .calendar-day {
        min-height: 40px;
    }

    .date-number {
        font-size: 1.5rem;
    }

    .tongshu-lunar-calendar,
    .solar-term {
        font-size: 0.7rem;
    }

    .stem-branch {
        font-size: 1.1rem;
        font-weight: 500;
        line-height: 1.6rem;
    }

    .divination-row {
        gap: 2px;
    }

    .jianchu {
        font-size: 0.8rem;
    }

    .yellow-black-path {
        font-size: 0.7rem;
    }
}

/* Mobile Responsive Calendar Styles */
@media (max-width: 480px) {
    .calendar-table th {
        font-size: 1rem;
        padding: 2px 1px;
    }

    .calendar-day {
        min-height: 45px;
    }

    .date-header{
        height: 1.6rem;
    }

    .date-number {
        font-size: 2rcap;
        line-height: 2rem;
        padding: 0 0 0 5px;
    }

    .tongshu-lunar-calendar, .solar-term  {
        font-size: 0.7rem;
    }

    .tongshu-lunar-calendar .lunar-title, .tongshu-lunar-calendar .lunar-desc {
        line-height: 0.85rem;
    }

    .solar-term .lunar-title {
        line-height: 0.9rem;
    }
    
    .solar-term .lunar-desc {
        font-size: 0.55rem;
        line-height: 0.8rem;
    }

    .stem-branch {
        font-size: 0.9rem;
        padding: 0 0 0 2px;
        line-height: 1.6rem;
    }

    .divination-row {
        margin-top: -5px;
        margin-bottom: -1px;
        gap: 1px;
    }

    .jianchu {
        font-size: 0.8rem;
        margin: 0;
    }

    .yellow-black-path {
        font-size: 0.65rem;
        padding: 0px 1px;
        margin: 0;
    }

    .bazi-info {
        margin: 1px 0;
    }

    .tongshu-lunar-leap {
        line-height: 0.8rem;
    }
}

/* Month picker styles - keep all these styles */
.month-picker-container {
    display: flex;
    align-items: center;
}

/* Desktop view styles */
.desktop-view {
    display: flex;
    align-items: center;
}

.year-dropdown {
    width: 100px;
    margin-right: 5px;
    border-radius: 0.25rem;
}

.month-dropdown {
    width: 140px;
    margin-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

#calendar-icon-btn-desktop {
    height: 38px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: #f8f9fa;
    border-color: #ced4da;
}

/* Mobile view styles */
.mobile-view {
    display: none;
}

.month-picker {
    width: 160px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

#calendar-icon-btn {
    height: 38px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: #f8f9fa;
    border-color: #ced4da;
}

#calendar-icon-btn:hover, #calendar-icon-btn-desktop:hover {
    background-color: #e9ecef;
}
input[type="month"]::-webkit-calendar-picker-indicator {
    /* display: none; */
  }
  input[type="month"]::-moz-calendar-picker-indicator {
    /* display: none; */
  }
/* Responsive adjustments for month picker */
@media (max-width: 768px) {
    .desktop-view {
        display: none;
    }
    
    .mobile-view {
        display: flex;
    }
    
    .month-picker-container {
        margin-left: auto;
        position: relative;
    }
    
    .month-picker {
        /* width: calc(100% - 45px); */
        margin-left: auto;
    }
    
    /* Fix custom date picker positioning in mobile view */
    .custom-date-picker {
        position: absolute;
        top: 38px;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 280px;
        z-index: 1050;
    }
}

/* Custom date picker styles */
.custom-date-picker {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    background-color: white;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: 5px;
}

.custom-date-picker.show {
    display: block;
}

.date-picker-content {
    padding: 15px;
}

.year-selection {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.year-option {
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
}

.year-option:hover {
    background-color: #f8f9fa;
}

.year-option.selected {
    background-color: #4a89dc;
    color: white;
}

.month-selection {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 15px;
}

.month-option {
    padding: 8px 0;
    text-align: center;
    cursor: pointer;
    border-radius: 3px;
}

.month-option:hover {
    background-color: #f8f9fa;
}

.month-option.selected {
    background-color: #4a89dc;
    color: white;
}

.date-picker-controls {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* Position the container for correct dropdown placement */
.month-picker-container {
    display: flex;
    align-items: center;
    position: relative;
}