.allianceauth-opcalendar {
    padding-top: 12px;
}

.allianceauth-opcalendar h5 {
    padding-left: 14px;
}

.allianceauth-opcalendar .nostyling {
    text-decoration: none !important;
}

.allianceauth-opcalendar .btn {
    outline: none;
    color: white;
    box-shadow: 0 0 0 0;
    margin-right: 3px;
}

/* Calendar grid */
.allianceauth-opcalendar .calendar {
    width: 98%;
    margin: auto;
    font-size: 13px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
}

.allianceauth-opcalendar .calendar th {
    padding: 10px;
    text-align: center;
    font-size: .8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    width: 15%;
    border: 1px solid var(--bs-border-color);
}

.allianceauth-opcalendar .calendar td {
    position: relative;
    vertical-align: top;
    width: 15%;
    padding: 0;
    transition: background-color .15s ease-in-out;
    border: 1px solid var(--bs-border-color);
}

.allianceauth-opcalendar .calendar .day-cell {
    height: 165px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 8px 5px;
    scrollbar-width: none;
}

.allianceauth-opcalendar .calendar .day-cell::-webkit-scrollbar {
    display: none;
}

.allianceauth-opcalendar .day-events {
    box-sizing: border-box;
    max-height: 104px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.allianceauth-opcalendar .day-events::-webkit-scrollbar {
    display: none;
}

.allianceauth-opcalendar .day-scroll-arrow {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: .65em;
    opacity: 0.55;
    pointer-events: none;
    z-index: 3;
}

.allianceauth-opcalendar .day-scroll-arrow.show {
    display: block;
}

.allianceauth-opcalendar .day-scroll-up {
    top: 4px;
}

.allianceauth-opcalendar .day-scroll-down {
    bottom: 4px;
}

.allianceauth-opcalendar .day-events-more-count {
    display: none;
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: .65em;
    font-weight: 600;
    opacity: 0.7;
    pointer-events: none;
    z-index: 3;
}

.allianceauth-opcalendar .day-events-more-count.show {
    display: inline-block;
}

.allianceauth-opcalendar .month {
    font-size: 1.4em;
    font-weight: 600;
    padding: 12px;
    letter-spacing: .02em;
    background: color-mix(in srgb, var(--bs-body-bg) 70%, var(--bs-body-color));
    color: var(--bs-body-color);
}

.allianceauth-opcalendar .date {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 6px;
    margin-bottom: 7px;
}

.allianceauth-opcalendar td.today .date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 50%;
    font-weight: bold;
    background: #50a5f1;
    color: #ffffff;
}

/* Event chips */
.allianceauth-opcalendar .event {
    background-image: none;
    border-radius: 3px;
    background: color-mix(in srgb, var(--bs-body-bg) 80%, var(--bs-body-color));
    border: none;
    color: var(--bs-body-color);
    font-size: .8em;
    padding: 3px .75em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    position: relative;
}

.allianceauth-opcalendar .event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    z-index: 2;
}

.allianceauth-opcalendar .event span {
    display: block;
}

.allianceauth-opcalendar .event img {
    vertical-align: middle;
    display: inline-block;
}

.allianceauth-opcalendar .event-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    line-height: 1.3;
}

.allianceauth-opcalendar .event .event-row > span {
    display: inline;
}

.allianceauth-opcalendar .event-time {
    font-weight: 700;
    flex-shrink: 0;
}

.allianceauth-opcalendar .event-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.allianceauth-opcalendar .event-owner {
    display: block;
    font-size: .9em;
    font-style: italic;
    opacity: .7;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Category color fallback (no icon set): colored dot, blinks like the
   important-dot when the event is important */
.allianceauth-opcalendar .event.has-category-dot {
    padding-left: calc(.75em + 14px);
}

.allianceauth-opcalendar .event .category-dot {
    display: block;
    position: absolute;
    top: 50%;
    left: .75em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    transform: translateY(-50%);
}

.allianceauth-opcalendar .event.important-event.has-category-dot .important-dot {
    display: none;
}

.allianceauth-opcalendar .event.important-event.has-category-dot .category-dot {
    animation: opcalendar-important-blink 1.4s ease-in-out infinite;
}
.allianceauth-opcalendar .event:before {
    width: 0;
    height: 0;
    border-width: 0 15px 15px 0;
    content: '';
    position: absolute;
    right: 0;
    top: 0;
}

.allianceauth-opcalendar .event.past-event {
    opacity: 0.6;
}

.allianceauth-opcalendar .event-signup-icon {
    position: absolute;
    bottom: 3px;
    right: 4px;
    font-size: 1em;
    line-height: 1;
    z-index: 1;
}

.allianceauth-opcalendar .event-signup-icon.signup-attending {
    color: #2ecc71;
}

.allianceauth-opcalendar .event-signup-icon.signup-maybe {
    color: #f39c12;
}

.allianceauth-opcalendar .event-signup-icon.signup-declined {
    color: #e74c3c;
}

.allianceauth-opcalendar .important-dot {
    display: none;
}

.allianceauth-opcalendar .event.important-event {
    padding-left: calc(.75em + 14px);
}

.allianceauth-opcalendar .event.important-event .important-dot {
    display: block;
    position: absolute;
    top: 50%;
    left: .75em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e74c3c;
    transform: translateY(-50%);
    animation: opcalendar-important-blink 1.4s ease-in-out infinite;
}

/* Category icon in left gutter */
.allianceauth-opcalendar .event.has-type-icon {
    padding-left: calc(.75em + 18px);
}

/* Important + has icon: blink the icon, hide the red dot */
.allianceauth-opcalendar .event.important-event.has-type-icon {
    padding-left: calc(.75em + 18px);
}

.allianceauth-opcalendar .event.important-event.has-type-icon .important-dot {
    display: none;
}

.allianceauth-opcalendar .event.important-event.has-type-icon .event-type-icon {
    animation: opcalendar-important-blink 1.4s ease-in-out infinite;
}

@keyframes opcalendar-important-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.25;
    }
}

