/* Course Groups Widget CSS */

/* BLOKOWANIE PROBLEMATYCZNYCH PSEUDO-ELEMENTÓW */
/* Zapobiega dodawaniu overlay z opacity 0.5 */
.cgw-dashboard *::after,
.cgw-dashboard *::before {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    opacity: 1 !important;
    content: none !important;
    display: none !important;
}

/* Dodatkowe zabezpieczenie dla głównego kontenera */
.cgw-dashboard {
    position: relative;
    z-index: 10;
}

.cgw-dashboard::after,
.cgw-dashboard::before {
    content: none !important;
    display: none !important;
    background: none !important;
    opacity: 1 !important;
}

/* Zapobiega pojawianiu się overlay na wszystkich dzieciach */
.cgw-dashboard * {
    position: relative;
}

.cgw-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    color: #32373c;
}

.cgw-groups {
    margin-top: 20px;
}

.cgw-group {
    margin-bottom: 15px;
    border: 1px solid #e1e1e1;
    border-radius: 5px;
    overflow: hidden;
}

.cgw-group-header {
    background: #f7f7f7;
    border-bottom: 1px solid #e1e1e1;
}

.cgw-group-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #32373c;
    transition: all 0.3s ease;
}

.cgw-group-toggle:hover {
    background: #e0e0e0;
    color: #1a1a1a;
}

.cgw-group-toggle:active,
.cgw-group-toggle:focus,
.cgw-group.expanded .cgw-group-toggle {
    background: #0073aa;
    color: #ffffff;
}

.cgw-arrow {
    transition: transform 0.3s ease, color 0.3s ease;
    font-size: 12px;
    color: #666;
}

.cgw-group-toggle:hover .cgw-arrow {
    color: #1a1a1a;
}

.cgw-group-toggle:active .cgw-arrow,
.cgw-group-toggle:focus .cgw-arrow,
.cgw-group.expanded .cgw-group-toggle .cgw-arrow {
    color: #ffffff;
}

.cgw-group.collapsed .cgw-arrow {
    transform: rotate(-90deg);
}

.cgw-group-title {
    flex-grow: 1;
    font-size: 14px;
}

.cgw-group-count {
    color: #666;
    font-size: 12px;
    font-weight: normal;
    transition: color 0.3s ease;
}

.cgw-group-toggle:hover .cgw-group-count {
    color: #1a1a1a;
}

.cgw-group-toggle:active .cgw-group-count,
.cgw-group-toggle:focus .cgw-group-count,
.cgw-group.expanded .cgw-group-toggle .cgw-group-count {
    color: #ffffff;
}

.cgw-group-content {
    padding: 10px;
    background: #fff;
}

.cgw-group.collapsed .cgw-group-content {
    display: none;
}

.cgw-course {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.cgw-course-header {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #fafafa;
    transition: background-color 0.3s ease;
}

.cgw-course-header:hover {
    background: #f0f0f0;
}

.cgw-course-toggle {
    background: none;
    border: none;
    margin-right: 10px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.cgw-course-toggle:hover {
    background: rgba(0, 115, 170, 0.1);
}

/* Strzałka kursu - stan domyślny (zwinięty) */
.cgw-course .cgw-arrow {
    transform: rotate(-90deg);
    transition: transform 0.3s ease, color 0.3s ease;
}

/* Strzałka kursu - stan rozwinięty */
.cgw-course.expanded .cgw-arrow {
    transform: rotate(0deg);
}

.cgw-course-info {
    flex-grow: 1;
}

.cgw-course-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
}

.cgw-course-link {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cgw-course-link:hover {
    color: #005a87;
    text-decoration: underline;
}

.cgw-course-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.cgw-progress-text {
    font-size: 12px;
    color: #666;
    min-width: 80px;
}

.cgw-progress-bar {
    flex-grow: 1;
    height: 6px;
    background: #e1e1e1;
    border-radius: 3px;
    overflow: hidden;
    max-width: 120px;
}

.cgw-progress-fill {
    height: 100%;
    background: #46b450;
    transition: width 0.3s ease;
}

.cgw-course-lessons {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e1e1e1;
}

.cgw-lessons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
}

.cgw-lesson-tile {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 2px solid #ddd;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cgw-lesson-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.cgw-lesson-tile.completed {
    background: #46b450;
    border-color: #46b450;
    color: #fff;
}

.cgw-lesson-tile.incomplete {
    background: #f7f7f7;
    border-color: #ddd;
    color: #666;
}

.cgw-lesson-link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.cgw-lesson-number {
    font-size: 12px;
    font-weight: 600;
}

.cgw-lesson-check {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #fff;
    color: #46b450;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1px solid #46b450;
}

/* Tooltip - hantowany przez JavaScript */
.cgw-lesson-tile {
    position: relative;
}

.cgw-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 9999;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: none;
}

