/* =========================================================
   POLIKA PLATFORM - Calendar & Events Module Styles
   File: assets/css/admin-calendar.css
   ========================================================= */

/* Prevent page scrolling when Calendar tab is active, respecting outer margins/padding */
.content-wrapper:has(#calendar-tab.active),
.content-wrapper.calendar-tab-active {
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

#calendar-tab.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.calendar-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    margin: 0 0 1rem 0;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

/* Full-height Calendar Card Container */
.calendar-container {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

/* Calendar Month / Navigation Header */
.calendar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.calendar-header h3 {
    color: var(--accent-color, #9AB3F5);
    font-size: 1.3rem;
    margin: 0;
    min-width: 200px;
    text-align: center;
    font-weight: 600;
}

.btn-calendar-nav {
    width: auto !important;
    padding: 8px 16px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Main Body Row: Grid + Events Panel */
.calendar-content-row {
    display: flex;
    gap: 1.25rem;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* Calendar Grid Wrapper */
.calendar-grid-wrapper {
    background: rgba(255, 255, 255, 0.015);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: auto;
    grid-auto-rows: minmax(0, 1fr);
    gap: 6px;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    font-weight: 600;
    padding: 4px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Individual Day Cell */
.calendar-day {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-sizing: border-box;
    overflow: hidden;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.calendar-day.today {
    background: rgba(154, 179, 245, 0.1);
    border: 1px solid var(--accent-color, #9AB3F5);
}

.calendar-day.today .day-number {
    color: var(--accent-color, #9AB3F5);
    font-weight: bold;
}

.calendar-day.other-month {
    opacity: 0.25;
}

.day-number {
    font-size: 0.85rem;
    color: var(--text-primary, #fff);
    margin-bottom: 3px;
    text-align: center;
    flex-shrink: 0;
}

/* Event Stickers inside day cells */
.calendar-stickers-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    margin-top: 2px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.event-sticker {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.15s ease, filter 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.25;
    flex-shrink: 0;
}

.event-sticker:hover {
    transform: scale(1.02);
    filter: brightness(1.2);
}

.event-sticker i {
    font-size: 0.65rem;
    flex-shrink: 0;
}

.event-sticker .sticker-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.sticker-more {
    font-size: 0.68rem;
    color: var(--text-secondary, #888);
    text-align: center;
    padding-top: 1px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Category Badge and Sticker Styles */
.event-sticker.category-general {
    background: rgba(154, 179, 245, 0.18);
    color: #9AB3F5;
    border-color: rgba(154, 179, 245, 0.35);
}

.event-sticker.category-event {
    background: rgba(255, 140, 0, 0.2);
    color: #ff9922;
    border-color: rgba(255, 140, 0, 0.45);
}

.event-sticker.category-production {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.45);
}

.event-sticker.category-meeting {
    background: rgba(40, 167, 69, 0.2);
    color: #34d058;
    border-color: rgba(40, 167, 69, 0.45);
}

.event-sticker.category-deadline {
    background: rgba(255, 59, 48, 0.2);
    color: #ff5252;
    border-color: rgba(255, 59, 48, 0.45);
}

.event-sticker.category-holiday {
    background: rgba(111, 66, 193, 0.22);
    color: #bb86fc;
    border-color: rgba(111, 66, 193, 0.45);
}

/* Calendar Events Side Panel */
.calendar-events-panel {
    background: rgba(255, 255, 255, 0.015);
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    flex: 0 0 380px;
    max-width: 420px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.calendar-events-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.calendar-events-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.calendar-events-panel h4 {
    color: var(--text-primary, #fff);
    font-size: 1rem;
    margin: 0;
}

.events-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(154, 179, 245, 0.12);
    color: var(--accent-color, #9AB3F5);
    border: 1px solid rgba(154, 179, 245, 0.25);
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.events-date-filter {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    font-weight: 400;
}

.btn-show-all-events {
    background: none;
    border: none;
    color: var(--accent-color, #9AB3F5);
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 6px;
    padding: 0;
    transition: opacity 0.2s ease;
}

.btn-show-all-events:hover {
    opacity: 0.8;
}

.btn-add-event {
    width: auto !important;
    padding: 6px 14px !important;
    font-size: 0.85rem !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Events List inside Panel */
#calendar-events-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

#calendar-events-list::-webkit-scrollbar {
    width: 5px;
}

#calendar-events-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

#calendar-events-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

#calendar-events-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.event-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--accent-color, #9AB3F5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.event-item-title {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

.event-item-time {
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    margin-top: 4px;
}

.event-item-desc {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

.event-item-category {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-top: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.event-item-category i {
    font-size: 0.7rem;
}

.category-general { background: rgba(154, 179, 245, 0.15); color: #9AB3F5; }
.category-event { background: rgba(255, 140, 0, 0.15); color: #ff8c00; }
.category-production { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.category-meeting { background: rgba(40, 167, 69, 0.15); color: #28a745; }
.category-deadline { background: rgba(255, 59, 48, 0.15); color: #ff3b30; }
.category-holiday { background: rgba(111, 66, 193, 0.15); color: #6f42c1; }

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.no-events {
    text-align: center;
    color: #666;
    padding: 30px;
    font-size: 0.9rem;
}

.event-delete-btn {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.event-delete-btn:hover {
    background: rgba(255, 59, 48, 0.2);
}

.event-edit-btn {
    background: rgba(154, 179, 245, 0.1);
    color: #9AB3F5;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.event-edit-btn:hover {
    background: rgba(154, 179, 245, 0.2);
}

/* Responsive / Mobile Behavior */
@media (max-width: 992px) {
    .content-wrapper:has(#calendar-tab.active),
    .content-wrapper.calendar-tab-active {
        overflow-y: auto !important;
        height: auto;
    }

    #calendar-tab.active {
        height: auto;
        min-height: 0;
    }

    .calendar-container {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .calendar-content-row {
        flex-direction: column;
        height: auto;
    }

    .calendar-events-panel {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: auto;
    }

    #calendar-events-list {
        max-height: 350px;
    }

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

@media (max-width: 768px) {
    .calendar-header {
        flex-wrap: wrap;
    }
    .calendar-day {
        min-height: 45px;
        padding: 4px 2px;
    }
    .calendar-grid-wrapper,
    .calendar-events-panel {
        min-width: 100%;
    }
}
