/*
 *  package: Content Calendar PRO
 *  copyright: Copyright (c) 2025. Jeroen Moolenschot | Joomill
 *  license: GNU General Public License version 3 or later
 *  link: https://www.joomill-extensions.com
 */

/* Content Calendar Module Styles */
.mod-contentcalendar {
    margin: 20px;
    border: var(--border-width) solid var(--border-color);
}

/* Calendar Navigation */
.calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 16px 24px;
    gap: 12px;
}


.calendar-title {
    margin: 0;
    font-size: 22px;
    font-weight: 400;
    color: #3c4043;
}

/* Calendar Table */
.calendar-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    table-layout: fixed;
}

.calendar-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 500;
    font-size: 11px;
    color: #70757a;
    letter-spacing: 0.8px;
    border-bottom: var(--border-width) solid var(--border-color);
    border-right: var(--border-width) solid var(--border-color);
}

.calendar-table th:last-child {
    border-right: none;
}

.calendar-table td {
    border-right: var(--border-width) solid var(--border-color);
    border-bottom: var(--border-width) solid var(--border-color);
    vertical-align: top;
    height: 60px;
    width: 14.28%;
    position: relative;
    padding: 0;
    transition: background-color 0.1s;
}

.calendar-table td:last-child {
    border-right: none;
}

.calendar-table .calendar-day {
    min-height: 60px;
    position: relative;
    padding: .5rem 0.2rem;
    cursor: pointer;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.empty-day {
    background-color: var(--atum-calendar-week-bg);
    cursor: default;
}

.calendar-day.today {
    background-color: var(--template-bg-light);
}

.day-number {
    font-weight: 400;
    font-size: 14px;
    margin-bottom: 8px;
    color: #3c4043;
    text-align: center;
}

.default-view .calendar-day.today .day-number {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-color);
    border-radius: var(--border-radius-sm);
    width: 32px;
    height: 24px;
    line-height: 24px;
    margin: 0 auto 8px auto;
    font-weight: 500;
}

.weeks-view .calendar-day.today .day-number {
    color: var(--text-color);
    font-weight: 700;
    line-height: 24px;
    margin: 0 auto 8px auto;
}

/* Articles in Calendar */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    max-height: 120px;
    overflow: hidden;
    min-width: 0;
}

.article-bar {
    display: block;
    padding: 2px 6px;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
    cursor: pointer;
}

.article-bar:hover {
    filter: brightness(0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.article-bar {
    color: #fff !important;
    text-decoration: none !important;
}

/* Tooltip Styles */
.article-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.article-tooltip.show {
    opacity: 1;
}

.article-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #333;
}

.article-tooltip.tooltip-below::after {
    top: -10px;
    border-top-color: transparent;
    border-bottom-color: #333;
}

.tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.tooltip-author {
    color: #ccc;
    font-size: 11px;
}

.tooltip-time {
    color: #ccc;
    font-size: 11px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calendar-navigation {
        flex-direction: column;
        gap: 10px;
    }

    .calendar-table th,
    .calendar-table td {
        padding: 3px;
        font-size: 10px;
    }

    .calendar-day {
        min-height: 60px;
    }

    .articles-list {
        max-height: 40px;
    }

    .article-item {
        font-size: 9px;
        padding: 1px 2px;
    }
}

.calendar-day .day-number {
    position: relative;
}

/* Improve hit area and avoid overlapping article bars */
.calendar-day .articles-list {
    position: relative;
    z-index: 1;
}

/* Weeks view enhancements */
.mod-contentcalendar.weeks-view .day-number {
    text-align: left;
    margin: 0 0 6px 6px;
}

.mod-contentcalendar.weeks-view .day-number .month-abbr {
    display: block;
    font-size: 11px;
    line-height: 1.1;
    color: #70757a;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0 0 2px 0;
}

.mod-contentcalendar.weeks-view .calendar-day.first-of-month {
    box-shadow: inset 2px 0 0 0 var(--btn-secondary-bg);
}

/* Loading state for AJAX calendar updates */
.mod-contentcalendar.loading {
    position: relative;
    pointer-events: none;
}

.mod-contentcalendar.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 999;
}

.mod-contentcalendar.loading .calendar-grid {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.mod-contentcalendar.loading .calendar-navigation {
    opacity: 0.7;
}