/* Compact mode dla sidebar */
.cgw-compact {
    font-size: 13px;
}

.cgw-compact .cgw-group-toggle {
    padding: 8px 10px;
    font-size: 12px;
}

.cgw-compact .cgw-group-toggle:hover {
    background: #e0e0e0;
    color: #1a1a1a;
}

.cgw-compact .cgw-group-toggle:active,
.cgw-compact .cgw-group-toggle:focus,
.cgw-compact .cgw-group.expanded .cgw-group-toggle {
    background: #0073aa;
    color: #ffffff;
}

.cgw-compact .cgw-course-header {
    padding: 8px;
}

.cgw-compact .cgw-course-title {
    font-size: 12px;
}

.cgw-compact .cgw-lessons-grid {
    grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
    gap: 5px;
}

.cgw-compact .cgw-lesson-tile {
    width: 30px;
    height: 30px;
}

.cgw-compact .cgw-lesson-number {
    font-size: 10px;
}

.cgw-compact .cgw-lesson-check {
    width: 12px;
    height: 12px;
    font-size: 8px;
}

.cgw-compact .cgw-arrow {
    font-size: 10px;
}

.cgw-compact .cgw-course-toggle {
    padding: 3px;
}

.cgw-compact .cgw-progress-text {
    font-size: 11px;
    min-width: 60px;
}

.cgw-compact .cgw-progress-bar {
    height: 4px;
    max-width: 80px;
}

