/**
 * Style dla Kalendarza Wydarzenia Globalnych
 * Customer Management Plugin
 * 
 * Wzorowane na stylach tablicy dla spójności interfejsu
 */

/* ============================================
   KONTENER KALENDARZA
   ============================================ */

.cmp-wydarzenia-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.cmp-wydarzenia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.cmp-wydarzenia-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

/* ============================================
   NAWIGACJA KALENDARZA
   ============================================ */

.cmp-calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
}

.cmp-calendar-nav-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.2s;
}

.cmp-calendar-nav-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.cmp-calendar-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cmp-calendar-month-year {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* ============================================
   SIATKA KALENDARZA
   ============================================ */

.cmp-calendar-grid {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
}

/* Nagłówki dni tygodnia */
.cmp-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 2px solid #ddd;
}

.cmp-calendar-weekday {
    padding: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Siatka dni */
.cmp-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ddd;
}

.cmp-calendar-day {
    background: #fff;
    min-height: 120px;
    padding: 10px;
    position: relative;
    cursor: default;
    transition: all 0.2s;
}

/* Dzień z innego miesiąca */
.cmp-calendar-day.other-month {
    background: #f9f9f9;
    color: #999;
}

.cmp-calendar-day.other-month .cmp-day-number {
    color: #ccc;
}

/* Dzisiejsza data - zielone tło */
.cmp-calendar-day.today {
    background: #4caf50;
}

.cmp-calendar-day.today .cmp-day-number {
    color: #fff;
    font-weight: 700;
}

/* Dzień z wydarzeniami - niebieski kolor tła */


.cmp-calendar-day.has-events .cmp-day-number {
    color: #fff;
    font-weight: 600;
}

/* Hover dla admina */
.cmp-calendar-day.admin-hover:hover {
    background: #e3f2fd;
    cursor: pointer;
}

.cmp-calendar-day.admin-hover:hover .cmp-add-event-btn {
    opacity: 1;
}

/* Numer dnia */
.cmp-day-number {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

/* Przycisk "+" dla admina */
.cmp-add-event-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cmp-add-event-btn:hover {
    background: #135e96;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Lista wydarzeń w dniu */
.cmp-day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 5px;
}

.cmp-day-event-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid #2271b1;
}

.cmp-day-event-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(2px);
}

.cmp-event-time {
    font-weight: 600;
    color: #333;
}

.cmp-event-title {
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wydarzenie całodniowe */
.cmp-day-event-item.all-day {
    border-left-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

/* Spotkanie użytkownika (is_global = 2) */
.cmp-day-event-item.user-meeting {
    border-left-color: #219EC5;
    background: #219EC540;
}

.cmp-day-event-item.user-meeting:hover {
    background: rgba(156, 39, 176, 0.2);
}

/* Spotkanie użytkownika całodniowe */
.cmp-day-event-item.user-meeting.all-day {
    border-left-color: #9C27B0;
    background: rgba(156, 39, 176, 0.15);
}

/* "Zobacz wszystkie" link */
.cmp-see-all-events {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #2271b1;
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

.cmp-see-all-events:hover {
    color: #135e96;
}

/* ============================================
   POPUP - DODAWANIE WYDARZENIA
   ============================================ */

.cmp-wydarzenie-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmp-wydarzenie-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.cmp-wydarzenie-popup-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header popupu */
.cmp-wydarzenie-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.popup-user-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.popup-avatar img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.popup-user-details {
    display: flex;
    flex-direction: column;
}

.popup-user-details strong {
    font-size: 15px;
    color: #333;
}

.popup-action-text {
    font-size: 13px;
    color: #666;
}

.cmp-wydarzenie-popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 28px;
    color: #666;
}

.cmp-wydarzenie-popup-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Body popupu */
.cmp-wydarzenie-popup-body {
    padding: 24px;
    max-height: calc(90vh - 160px);
    overflow-y: auto;
}

.cmp-wydarzenie-form .form-group {
    margin-bottom: 20px;
}

.cmp-wydarzenie-form label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.cmp-wydarzenie-input,
.cmp-wydarzenie-textarea,
.cmp-wydarzenie-time {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    font-family: inherit;
    color: #333;
    transition: all 0.2s;
}

.cmp-wydarzenie-input:focus,
.cmp-wydarzenie-textarea:focus,
.cmp-wydarzenie-time:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.cmp-wydarzenie-input::placeholder,
.cmp-wydarzenie-textarea::placeholder {
    color: #999;
}

.cmp-wydarzenie-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox całodniowy */
.cmp-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cmp-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cmp-checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

/* Footer popupu */
.cmp-wydarzenie-popup-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.cmp-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.cmp-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.cmp-btn-cancel:hover {
    background: #e8e8e8;
}

.cmp-btn-primary {
    background: #2271b1;
    color: #fff;
}

.cmp-btn-primary:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.cmp-btn-primary:active {
    transform: translateY(0);
}

.cmp-btn-danger {
    background: #dc3545;
    color: #fff;
}

.cmp-btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Przycisk usuwania (śmietnik) */
.cmp-btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 20px;
    color: #dc3545;
}

.cmp-btn-delete:hover {
    background: #fee;
}

/* ============================================
   POPUP - SZCZEGÓŁY WYDARZENIA
   ============================================ */

.cmp-event-details {
    padding: 20px 0;
}

.cmp-event-detail-row {
    margin-bottom: 15px;
}

.cmp-event-detail-label {
    font-weight: 600;
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cmp-event-detail-value {
    font-size: 15px;
    color: #333;
    line-height: 1.6;
}

.cmp-event-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e3f2fd;
    color: #2271b1;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.cmp-event-badge.all-day {
    background: #fff3e0;
    color: #ff9800;
}

/* ============================================
   POPUP - WSZYSTKIE WYDARZENIA DNIA
   ============================================ */

.cmp-all-events-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cmp-event-list-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
    cursor: pointer;
    transition: all 0.2s;
}

.cmp-event-list-item:hover {
    background: #e3f2fd;
    transform: translateX(4px);
}

.cmp-event-list-item.all-day {
    border-left-color: #ff9800;
}

.cmp-event-list-time {
    font-weight: 600;
    color: #2271b1;
    font-size: 14px;
    margin-bottom: 5px;
}

.cmp-event-list-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.cmp-event-list-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* ============================================
   RESPONSYWNOŚĆ
   ============================================ */

@media (max-width: 768px) {
    .cmp-calendar-day {
        min-height: 80px;
        padding: 5px;
    }
    
    .cmp-day-number {
        font-size: 14px;
    }
    
    .cmp-day-event-item {
        font-size: 10px;
        padding: 3px 5px;
    }
    
    .cmp-add-event-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    .cmp-wydarzenie-popup-content {
        width: 95%;
        max-width: none;
    }
}