/* ========================================
   Events Manager Pro - Calendar Styles
   ======================================== */

/* Calendar Container */
.emp-calendar-container {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    margin: 0 auto;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.emp-calendar-widget .emp-calendar-container {
    padding: 20px;
    max-width: 100%;
}

/* Calendar Header */
.emp-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--emp-primary-color, #667eea) 0%, var(--emp-button-color, #764ba2) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.emp-calendar-month-year {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.emp-calendar-nav {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.emp-calendar-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.emp-calendar-nav span {
    display: block;
    margin-top: -2px;
}

/* Calendar Body */
.emp-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.emp-weekday {
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--emp-primary-color, #667eea);
    padding: 12px 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #f5f7ff, #e8ecff);
    border-radius: 8px;
}

.emp-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.emp-calendar-day {
    height: 140px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid #e8ecff;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
}

.emp-calendar-day:hover {
    background: #f8f9ff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.emp-day-number {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
}

.emp-calendar-day.other-month {
    background: #fff;
    opacity: 0.5;
}

.emp-calendar-day.other-month .emp-day-number {
    color: #ccc;
}

.emp-calendar-day.today {
    background: linear-gradient(135deg, #ff9a56 0%, #ffb366 100%);
    border-color: #ff9a56;
}

.emp-calendar-day.today .emp-day-number {
    color: #fff;
    font-weight: 700;
}

.emp-calendar-day.today .emp-calendar-event-mini {
    background: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

.emp-calendar-day.selected {
    background: linear-gradient(135deg, #a8b5ff 0%, #c5ceff 100%);
    border-color: #a8b5ff;
}

.emp-calendar-day.selected .emp-day-number {
    color: #fff;
    font-weight: 700;
}

.emp-calendar-day.selected .emp-calendar-event-mini {
    background: rgba(255, 255, 255, 0.4) !important;
    color: #fff !important;
}

.emp-calendar-day.has-event:not(.today):not(.selected) {
    background: #fff;
}

.emp-calendar-day.has-event::after {
    display: none;
}

.emp-calendar-day.has-past-event::after {
    display: none;
}

.emp-calendar-day.has-multiple-events::after {
    display: none;
}

/* Event items in calendar cells */
.emp-events-container {
    width: 100%;
    margin-top: 5px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 80px;
}

.emp-events-container::-webkit-scrollbar {
    width: 3px;
}

.emp-events-container::-webkit-scrollbar-track {
    background: transparent;
}

.emp-events-container::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.emp-calendar-event-mini {
    font-size: 10px;
    padding: 4px 6px;
    margin-bottom: 4px;
    background: var(--emp-primary-color, #667eea);
    color: #fff;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.3;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.emp-calendar-event-mini:hover {
    opacity: 0.85;
}

.emp-calendar-day.has-past-event .emp-calendar-event-mini {
    background: #bbb;
}

.emp-more-events {
    font-size: 10px;
    color: #667eea;
    font-weight: 700;
    margin-top: 4px;
    text-align: center;
    background: #f0f3ff;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Calendar Events List */
.emp-calendar-events-list {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.emp-calendar-events-list h4 {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

#emp-selected-day-events,
#emp-widget-selected-day-events {
    max-height: 400px;
    overflow-y: auto;
}

.emp-calendar-event-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.emp-calendar-event-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.emp-calendar-event-item h5 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
}

.emp-calendar-event-item h5 a {
    color: #333;
    text-decoration: none;
}

.emp-calendar-event-item h5 a:hover {
    color: #667eea;
}

.emp-calendar-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.emp-calendar-event-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.emp-calendar-event-meta .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #667eea;
}

.emp-no-events-day {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.emp-no-events-day .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Event Popup Modal */
.emp-event-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.emp-event-popup {
    background: #fff;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.emp-event-popup-header {
    background: linear-gradient(135deg, var(--emp-primary-color, #667eea) 0%, var(--emp-button-color, #764ba2) 100%);
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.emp-event-popup-header h3 {
    color: #fff;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.emp-popup-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emp-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.emp-event-popup-content {
    padding: 30px;
    max-height: calc(85vh - 90px);
    overflow-y: auto;
}

.emp-popup-event-item {
    padding: 20px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.emp-popup-event-item:hover {
    border-color: var(--emp-primary-color, #667eea);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.emp-popup-event-item:last-child {
    margin-bottom: 0;
}

.emp-popup-event-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.emp-popup-event-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.emp-popup-event-details h4 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.emp-popup-event-details h4 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.emp-popup-event-details h4 a:hover {
    color: var(--emp-primary-color, #667eea);
}

.emp-popup-event-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.emp-popup-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
}

.emp-popup-meta-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: var(--emp-primary-color, #667eea);
}

.emp-popup-event-desc {
    color: #666;
    line-height: 1.6;
    margin: 12px 0;
    font-size: 14px;
}

.emp-popup-view-btn {
    display: inline-block;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--emp-primary-color, #667eea) 0%, var(--emp-button-color, #764ba2) 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.emp-popup-view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Responsive Popup */
@media (max-width: 768px) {
    .emp-event-popup {
        max-width: 100%;
        margin: 10px;
    }
    
    .emp-event-popup-header {
        padding: 20px;
    }
    
    .emp-event-popup-header h3 {
        font-size: 18px;
    }
    
    .emp-event-popup-content {
        padding: 20px;
    }
    
    .emp-popup-event-item {
        padding: 15px;
    }
    
    .emp-popup-event-image {
        height: 150px;
    }
}

/* Widget Specific */
.emp-calendar-widget {
    margin: 20px 0;
}

.emp-calendar-widget .emp-calendar-month-year {
    font-size: 20px;
}

.emp-calendar-widget .emp-weekday {
    font-size: 12px;
    padding: 8px 3px;
}

.emp-calendar-widget .emp-calendar-day {
    font-size: 13px;
}

.emp-calendar-widget .emp-calendar-events-list {
    margin-top: 20px;
    padding-top: 20px;
}

.emp-calendar-widget .emp-calendar-events-list h4 {
    font-size: 16px;
}

/* Responsive */
/* Responsive Weekday Labels */
.emp-day-short { display: none; }
.emp-day-full { display: inline; }
.emp-day-name-mobile { display: none; } /* Hidden on desktop */

/* Responsive Styles */
@media (max-width: 768px) {
    /* Hide standard grid header */
    .emp-calendar-weekdays {
        display: none;
    }

    .emp-calendar-container { padding: 15px; }
    .emp-calendar-header { padding: 12px; margin-bottom: 15px; }
    .emp-calendar-month-year { font-size: 18px; }
    
    /* Vertical List Layout for Days */
    .emp-calendar-days { 
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .emp-calendar-day { 
        width: 100%;
        min-height: 50px; /* Compact height */
        height: auto;
        padding: 10px 15px; 
        font-size: 14px;
        display: flex;
        flex-direction: row; /* Side-by-side layout */
        align-items: center; /* Center vertically */
        justify-content: flex-start;
        gap: 15px;
    }
    
    /* Left Side: Date & Day Name */
    .emp-day-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 45px;
        padding-right: 15px;
        border-right: 2px solid #f0f0f0;
        flex-shrink: 0;
    }
    
    .emp-day-name-mobile {
        display: block;
        font-size: 11px;
        text-transform: uppercase;
        color: #999;
        font-weight: 600;
        margin-bottom: 2px;
    }

    .emp-day-number { 
        font-size: 20px; 
        font-weight: 700;
        margin: 0;
        text-align: center;
        width: auto;
        color: #333;
    }
    
    /* Right Side: Events List */
    .emp-events-container { 
        flex: 1;
        display: flex; 
        flex-direction: column;
        justify-content: center; 
        gap: 5px; 
        max-height: none; 
        margin-top: 0;
        width: auto;
        overflow: visible;
    }
    
    /* Event Styling - Text View */
    .emp-calendar-event-mini { 
        font-size: 13px !important;
        color: #333 !important;
        background: #f5f7ff !important;
        padding: 6px 10px !important;
        width: auto !important;
        height: auto !important;
        border-radius: 6px !important;
        margin: 0 !important;
        box-shadow: none !important;
        display: block;
        border-left: 3px solid var(--emp-primary-color, #667eea);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
    }
    
    .emp-more-events {
        display: block !important;
        font-size: 11px;
        color: #666;
        padding-left: 5px;
    }
    
    /* Today/Selected States */
    .emp-calendar-day.today {
        border-color: #ff9a56;
        background: #fff; /* Keep white bg for list item */
    }
    
    .emp-calendar-day.today .emp-day-number {
        color: #ff9a56; /* Highlight number instead of bg */
    }
    
    .emp-calendar-day.today .emp-day-name-mobile {
        color: #ff9a56;
    }
    
    .emp-calendar-day.today .emp-day-header {
        border-right-color: #ff9a56;
    }
    
    /* Hide empty days to save space? 
       No, keep them for calendar structure, but they are small (50px)
    */
}

@media (max-width: 480px) {
    .emp-calendar-day { min-height: 40px; }
    .emp-weekday { font-size: 9px; padding: 4px 0; }
    .emp-calendar-nav { width: 28px; height: 28px; font-size: 18px; }
}

@media (max-width: 360px) {
    .emp-calendar-header { padding: 8px; }
    .emp-calendar-month-year { font-size: 14px; }
    .emp-calendar-nav { width: 28px; height: 28px; font-size: 18px; }
    .emp-weekday { font-size: 9px; }
    .emp-calendar-day { min-height: 50px; }
}

/* Scrollbar Styling */
#emp-selected-day-events::-webkit-scrollbar,
#emp-widget-selected-day-events::-webkit-scrollbar {
    width: 6px;
}

#emp-selected-day-events::-webkit-scrollbar-track,
#emp-widget-selected-day-events::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#emp-selected-day-events::-webkit-scrollbar-thumb,
#emp-widget-selected-day-events::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

#emp-selected-day-events::-webkit-scrollbar-thumb:hover,
#emp-widget-selected-day-events::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
