/* Groups View Styles */

/* Active state for group button in view switcher */
.view-btn[data-view="groups"].active {
    color: #0984e3 !important;
    /* Blue color for Groups */
}

/* Groups Container */
.groups-container-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    gap: 20px;
    height: 100%;
    padding: 10px;
    width: 100%;
    /* Default single row for 4 groups */
    grid-template-rows: 1fr;
}

.groups-container-grid.layout-8-groups {
    /* Two rows for 8 groups */
    grid-template-rows: repeat(2, 1fr);
}

.groups-container-grid.layout-6-groups {
    /* 3 Columns, 2 Rows for 6 groups */
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.group-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 0 #F0F0F0, 0 8px 16px rgba(0, 0, 0, 0.05);
    border: 3px solid #F5F6FA;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #E0E0E0, 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: #74b9ff;
}

.group-header {
    background: #dfe6e9;
    /* Default Gray */
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #b2bec3;
    gap: 10px;
}

.group-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex: 1;
}

.group-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-header-right {
    display: flex;
    align-items: center;
}

.group-count {
    background: rgba(0, 0, 0, 0.1);
    color: #636e72;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.group-avg {
    font-size: 14px;
    font-weight: bold;
    color: #2d3436;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-radius: 12px;
}

/* Group Colors */
.group-card:nth-child(1) .group-header {
    background: #ffeaa7;
    border-color: #fdcb6e;
}

/* Yellow */
.group-card:nth-child(2) .group-header {
    background: #81ecec;
    border-color: #00cec9;
}

/* Cyan */
.group-card:nth-child(3) .group-header {
    background: #fab1a0;
    border-color: #e17055;
}

/* Red */
.group-card:nth-child(4) .group-header {
    background: #a29bfe;
    border-color: #6c5ce7;
}

/* Purple */

/* Group 5: Mint */
.group-card:nth-child(5) .group-header {
    background: #55efc4;
    border-color: #00b894;
}

/* Group 6: Pink */
.group-card:nth-child(6) .group-header {
    background: #fd79a8;
    border-color: #e84393;
}

/* Group 7: Blue */
.group-card:nth-child(7) .group-header {
    background: #74b9ff;
    border-color: #0984e3;
}

/* Group 8: Light Gray */
.group-card:nth-child(8) .group-header {
    background: #dfe6e9;
    border-color: #b2bec3;
}

.group-title {
    font-weight: 800;
    font-size: 16px;
    color: #2D3436;
}

.group-score {
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 900;
    color: #2D3436;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.1s;
    user-select: none;
    position: relative;
}

.group-score:hover {
    transform: scale(1.1);
}

.group-score:active {
    transform: scale(0.95);
}

.group-score::after {
    content: "▼";
    font-size: 10px;
    margin-left: 5px;
    opacity: 0.5;
}

.group-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.group-students-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    align-content: flex-start;
}

/* 3D Student Card (Pseudo-3D) */
.group-student-card-3d {
    background: white;
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
    font-weight: 800;
    color: #2D3436;
    border: 3px solid #F0F0F0;
    box-shadow: 0 4px 0 #E0E0E0, 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    user-select: none;
    cursor: grab;
    cursor: grab;
    font-size: 14px;
    letter-spacing: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-student-card-3d:active {
    cursor: grabbing;
}

.group-student-card-3d.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

.group-student-card-3d.touch-drag-active {
    border-color: #1DD1A1;
    background: #E8F9F5;
    box-shadow: 0 0 0 3px rgba(29, 209, 161, 0.4);
    animation: touchPulse 1s infinite;
}

@keyframes touchPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.group-card.group-drag-over {
    border-color: #1DD1A1;
    background: #F0FFF4;
    transform: scale(1.02);
}

.group-score-static {
    font-size: 12px;
    color: #636e72;
    background: rgba(255, 255, 255, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.group-avg-btn {
    background: white;
    padding: 4px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 0 #bdc3c7;
    font-size: 13px;
    font-weight: bold;
    color: #2d3436;
    cursor: pointer;
    transition: transform 0.1s;
}

.group-avg-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 0 #b2bec3;
    color: #0984e3;
}

.group-avg-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #b2bec3;
}

/* Floating Action Popup */
.group-action-popup {
    position: absolute;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
    z-index: 1000;
    display: flex;
    gap: 8px;
    width: max-content;
    animation: popupFadeIn 0.2s ease-out;
}

.group-action-popup::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: white;
    transform: rotate(45deg);
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.group-action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    color: white;
    transition: transform 0.1s;
}

.group-action-btn:hover {
    transform: scale(1.05);
}

.btn-g-add {
    background: #00b894;
    box-shadow: 0 3px 0 #00a884;
}

.btn-g-sub {
    background: #ff7675;
    box-shadow: 0 3px 0 #d63031;
}