.allianceauth-opcalendar .event-structuretimer,
.allianceauth-opcalendar .event-moonmining {
    padding-left: calc(.75em + 18px);
    background: color-mix(in srgb, var(--bs-body-bg) 80%, var(--bs-body-color));
}

.allianceauth-opcalendar .event-type-icon {
    position: absolute;
    top: 50%;
    left: .75em;
    transform: translateY(-50%);
    font-size: 1.05em;
}

.allianceauth-opcalendar .event-moonmining .event-moon-details {
    font-size: .85em;
    opacity: .75;
    display: flex;
    align-items: center;
    gap: 4px;
}

.allianceauth-opcalendar .event-structuretimer.structuretimer-important .event-type-icon {
    color: #e74c3c !important;
    animation: opcalendar-important-blink 1.4s ease-in-out infinite;
}

/* Layout helpers */
.allianceauth-opcalendar ul {
    height: 100%;
    padding: 0 5px 0 20px;
}

.allianceauth-opcalendar a {
    color: #17a2b8;
}

.allianceauth-opcalendar .left {
    float: left;
}

.allianceauth-opcalendar .right {
    float: right;
}

.allianceauth-opcalendar .form {
    margin: auto;
}

.allianceauth-opcalendar .form input,
.allianceauth-opcalendar .form select,
.allianceauth-opcalendar .form textarea {
    border-radius: 5px;
    outline: none;
    background: none;
    padding: 5px;
    width: 100%;
}

/* Legend & filters */
.allianceauth-opcalendar .legend-card .card-header {
    padding: .4rem .75rem;
    font-size: .9em;
}

.allianceauth-opcalendar .legend-card .card-body {
    padding: .5rem .75rem;
}

.allianceauth-opcalendar .legend {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.allianceauth-opcalendar .legend span {
    padding: 2px 10px 2px 6px;
    font-size: .8em;
    line-height: 1.6;
    cursor: pointer;
    opacity: 0.7;
    border-radius: 4px;
    transition: opacity .12s ease-in-out;
}

.allianceauth-opcalendar .legend span.active,
.allianceauth-opcalendar .legend span:hover {
    opacity: 1;
}

.allianceauth-opcalendar .legend-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 6px;
    font-size: .8em;
}

.allianceauth-opcalendar .legend-meta .label {
    font-size: .85em;
}

.allianceauth-opcalendar .calendar .label {
    display: table-cell;
    vertical-align: middle;
}

.allianceauth-opcalendar .calendar .event-moon-name {
    margin-left: 5px;
}

/* Badge styling (Bootstrap 3 .label compatibility) */
.allianceauth-opcalendar .label {
    display: inline-block;
    padding: .35em .65em;
    font-size: .75em;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .375rem;
}

.allianceauth-opcalendar .label:empty {
    display: none;
}

.allianceauth-opcalendar .label-default {
    background-color: #95a5a6;
}

.allianceauth-opcalendar .label-default[href]:focus,
.allianceauth-opcalendar .label-default[href]:hover {
    background-color: #798d8f;
}

.allianceauth-opcalendar .label-primary {
    background-color: #2C3E50;
}

.allianceauth-opcalendar .label-primary[href]:focus,
.allianceauth-opcalendar .label-primary[href]:hover {
    background-color: #1a242f;
}

.allianceauth-opcalendar .label-success {
    background-color: #5cb85c;
}

.allianceauth-opcalendar .label-success[href]:focus,
.allianceauth-opcalendar .label-success[href]:hover {
    background-color: #449d44;
}

.allianceauth-opcalendar .label-info {
    background-color: #5bc0de;
}

.allianceauth-opcalendar .label-info[href]:focus,
.allianceauth-opcalendar .label-info[href]:hover {
    background-color: #31b0d5;
}

.allianceauth-opcalendar .label-warning {
    background-color: #f0ad4e;
}

.allianceauth-opcalendar .label-warning[href]:focus,
.allianceauth-opcalendar .label-warning[href]:hover {
    background-color: #ec971f;
}

.allianceauth-opcalendar .label-danger {
    background-color: #d9534f;
}

.allianceauth-opcalendar .label-danger[href]:focus,
.allianceauth-opcalendar .label-danger[href]:hover {
    background-color: #c9302c;
}
