/* ============================================================================
   TRACKER SETTINGS PANEL
   ============================================================================ */

/* Section Header with Actions */
.section-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
}

.panel-btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* Compact Group Info */
.group-info-compact {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    min-height: 60px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    flex-shrink: 0;
    min-width: 100px;
}

.info-value-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.info-value {
    font-size: 0.9rem;
    color: #1f2937;
    text-align: right;
    word-break: break-word;
}

.info-value.invite-code {
    font-family: 'Monaco', 'Menlo', 'SF Mono', monospace;
    font-weight: 600;
    letter-spacing: 1px;
    color: #1d4ed8;
    font-size: 0.95rem;
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.creator {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.role-badge.admin {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}

.role-badge.member {
    background: #e5e7eb;
    color: #6b7280;
}

/* Edit Mode Styles */
.tracker-edit-input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
}

.tracker-edit-input:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.tracker-edit-input {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

/* Ensure edit inputs are hidden by default */
.tracker-edit-input {
    display: none !important;
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
}

/* Edit mode state - show inputs, hide display values */
.info-row.edit-mode .info-value {
    display: none !important;
}

.info-row.edit-mode .tracker-edit-input {
    display: block !important;
}

/* Danger Zone Cards */
.danger-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.danger-card:hover {
    transform: translateX(2px);
}

/* Manage Admins Card - Blue */
.manage-admins-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
    border-color: rgba(59, 130, 246, 0.3);
}

.manage-admins-card:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
    border-color: rgba(59, 130, 246, 0.5);
}

.manage-admins-card .danger-card-icon {
    color: #3b82f6;
}

/* Leave Group Card - Orange */
.leave-group-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(234, 88, 12, 0.05));
    border-color: rgba(249, 115, 22, 0.3);
}

.leave-group-card:hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(234, 88, 12, 0.1));
    border-color: rgba(249, 115, 22, 0.5);
}

.leave-group-card .danger-card-icon {
    color: #f97316;
}

/* Delete Group Card - Red */
.delete-group-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border-color: rgba(239, 68, 68, 0.3);
}

.delete-group-card:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
    border-color: rgba(239, 68, 68, 0.5);
}

.delete-group-card .danger-card-icon {
    color: #ef4444;
}

/* Danger Card Components */
.danger-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.danger-card-icon i {
    font-size: 1.1rem;
}

.danger-card-content {
    flex: 1;
    min-width: 0;
}

.danger-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.125rem;
}

.danger-card-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
}

.danger-card-action {
    flex-shrink: 0;
}

.danger-card-action .fa-chevron-right {
    font-size: 0.9rem;
    color: #9ca3af;
}

/* Button states */
#tracker-edit-toggle-btn.editing {
    background: linear-gradient(135deg, #10b981, #059669);
}

#tracker-edit-toggle-btn.saving {
    opacity: 0.7;
    pointer-events: none;
}

#tracker-cancel-edit-btn.visible {
    display: flex !important;
}

/* Confirmation input section styling */
.confirmation-input-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.confirmation-input-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.9rem;
}

.confirmation-input-section .confirmation-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.confirmation-input-section .confirmation-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.confirmation-input-section .confirmation-input.valid {
    border-color: #10b981;
}

.confirmation-input-section .confirmation-input.invalid {
    border-color: #ef4444;
}

/* Manage Admins Modal Styling */
.manage-admin-modal {
    max-width: 600px;
}

.info-message {
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    border: 2px solid #93c5fd;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.info-text {
    color: #1e40af;
    font-size: 0.9rem;
    line-height: 1.5;
}

.admin-selection-section {
    margin-top: 1rem;
}

.admin-selection-section > label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.member-list-loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.loading-spinner-small {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.member-checkboxes {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.member-checkbox-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
    cursor: pointer;
}

.member-checkbox-item:last-child {
    border-bottom: none;
}

.member-checkbox-item:hover {
    background: #f3f4f6;
}

.member-checkbox-item.placeholder-user-item {
    opacity: 0.6;
    cursor: not-allowed;
}

.member-checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.member-checkbox-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.member-checkbox-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.member-checkbox-item label.placeholder-label {
    cursor: not-allowed;
}

.member-name {
    font-weight: 500;
    color: #1f2937;
    flex: 1;
}

.creator-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}

.placeholder-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.placeholder-users-notice {
    padding: 1rem;
    background: #fef3c7;
    border-top: 2px solid #fbbf24;
    color: #92400e;
    font-size: 0.85rem;
}

.placeholder-users-notice strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #78350f;
}

/* Scrollbar styling for member list */
.member-checkboxes::-webkit-scrollbar {
    width: 8px;
}

.member-checkboxes::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.member-checkboxes::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.member-checkboxes::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}



.admin-restriction-notice {
    padding: 1rem;
    background: #fef3c7;
    border-top: 2px solid #fbbf24;
    color: #92400e;
    font-size: 0.85rem;
}

.admin-restriction-notice strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #78350f;
}

/* Check for archived users on load */
.settings-section .manage-card#tracker-archived-users-card {
    display: none;
}

.settings-section .manage-card#tracker-archived-users-card.has-archived {
    display: flex;
}

/* Mobile adjustments */
@media (max-width: 1024px) {
    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.875rem;
    }
    
    .info-label {
        min-width: auto;
    }
    
    /* FIX: Try to fit horizontally if there's space, otherwise stack */
    .info-value-container {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        flex-wrap: wrap; /* Allow wrapping if needed */
    }

    .info-value {
        text-align: left;
        flex: 1;
        min-width: 0;
    }

    /* FIX: Show invite code prominently */
    .info-value.invite-code {
        font-family: 'Monaco', 'Menlo', 'SF Mono', monospace;
        font-weight: 600;
        letter-spacing: 1px;
        color: #1d4ed8;
        font-size: 0.85rem;
        padding: 0.5rem;
        background: #f0f9ff;
        border: 2px solid #bfdbfe;
        border-radius: 8px;
        text-align: center;
        flex: 1;
        min-width: 120px; /* Minimum width for the code */
    }

    /* FIX: Make copy button compact and right-aligned */
    .info-value-container .panel-btn-small {
        width: auto;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        justify-content: center;
        flex-shrink: 0; /* Don't shrink */
        margin: 0; /* Remove auto margin */
    }
    
    .section-header-with-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .edit-actions {
        width: 100%;
    }
    
    .edit-actions button {
        flex: 1;
    }
    
    .danger-card {
        padding: 0.875rem;
    }
}