/* Groups Feature Styles */

/* Groups Button */
#show-groups-btn {
    margin-left: 10px;
}

/* Panel Overlay */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998; /* Much higher z-index to ensure visibility */
    display: none;
}

/* Groups Panel */
.groups-panel {
    position: fixed;
    top: 0;
    right: -450px; /* Start fully off-screen with extra margin */
    width: 400px;
    height: 100%;
    background-color: var(--brand-red);
    color: white;
    z-index: 9999; /* Much higher z-index to ensure visibility above all other elements */
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden; /* Hide completely when not active */
}

.groups-panel.active {
    right: 0;
    visibility: visible; /* Show when active */
}

.groups-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.groups-panel-header h3 {
    margin: 0;
    color: white;
}

.close-panel-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.close-panel-btn:hover {
    opacity: 0.8;
}

.groups-panel-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Groups List */
.groups-list-section {
    margin-bottom: 30px;
}

.groups-list-section h4 {
    color: white;
    margin-bottom: 15px;
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#no-groups-message {
    font-style: italic;
    opacity: 0.7;
}

.group-item {
    background-color: white;
    color: black;
    border-radius: 6px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-info {
    flex: 1;
}

.group-name {
    font-weight: bold;
    margin-bottom: 3px;
}

.group-count {
    font-size: 0.85rem;
    color: var(--grey-600);
}

.group-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 110px;
    align-items: stretch;
}

.group-action-btn {
    background: #fff !important;
    border: 1.5px solid var(--brand-red, #e74c3c);
    color: #222 !important;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.98em;
    padding: 7px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    outline: none;
    display: block;
    text-transform: none;
    letter-spacing: normal;
    text-indent: 0;
    overflow: visible;
}

.group-action-btn:hover, .group-action-btn:focus, .group-action-btn:active {
    background: var(--brand-red, #e74c3c) !important;
    color: #fff !important;
    border-color: var(--brand-red, #e74c3c);
}

.add-group-btn {
    background-color: white;
    color: black;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.add-group-btn:hover {
    background-color: var(--grey-200);
}

/* Create Group Section */
.create-group-section {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
}

.create-group-section h4 {
    color: white;
    margin-bottom: 15px;
}

.create-group-section .form-group {
    margin-bottom: 15px;
}

.create-group-section label {
    display: block;
    margin-bottom: 5px;
    color: white;
}

.create-group-section input,
.create-group-section textarea {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: white;
    color: black;
}

.create-group-section textarea {
    min-height: 100px;
    resize: vertical;
}

.csv-upload-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    width: 100%;
}
#csv-upload-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    text-align: center;
}

#csv-upload-btn {
    background-color: white;
    color: black;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#csv-upload-btn:hover {
    background-color: var(--grey-200);
}

#csv-filename {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.helper-text {
    font-size: 0.85rem;
    opacity: 0.8;
    color: white !important;
}

#create-group-btn {
    width: 100%;
    background-color: white;
    color: black !important; /* Added !important to override any other styles */
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* Additional selector with higher specificity */
.create-group-section #create-group-btn {
    color: black;
}

#create-group-btn:hover {
    background-color: var(--grey-200);
    color: black !important;
}

/* Group Chips in Participants List */
.group-chip {
    display: inline-flex;
    align-items: center;
    background-color: var(--brand-red);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    margin-right: 5px;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.group-chip-name {
    margin-right: 5px;
}

.remove-group-chip {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 3px;
}

.remove-group-chip:hover {
    opacity: 0.8;
}

/* Group Members Modal */
.group-members-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    z-index: 1002;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: none;
}

.group-members-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-members-header h3 {
    margin: 0;
    color: var(--grey-800);
}

.group-members-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.group-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.group-member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--grey-200);
}

.group-member-email {
    flex: 1;
}

.remove-member-btn {
    background: none;
    border: none;
    color: var(--grey-700);
    cursor: pointer;
    padding: 5px;
}

.remove-member-btn:hover {
    color: var(--brand-red);
}

.group-members-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--grey-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Panel Footer */
.panel-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 20px;
    text-align: center;
}

.panel-footer button {
    min-width: 150px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .groups-panel {
        width: 100%;
        right: -100%;
    }
    
    .group-members-modal {
        width: 95%;
    }
}

/* Animation for panel slide-in */
@keyframes slideIn {
    from {
        right: -400px;
    }
    to {
        right: 0;
    }
}

@keyframes slideOut {
    from {
        right: 0;
    }
    to {
        right: -400px;
    }
}