/* Responsive */
@media (max-width: 768px) {
    .cgw-lessons-grid {
        grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
        gap: 6px;
    }
    
    .cgw-lesson-tile {
        width: 35px;
        height: 35px;
    }
    
    .cgw-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .cgw-course-progress {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .cgw-progress-bar {
        width: 100%;
        max-width: none;
    }
}

/* Animacje */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.cgw-course-lessons {
    animation: slideDown 0.3s ease-out;
}

.cgw-group-content {
    animation: slideDown 0.3s ease-out;
}

/* Group colors - różne kolory dla różnych grup LearnDash */
.cgw-group[data-group*="Grupa Teologiczna"] .cgw-group-header {
    border-left: 4px solid #4169e1;
}

.cgw-group[data-group*="Grupa Historyczna"] .cgw-group-header {
    border-left: 4px solid #dc143c;
}

.cgw-group[data-group*="Grupa VIP"] .cgw-group-header {
    border-left: 4px solid #ffd700;
}

.cgw-group[data-group*="Kursy bez grupy"] .cgw-group-header {
    border-left: 4px solid #696969;
}

/* Domyślny kolor dla innych grup */
.cgw-group:not([data-group*="Grupa Teologiczna"]):not([data-group*="Grupa Historyczna"]):not([data-group*="Grupa VIP"]):not([data-group*="Kursy bez grupy"]) .cgw-group-header {
    border-left: 4px solid #46b450;
}

/* Wyszarzenie ukończonych kursów */
.cgw-course-completed {
    opacity: 0.7;
    background: #f9f9f9;
}

.cgw-course-completed .cgw-course-header {
    background: #f5f5f5;
}

.cgw-course-completed .cgw-course-title a {
    color: #666;
}

.cgw-course-completed:hover {
    opacity: 0.85;
}

/* Zapewnienie że lekcje w ukończonych kursach nie dziedziczą opacity */
.cgw-course-completed .cgw-course-lessons {
    opacity: 1;
}

.cgw-course-completed .cgw-lesson-tile {
    opacity: 1 !important;
}

/* Badge "NOWE" dla kursów */
.cgw-new-badge {
    background: #ff4444;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Nowe lekcje */
.cgw-lesson-tile.cgw-lesson-new {
    position: relative;
    border-color: #ff4444 !important;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.3) !important;
}

.cgw-lesson-tile.cgw-lesson-new:hover {
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4) !important;
}

/* Zapewnienie że usunięcie klasy new nie wpłynie na cały kontener */
.cgw-course .cgw-lesson-tile {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Zapobieganie propagacji opacity na dzieci */
.cgw-course-completed .cgw-lesson-tile {
    opacity: 1 !important;
}

/* Wyłączenie wszelkich pseudo-elementów overlay na naszych elementach */
.cgw-dashboard *::after,
.cgw-dashboard *::before {
    background: none !important;
    opacity: 1 !important;
    display: none !important;
}

/* Specjalne wyłączenie overlay dla naszych klas */
.cgw-group::after,
.cgw-course::after,
.cgw-lesson-tile::after,
.cgw-dashboard::after {
    background: none !important;
    opacity: 1 !important;
    display: none !important;
    content: none !important;
}

.cgw-lesson-new-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* STYLE KOMPAKTOWE */
.cgw-compact .cgw-group-toggle {
    padding: 8px 12px;
    font-size: 13px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #32373c;
    transition: all 0.3s ease;
}

.cgw-compact .cgw-group-toggle:hover {
    background: #e0e0e0;
    color: #1a1a1a;
}

.cgw-compact .cgw-group-toggle:active,
.cgw-compact .cgw-group-toggle:focus,
.cgw-compact .cgw-group.expanded .cgw-group-toggle {
    background: #0073aa;
    color: #ffffff;
}

.cgw-compact .cgw-arrow {
    transition: transform 0.3s ease, color 0.3s ease;
    font-size: 10px;
    color: #666;
}

.cgw-compact .cgw-group-toggle:hover .cgw-arrow {
    color: #1a1a1a;
}

.cgw-compact .cgw-group-toggle:active .cgw-arrow,
.cgw-compact .cgw-group-toggle:focus .cgw-arrow,
.cgw-compact .cgw-group.expanded .cgw-group-toggle .cgw-arrow {
    color: #ffffff;
}

.cgw-compact .cgw-group-count {
    color: #666;
    font-size: 11px;
    font-weight: normal;
    transition: color 0.3s ease;
}

.cgw-compact .cgw-group-toggle:hover .cgw-group-count {
    color: #1a1a1a;
}

.cgw-compact .cgw-group-toggle:active .cgw-group-count,
.cgw-compact .cgw-group-toggle:focus .cgw-group-count,
.cgw-compact .cgw-group.expanded .cgw-group-toggle .cgw-group-count {
    color: #ffffff;
}

.cgw-compact .cgw-course {
    margin-bottom: 8px;
}

.cgw-compact .cgw-course-header {
    padding: 8px 10px;
}

.cgw-compact .cgw-course-title {
    font-size: 13px;
    margin-bottom: 3px;
}

.cgw-compact .cgw-progress-text {
    font-size: 11px;
}

.cgw-compact .cgw-lesson-tile {
    width: 25px;
    height: 25px;
    font-size: 10px;
    margin: 2px;
}

.cgw-compact .cgw-lesson-check {
    font-size: 12px;
}

.cgw-lesson-new-indicator {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ff4444;
    color: #fff;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    border: 1px solid #fff;
    animation: pulse 2s infinite;
}

/* Kompaktowy tryb dla nowych elementów */
.cgw-compact .cgw-new-badge {
    font-size: 8px;
    padding: 1px 4px;
    margin-left: 4px;
}

.cgw-compact .cgw-lesson-new-indicator {
    width: 10px;
    height: 10px;
    font-size: 6px;
    top: -2px;
    right: -2px;
}
